From 3a6bb94efe52d38a771e97ab9123aa6031475ea9 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Wed, 25 Nov 2020 15:03:30 +0800 Subject: [PATCH 001/147] =?UTF-8?q?REPORT-42237=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=BF=87=E7=A8=8B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/EditingMouseListener.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 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 524dd8bf1..0dcab318f 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 @@ -194,7 +194,7 @@ public class EditingMouseListener extends MouseInputAdapter { e.translatePoint(oldX - e.getX(), oldY - e.getY()); } - private void offsetEventPoint(MouseEvent e){ + private void offsetEventPoint(MouseEvent e) { int x = designer.getRelativeX(e.getX()); int y = designer.getRelativeY(e.getY()); e.translatePoint(x - e.getX(), y - e.getY()); @@ -206,8 +206,8 @@ public class EditingMouseListener extends MouseInputAdapter { * @param e 鼠标事件 */ public void mouseReleased(MouseEvent e) { - MouseEvent transEvent = new MouseEvent(e.getComponent(), MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); - MouseEvent clickEvent = new MouseEvent(e.getComponent(), MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); + MouseEvent transEvent = new MouseEvent(e.getComponent(), MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); + MouseEvent clickEvent = new MouseEvent(e.getComponent(), MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); int oldX = e.getX(); int oldY = e.getY(); offsetEventPoint(e); @@ -240,7 +240,7 @@ public class EditingMouseListener extends MouseInputAdapter { } } - private boolean isAutoFire(MouseEvent transEvent, MouseEvent clickEvent ) { + private boolean isAutoFire(MouseEvent transEvent, MouseEvent clickEvent) { offsetEventPoint(transEvent); XCreator xCreator = designer.getComponentAt(transEvent); return (pressX != clickEvent.getX() || pressY != clickEvent.getY()) @@ -662,6 +662,7 @@ public class EditingMouseListener extends MouseInputAdapter { */ public void startEditing(XCreator creator, DesignerEditor designerEditor, ComponentAdapter adapter) { if (designerEditor != null) { + EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); Rectangle rect = ComponentUtils.getRelativeBounds(creator); currentEditor = designerEditor; currentXCreator = creator; @@ -728,15 +729,15 @@ public class EditingMouseListener extends MouseInputAdapter { /** * 刷新顶层组件 - * */ - public void refreshTopXCreator(boolean isEditing){ + */ + public void refreshTopXCreator(boolean isEditing) { designer.refreshTopXCreator(isEditing); } /** * 刷新顶层组件 - * */ - public void refreshTopXCreator(){ + */ + public void refreshTopXCreator() { refreshTopXCreator(false); } From 8da706423ca45aeb29d48e4793c56e659baa2aa0 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Wed, 25 Nov 2020 15:36:42 +0800 Subject: [PATCH 002/147] =?UTF-8?q?REPORT-42237=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/designer/creator/XChartEditor.java | 4 ++++ .../java/com/fr/design/mainframe/EditingMouseListener.java | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) 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 c002bceb3..38cab33dc 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 @@ -14,6 +14,7 @@ import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.CoverReportPane; +import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.HelpDialogManager; @@ -266,6 +267,9 @@ public class XChartEditor extends XBorderStyleWidgetCreator { if (editingMouseListener.stopEditing()) { if (this != (XCreator) designer.getRootComponent()) { ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); + if (isEditing) { + EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); + } editingMouseListener.startEditing(this, isEditing ? adapter.getDesignerEditor() : null, adapter); } } 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 0dcab318f..b9ce52fc5 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 @@ -662,7 +662,6 @@ public class EditingMouseListener extends MouseInputAdapter { */ public void startEditing(XCreator creator, DesignerEditor designerEditor, ComponentAdapter adapter) { if (designerEditor != null) { - EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); Rectangle rect = ComponentUtils.getRelativeBounds(creator); currentEditor = designerEditor; currentXCreator = creator; From 848c5c8c19d00176e4b80bd4e4c8af5cc037c8a5 Mon Sep 17 00:00:00 2001 From: Lanlan Date: Fri, 4 Dec 2020 12:11:46 +0800 Subject: [PATCH 003/147] =?UTF-8?q?KERNEL-6154=20GeneralXMLTools=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=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/start/module/DesignerActivator.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 3f1aa2663..495252e38 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -99,6 +99,7 @@ import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.CellImagePainter; import com.fr.stable.ArrayUtils; +import com.fr.stable.EssentialUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; import com.fr.stable.os.support.OSBasedAction; @@ -191,8 +192,8 @@ public class DesignerActivator extends Activator { justStartModules4Designer(); CalculatorProviderContext.setValueConverter(valueConverter()); - GeneralXMLTools.Object_Tokenizer = startXMLReadObjectTokenizer(); - GeneralXMLTools.Object_XML_Writer_Finder = startObjectXMLWriterFinder(); + EssentialUtils.Object_Tokenizer = startXMLReadObjectTokenizer(); + EssentialUtils.Object_XML_Writer_Finder = startObjectXMLWriterFinder(); addAdapterForPlate(); designerRegister(); From 6be11344efb029635faabe37803d33ab93679240 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 7 Dec 2020 17:21:21 +0800 Subject: [PATCH 004/147] =?UTF-8?q?REPORT-42240=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=87=8C=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=EF=BC=88=E8=A1=A8=E5=8D=95=E3=80=81=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=89=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 20 +++++++++++++++++++ .../mainframe/widget/BasicPropertyPane.java | 14 ++++++++++--- .../com/fr/design/preview/FormPreview.java | 2 +- .../fit/menupane/ReportFitAttrAction.java | 4 ++-- .../widget/WidgetBoundsPaneFactory.java | 4 ++-- .../widget/ui/FormBasicPropertyPane.java | 3 +++ .../ui/FormBasicWidgetPropertyPane.java | 8 ++++++++ .../ui/BasicWidgetPropertySettingPane.java | 2 +- 8 files changed, 48 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 0703216eb..c7e24ee87 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -18,6 +18,7 @@ import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.general.FRFont; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.injectable.PluginModule; @@ -108,6 +109,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { AUTHORITY_EDITION, // 权限编辑 AUTHORITY_EDITION_DISABLED // 权限编辑 } + private PropertyMode currentMode; // 当前模式(根据不同模式,显示不同的可用面板) @@ -400,6 +402,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void updatePropertyItemMap() { for (PropertyItem item : propertyItemMap.values()) { item.updateStatus(); + item.updateTitle(); } } @@ -734,6 +737,23 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } } + public void updateTitle() { + try { + if ("widgetSettings".equals(name)) { + if (currentMode == PropertyMode.FORM) { + title = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"); + } else { + title = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Settings"); + } + button.setToolTipText(title); + UILabel uiLabel = (UILabel) ((BorderLayout)popupToolPane.contentPane.getLayout()).getLayoutComponent(BorderLayout.WEST); + uiLabel.setText(title); + } + }catch (Exception e){ + FineLoggerFactory.getLogger().error(e.getMessage()); + } + } + public void reAddContentArea() { propertyPanel.add(contentArea, BorderLayout.CENTER); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java index 099684a81..3ee762214 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java @@ -57,19 +57,27 @@ public class BasicPropertyPane extends BasicPane { } }; widgetName.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")); + addBasicComponents(); + } + + public void addBasicComponents(){ double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Name")), widgetName}, - }; + Component[][] components = createBasicComponents(); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); this.add(panel, BorderLayout.NORTH); } + public Component[][] createBasicComponents(){ + return new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Name")), widgetName}, + }; + } + public UITextField getWidgetNameField() { return widgetName; } diff --git a/designer-base/src/main/java/com/fr/design/preview/FormPreview.java b/designer-base/src/main/java/com/fr/design/preview/FormPreview.java index 8522d6773..b16c0595f 100644 --- a/designer-base/src/main/java/com/fr/design/preview/FormPreview.java +++ b/designer-base/src/main/java/com/fr/design/preview/FormPreview.java @@ -12,7 +12,7 @@ public class FormPreview extends AbstractPreviewProvider { @Override public String nameForPopupItem() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Form_Preview"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_PC_Preview"); } @Override diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index c24125059..ac0472f11 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -26,7 +26,7 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Template"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"); } @Override @@ -42,7 +42,7 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Elementcase"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); } @Override 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 c4c840227..19a046f48 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 @@ -53,11 +53,11 @@ public class WidgetBoundsPaneFactory { double p = TableLayout.PREFERRED; Component[][] northComponents = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Position")), createRightPane(x, y)}, + new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Position")), createRightPane(x, y)}, new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER))}, }; Component[][] centerComponents = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Size")), createRightPane(width, height)}, + new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Size")), createRightPane(width, height)}, new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, }; double[] rowSize = {p, p}; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java index 42d398416..1754d75d2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java @@ -1,8 +1,11 @@ package com.fr.design.mainframe.widget.ui; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.widget.BasicPropertyPane; import com.fr.form.ui.Widget; +import java.awt.Component; + /** * Created by ibm on 2017/8/4. */ diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java index 138434d30..adf658ed2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java @@ -1,9 +1,11 @@ package com.fr.design.mainframe.widget.ui; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.form.ui.Widget; import javax.swing.BorderFactory; +import java.awt.*; /** * Created by ibm on 2017/7/26. @@ -23,6 +25,12 @@ public class FormBasicWidgetPropertyPane extends BasicSetVisiblePropertyPane { return enableCheckBox; } + public Component[][] createBasicComponents(){ + return new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Name")), widgetName}, + }; + } + @Override public String title4PopupWindow() { return "basicProperty"; diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java index 8b520f318..23fd119f3 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java @@ -34,7 +34,7 @@ public class BasicWidgetPropertySettingPane extends BasicPane { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form-Widget_Name")), widgetNameComboBox}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Name")), widgetNameComboBox}, new Component[]{enableCheckBox, null}, new Component[]{visibleCheckBox, null}, }; From 18c628d45635cd7abc4a57650350221427cab517 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 7 Dec 2020 17:25:49 +0800 Subject: [PATCH 005/147] =?UTF-8?q?REPORT-42240=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=87=8C=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=EF=BC=88=E8=A1=A8=E5=8D=95=E3=80=81=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=89=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/widget/ui/FormBasicPropertyPane.java | 3 --- .../mainframe/widget/ui/FormBasicWidgetPropertyPane.java | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java index 1754d75d2..42d398416 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java @@ -1,11 +1,8 @@ package com.fr.design.mainframe.widget.ui; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.widget.BasicPropertyPane; import com.fr.form.ui.Widget; -import java.awt.Component; - /** * Created by ibm on 2017/8/4. */ diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java index adf658ed2..de7cdb41b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java @@ -5,7 +5,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.form.ui.Widget; import javax.swing.BorderFactory; -import java.awt.*; +import java.awt.Component; /** * Created by ibm on 2017/7/26. From 511ac04eea8b1773092c88e45dd128410af0733c Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 8 Dec 2020 09:28:41 +0800 Subject: [PATCH 006/147] =?UTF-8?q?REPORT-42240=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=87=8C=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=EF=BC=88=E8=A1=A8=E5=8D=95=E3=80=81=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=89=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/EastRegionContainerPane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index c7e24ee87..546d4beb0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -739,17 +739,17 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void updateTitle() { try { - if ("widgetSettings".equals(name)) { + if (StringUtils.equals(KEY_WIDGET_SETTINGS, name)) { if (currentMode == PropertyMode.FORM) { title = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"); } else { title = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Settings"); } button.setToolTipText(title); - UILabel uiLabel = (UILabel) ((BorderLayout)popupToolPane.contentPane.getLayout()).getLayoutComponent(BorderLayout.WEST); + UILabel uiLabel = (UILabel) ((BorderLayout) popupToolPane.contentPane.getLayout()).getLayoutComponent(BorderLayout.WEST); uiLabel.setText(title); } - }catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage()); } } From 16dd77dc30e6d30a5a89bade080efe77f58932ae Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 8 Dec 2020 11:11:10 +0800 Subject: [PATCH 007/147] =?UTF-8?q?REPORT-42240=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=87=8C=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=EF=BC=88=E8=A1=A8=E5=8D=95=E3=80=81=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=89=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 28 ++++++++++++------- .../mainframe/widget/BasicPropertyPane.java | 17 +++++------ .../com/fr/design/preview/FormPreview.java | 3 +- .../fit/menupane/ReportFitAttrAction.java | 5 ++-- .../widget/WidgetBoundsPaneFactory.java | 21 +++++++------- .../ui/FormBasicWidgetPropertyPane.java | 11 ++++---- .../ui/BasicWidgetPropertySettingPane.java | 7 +++-- 7 files changed, 50 insertions(+), 42 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 546d4beb0..8c59f23f5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -98,16 +98,24 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private PropertyItem selectedItem; // 当前被选中的属性配置项 public enum PropertyMode { - REPORT, // 报表 - REPORT_PARA, // 报表参数面板 - REPORT_FLOAT, // 报表悬浮元素 - FORM, // 表单 - FORM_REPORT, // 表单报表块 - POLY, // 聚合报表 - POLY_REPORT, // 聚合报表-报表块 - POLY_CHART, // 聚合报表-图表块 - AUTHORITY_EDITION, // 权限编辑 - AUTHORITY_EDITION_DISABLED // 权限编辑 + REPORT("report"), // 报表 + REPORT_PARA("reportPara"), // 报表参数面板 + REPORT_FLOAT("reportFloat"), // 报表悬浮元素 + FORM("form"), // 表单 + FORM_REPORT("formReport"), // 表单报表块 + POLY("poly"), // 聚合报表 + POLY_REPORT("polyReport"), // 聚合报表-报表块 + POLY_CHART("polyChart"), // 聚合报表-图表块 + AUTHORITY_EDITION("authorityEdition"), // 权限编辑 + AUTHORITY_EDITION_DISABLED ("authorityEditionDisabled"); // 权限编辑 + + private String value; + PropertyMode(String value) { + this.value = value; + } + public String getValue() { + return this.value; + } } private PropertyMode currentMode; // 当前模式(根据不同模式,显示不同的可用面板) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java index 3ee762214..23cc188ed 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java @@ -4,6 +4,7 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -56,26 +57,22 @@ public class BasicPropertyPane extends BasicPane { } } }; - widgetName.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")); - addBasicComponents(); - } - - public void addBasicComponents(){ + widgetName.setGlobalName(Toolkit.i18nText("Fine-Design_Report_Basic")); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}}; - Component[][] components = createBasicComponents(); + Component[][] components = new Component[][]{ + new Component[]{new UILabel(obtainBasicName()), widgetName}, + }; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); this.add(panel, BorderLayout.NORTH); } - public Component[][] createBasicComponents(){ - return new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Name")), widgetName}, - }; + public String obtainBasicName(){ + return Toolkit.i18nText("Fine-Design_Basic_Component_Name"); } public UITextField getWidgetNameField() { diff --git a/designer-base/src/main/java/com/fr/design/preview/FormPreview.java b/designer-base/src/main/java/com/fr/design/preview/FormPreview.java index b16c0595f..178779f51 100644 --- a/designer-base/src/main/java/com/fr/design/preview/FormPreview.java +++ b/designer-base/src/main/java/com/fr/design/preview/FormPreview.java @@ -1,6 +1,7 @@ package com.fr.design.preview; import com.fr.design.fun.impl.AbstractPreviewProvider; +import com.fr.design.i18n.Toolkit; /** @@ -12,7 +13,7 @@ public class FormPreview extends AbstractPreviewProvider { @Override public String nameForPopupItem() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_PC_Preview"); + return Toolkit.i18nText("Fine-Design_Form_M_PC_Preview"); } @Override diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index ac0472f11..06770c1b4 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -4,6 +4,7 @@ import com.fr.design.actions.JTemplateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.UIDialog; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuKeySet; @@ -26,7 +27,7 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"); + return Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"); } @Override @@ -42,7 +43,7 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); + return Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); } @Override 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 19a046f48..9b2b64d09 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 @@ -4,6 +4,7 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -25,8 +26,8 @@ public class WidgetBoundsPaneFactory { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Size")), createRightPane(width, height)}, - new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, + new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), 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}; @@ -34,7 +35,7 @@ public class WidgetBoundsPaneFactory { 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(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); } public static JPanel createRightPane(Component com1, Component com2){ double f = TableLayout.FILL; @@ -53,12 +54,12 @@ public class WidgetBoundsPaneFactory { double p = TableLayout.PREFERRED; Component[][] northComponents = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Position")), createRightPane(x, y)}, - new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER))}, + new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Position")), 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))}, }; Component[][] centerComponents = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Size")), createRightPane(width, height)}, - new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, + new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Size")), 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}; @@ -70,7 +71,7 @@ public class WidgetBoundsPaneFactory { centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); boundsPane.add(northPanel, BorderLayout.NORTH); boundsPane.add(centerPanel, BorderLayout.CENTER); - return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 230, 24, boundsPane); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 230, 24, boundsPane); } @@ -79,7 +80,7 @@ public class WidgetBoundsPaneFactory { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Size")), width}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), width}, }; double[] rowSize = {p}; double[] columnSize = {p, f}; @@ -87,6 +88,6 @@ public class WidgetBoundsPaneFactory { final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L6); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); boundsPane.add(panel); - return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java index de7cdb41b..27d55ac28 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.widget.ui; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.form.ui.Widget; import javax.swing.BorderFactory; @@ -18,17 +19,15 @@ public class FormBasicWidgetPropertyPane extends BasicSetVisiblePropertyPane { } public UICheckBox createOtherConfig() { - enableCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Enabled"), true); - enableCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")); + enableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Enabled"), true); + enableCheckBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_Basic")); enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); return enableCheckBox; } - public Component[][] createBasicComponents(){ - return new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Name")), widgetName}, - }; + public String obtainBasicName(){ + return Toolkit.i18nText("Fine-Design_Basic_Widget_Name"); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java index 23fd119f3..1be67275f 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java @@ -4,6 +4,7 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.dialog.BasicPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.NoneWidget; @@ -25,16 +26,16 @@ public class BasicWidgetPropertySettingPane extends BasicPane { public BasicWidgetPropertySettingPane() { this.setLayout(new BorderLayout()); - enableCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Enabled"), true); + enableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Enabled"), true); enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); - visibleCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Visible"), true); + visibleCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Form_Widget_Visible"), true); visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); widgetNameComboBox = new ParameterTreeComboBox(); widgetNameComboBox.refreshTree(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Name")), widgetNameComboBox}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Name")), widgetNameComboBox}, new Component[]{enableCheckBox, null}, new Component[]{visibleCheckBox, null}, }; From c8af274aff9a8a38399150cadceeb66a44a15973 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 8 Dec 2020 13:58:17 +0800 Subject: [PATCH 008/147] =?UTF-8?q?REPORT-42240=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=87=8C=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=EF=BC=88=E8=A1=A8=E5=8D=95=E3=80=81=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=89=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 8c59f23f5..a95b92400 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -98,23 +98,29 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private PropertyItem selectedItem; // 当前被选中的属性配置项 public enum PropertyMode { - REPORT("report"), // 报表 - REPORT_PARA("reportPara"), // 报表参数面板 - REPORT_FLOAT("reportFloat"), // 报表悬浮元素 - FORM("form"), // 表单 - FORM_REPORT("formReport"), // 表单报表块 - POLY("poly"), // 聚合报表 - POLY_REPORT("polyReport"), // 聚合报表-报表块 - POLY_CHART("polyChart"), // 聚合报表-图表块 - AUTHORITY_EDITION("authorityEdition"), // 权限编辑 - AUTHORITY_EDITION_DISABLED ("authorityEditionDisabled"); // 权限编辑 + REPORT, // 报表 + REPORT_PARA, // 报表参数面板 + REPORT_FLOAT, // 报表悬浮元素 + FORM(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 表单 + FORM_REPORT, // 表单报表块 + POLY, // 聚合报表 + POLY_REPORT, // 聚合报表-报表块 + POLY_CHART, // 聚合报表-图表块 + AUTHORITY_EDITION, // 权限编辑 + AUTHORITY_EDITION_DISABLED; // 权限编辑 - private String value; - PropertyMode(String value) { - this.value = value; + private String title; + + PropertyMode() { + this.title = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Settings"); } - public String getValue() { - return this.value; + + PropertyMode(String title) { + this.title = title; + } + + public String getTitle() { + return this.title; } } @@ -748,11 +754,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void updateTitle() { try { if (StringUtils.equals(KEY_WIDGET_SETTINGS, name)) { - if (currentMode == PropertyMode.FORM) { - title = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"); - } else { - title = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Settings"); - } + title = currentMode.getTitle(); button.setToolTipText(title); UILabel uiLabel = (UILabel) ((BorderLayout) popupToolPane.contentPane.getLayout()).getLayoutComponent(BorderLayout.WEST); uiLabel.setText(title); From 99d18406b87dce0823b6c6380dc596bd42f397c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 8 Dec 2020 18:48:02 +0800 Subject: [PATCH 009/147] =?UTF-8?q?CHART-17249=20=E9=AB=98=E5=BE=B7?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/drillMap/DrillMapLayerPane.java | 4 +- .../designer/data/comp/DrillMapLayerPane.java | 4 +- .../type/VanChartDrillMapPlotPane.java | 16 +- .../type/VanChartHeatMapSourceChoosePane.java | 15 - .../type/VanChartHeatMapTypePane.java | 24 +- .../chart/map/designer/type/GeoUrlPane.java | 258 +++++++ .../chart/map/designer/type/GisLayerPane.java | 303 ++++++++ .../map/designer/type/MapStatusPane.java | 167 ++++ .../map/designer/type/TileLayerPane.java | 51 ++ .../designer/type/VanChartMapPlotPane.java | 1 - .../type/VanChartMapSourceChoosePane.java | 714 ++---------------- .../chart/map/designer/type/WMSLayerPane.java | 165 ++++ 12 files changed, 1022 insertions(+), 700 deletions(-) delete mode 100644 designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapSourceChoosePane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GeoUrlPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/type/MapStatusPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/type/TileLayerPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java diff --git a/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapLayerPane.java b/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapLayerPane.java index 1102f7a64..8c62d6e72 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapLayerPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapLayerPane.java @@ -14,7 +14,7 @@ import com.fr.plugin.chart.type.MapType; import com.fr.plugin.chart.type.ZoomLevel; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.drillmap.designer.data.comp.MapDataTree; -import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; +import com.fr.van.chart.map.designer.type.MapStatusPane; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -154,7 +154,7 @@ public class DrillMapLayerPane extends BasicBeanPane { rowSize[i + 1] = p; int d = i + 1; UILabel label = new UILabel(String.format("%s%d%s", Toolkit.i18nText("Fine-Design_Chart_Index_Article"), d, Toolkit.i18nText("Fine-Design_Chart_Index_Layer"))); - UIComboBox level = new UIComboBox(VanChartMapSourceChoosePane.ZOOM_LEVELS); + UIComboBox level = new UIComboBox(MapStatusPane.ZOOM_LEVELS); level.setEnabled(i != 0); UIComboBox type = new UIComboBox(items); detailComps[i + 1] = new Component[]{label, level, type}; diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java index 0c6fcc1e4..749755991 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java @@ -14,7 +14,7 @@ import com.fr.plugin.chart.map.server.CompatibleGeoJSONTreeHelper; import com.fr.plugin.chart.type.MapType; import com.fr.plugin.chart.type.ZoomLevel; import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; +import com.fr.van.chart.map.designer.type.MapStatusPane; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -105,7 +105,7 @@ public class DrillMapLayerPane extends BasicScrollPane { rowSize[i + 1] = p; int d = i + 1; UILabel label = new UILabel(String.format("%s%d%s", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Index_Article"), d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Index_Layer"))); - UIComboBox level = new UIComboBox(VanChartMapSourceChoosePane.ZOOM_LEVELS); + UIComboBox level = new UIComboBox(MapStatusPane.ZOOM_LEVELS); level.setEnabled(i != 0); UIComboBox type = new UIComboBox(TEMP.get(oldMapType)); detailComps[i + 1] = new Component[]{label, level, type}; diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/type/VanChartDrillMapPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/type/VanChartDrillMapPlotPane.java index c4a803134..48f8b2434 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/type/VanChartDrillMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/type/VanChartDrillMapPlotPane.java @@ -8,11 +8,14 @@ import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.drillmap.DrillMapIndependentVanChart; import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; import com.fr.plugin.chart.drillmap.data.DrillMapDefinition; +import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; import com.fr.plugin.chart.type.MapType; import com.fr.plugin.chart.type.ZoomLevel; +import com.fr.van.chart.map.designer.type.GeoUrlPane; import com.fr.van.chart.map.designer.type.VanChartMapPlotPane; import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; +import javax.swing.tree.TreeNode; import java.util.ArrayList; /** @@ -30,10 +33,15 @@ public class VanChartDrillMapPlotPane extends VanChartMapPlotPane { @Override protected VanChartMapSourceChoosePane createSourceChoosePane() { - return new VanChartMapSourceChoosePane(){ + return new VanChartMapSourceChoosePane() { @Override - protected boolean supportParam(){ - return false; + protected void initGeoUrlPane() { + setGeoUrlPane(new GeoUrlPane() { + @Override + protected TreeNode getRootNode() { + return GEOJSONTreeHelper.getInstance().getRootNodeWithoutPara(); + } + }); } }; } @@ -59,7 +67,7 @@ public class VanChartDrillMapPlotPane extends VanChartMapPlotPane { protected void resetAttr(Plot plot) { super.resetAttr(plot); - if(plot instanceof VanChartDrillMapPlot) { + if (plot instanceof VanChartDrillMapPlot) { resetLayerTypeAndZoomLevel((VanChartDrillMapPlot) plot); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapSourceChoosePane.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapSourceChoosePane.java deleted file mode 100644 index 3eaec5f59..000000000 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapSourceChoosePane.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.fr.van.chart.heatmap.designer.type; - -import com.fr.design.gui.ilable.UILabel; - -import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; - -/** - * Created by Mitisky on 16/10/20. - */ -public class VanChartHeatMapSourceChoosePane extends VanChartMapSourceChoosePane { - @Override - protected UILabel createSourceTitleLabel() { - return new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Area_And_Point")); - } -} diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java index 8f4a72de2..32529591e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java @@ -3,6 +3,8 @@ package com.fr.van.chart.heatmap.designer.type; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chartx.data.ChartDataDefinitionProvider; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartPlot; @@ -11,6 +13,7 @@ import com.fr.plugin.chart.heatmap.HeatMapIndependentVanChart; import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; import com.fr.plugin.chart.vanchart.VanChart; +import com.fr.van.chart.map.designer.type.GeoUrlPane; import com.fr.van.chart.map.designer.type.VanChartMapPlotPane; import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; @@ -27,18 +30,27 @@ public class VanChartHeatMapTypePane extends VanChartMapPlotPane { @Override protected VanChartMapSourceChoosePane createSourceChoosePane() { - return new VanChartHeatMapSourceChoosePane(); + return new VanChartMapSourceChoosePane() { + @Override + protected void initGeoUrlPane() { + setGeoUrlPane(new GeoUrlPane() { + @Override + protected UILabel createSourceTitleLabel() { + return new UILabel(Toolkit.i18nText("Fine-Design_Chart_Map_Area_And_Point")); + } + }); + } + }; } //适用一种图表只有一种类型的 public void populateBean(VanChart chart) { typeDemo.get(0).isPressing = true; - VanChartHeatMapPlot plot = (VanChartHeatMapPlot)chart.getPlot(); + VanChartHeatMapPlot plot = (VanChartHeatMapPlot) chart.getPlot(); populateSourcePane(plot); boolean enabled = !CompatibleGEOJSONHelper.isDeprecated(plot.getGeoUrl()); GUICoreUtils.setEnabled(this.getTypePane(), enabled); - GUICoreUtils.setEnabled(this.getSourceChoosePane().getSourceComboBox(), enabled); checkDemosBackground(); } @@ -53,13 +65,13 @@ public class VanChartHeatMapTypePane extends VanChartMapPlotPane { return tools; } - protected Plot getSelectedClonedPlot(){ + protected Plot getSelectedClonedPlot() { Chart chart = getDefaultChart(); - VanChartHeatMapPlot newPlot = (VanChartHeatMapPlot)chart.getPlot(); + VanChartHeatMapPlot newPlot = (VanChartHeatMapPlot) chart.getPlot(); Plot cloned = null; try { - cloned = (Plot)newPlot.clone(); + cloned = (Plot) newPlot.clone(); } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GeoUrlPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GeoUrlPane.java new file mode 100644 index 000000000..c69297fa8 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GeoUrlPane.java @@ -0,0 +1,258 @@ +package com.fr.van.chart.map.designer.type; + +import com.fr.base.Parameter; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; +import com.fr.design.constants.LayoutConstants; +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.icombobox.FRTreeComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; +import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; +import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; +import com.fr.plugin.chart.type.MapType; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.drillmap.designer.data.comp.MapDataTree; +import com.fr.workspace.WorkContext; + +import javax.swing.JPanel; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-07 + */ +public class GeoUrlPane extends JPanel implements UIObserver { + + private UILabel sourceTitleLabel; + private FRTreeComboBox sourceComboBox; + private MapDataTree mapDataTree; + private TreePath selectTreePath; + + private UIObserverListener listener; + + private String[] oldParams; + + public GeoUrlPane() { + initComps(); + } + + private void initComps() { + this.setLayout(new BorderLayout()); + this.add(createMapSourcesPane(), BorderLayout.CENTER); + } + + + @Override + public void registerChangeListener(UIObserverListener listener) { + this.listener = listener; + } + + @Override + public boolean shouldResponseChangeListener() { + return true; + } + + private JPanel createMapSourcesPane() { + + mapDataTree = new MapDataTree(this.getRootNode()); + mapDataTree.setEditable(false); + mapDataTree.selectDefaultTreeNode(); + sourceComboBox = new FRTreeComboBox(mapDataTree, mapDataTree.getCellRenderer()) { + //搜索 + protected void dealSamePath(TreePath parent, TreeNode node, UITextField textField) { + String searchText = textField.getText(); + GeoUrlPane.this.mapDataTree.search(searchText); + } + + //选中 tree---combobox + public void setSelectedItem(Object o) { + TreePath oldPath = mapDataTree.getSelectionPath(); + Object oldText = getSelectedItem(); + if (o != null && o instanceof TreePath) { + selectTreePath = (TreePath) o; + this.tree.setSelectionPath(selectTreePath); + this.getModel().setSelectedItem(pathToString(selectTreePath)); + if (ComparatorUtils.equals(oldText, getSelectedItem()) && !ComparatorUtils.equals(oldPath, selectTreePath)) { + //point的江苏省切换到area的江苏省 + listener.doChange(); + } + } else if (o instanceof String) {//list里面没有 + selectTreePath = null; + this.tree.setSelectionPath(null); + this.getModel().setSelectedItem(ChartGEOJSONHelper.getPresentNameWithPath((String) o)); + } + } + + @Override + protected String pathToString(TreePath path) { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); + //不显示后缀 + return ChartGEOJSONHelper.getPresentNameWithPath(node.toString()); + } + + @Override + protected boolean customSelectable(DefaultMutableTreeNode node) { + return GEOJSONTreeHelper.isSelectableTreeNode(node); + } + }; + sourceComboBox.setEditable(true); + sourceComboBox.setOnlyLeafSelectable(false); + sourceComboBox.addPopupMenuListener(popupMenuListener); + sourceTitleLabel = createSourceTitleLabel(); + + + boolean hasRefreshButton = !WorkContext.getCurrent().isLocal(); + UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/images/control/refresh.png")); + button.setToolTipText(Toolkit.i18nText("Fine-Design_Chart_Update_Remote_Map_JSON")); + button.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + GEOJSONHelper.reset(); + GEOJSONHelper.getInstance(); + } + }); + + double p = TableLayout.PREFERRED; + double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double f = TableLayout.FILL; + double[] rowSize = {p, p}; + double[] columnSize = hasRefreshButton ? new double[]{d + 10, e - 20, 20} : new double[]{f, e}; + + Component[] comps = hasRefreshButton + ? new Component[]{sourceTitleLabel, sourceComboBox, button} + : new Component[]{sourceTitleLabel, sourceComboBox}; + + double hGap = hasRefreshButton ? 0 : TableLayout4VanChartHelper.COMPONENT_INTERVAL; + Component[][] components = new Component[][]{ + new Component[]{null, null}, + comps, + }; + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, hGap, LayoutConstants.VGAP_LARGE); + } + + protected UILabel createSourceTitleLabel() { + return new UILabel(Toolkit.i18nText("Fine-Design_Chart_Map_Area")); + } + + protected TreeNode getRootNode() { + return GEOJSONTreeHelper.getInstance().getRootNodeWithPara(); + } + + private String[] getParamsName() { + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + + if (jTemplate == null) { + return new String[0]; + } + + Parameter[] parameters = jTemplate.getJTemplateParameters(); + + int len = parameters.length; + String[] names = new String[len]; + + for (int i = 0; i < len; i++) { + names[i] = parameters[i].getName(); + } + + return names; + } + + private PopupMenuListener popupMenuListener = new PopupMenuListener() { + public void popupMenuCanceled(PopupMenuEvent e) { + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + } + + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + + GEOJSONTreeHelper.reset(); + mapDataTree.changeRootNode(GeoUrlPane.this.getRootNode()); + GEOJSONTreeHelper.getInstance().updateParamRootNode(GeoUrlPane.this.getParamsName()); + + if (selectTreePath != null) { + mapDataTree.setSelectNodePath(CompatibleGEOJSONHelper.completeJSONName(selectTreePath.getLastPathComponent().toString())); + selectTreePath = mapDataTree.getSelectionPath(); + } + + mapDataTree.updateUI();//因为服务器那边可能随时编辑,所以这边要重画 + mapDataTree.setSelectionPath(selectTreePath); + mapDataTree.scrollPathToVisible(selectTreePath); + } + }; + + public void populate(VanChartMapPlot mapPlot) { + resetComponentValue(mapPlot, false); + String geoUrl = mapPlot.getGeoUrl(); + mapDataTree.setSelectNodePath(geoUrl); + selectTreePath = mapDataTree.getSelectionPath(); + + if (selectTreePath == null) {//此url当前环境没有 + sourceComboBox.setSelectedItem(geoUrl); + } else { + sourceComboBox.setSelectedItem(selectTreePath); + } + boolean enabled = !CompatibleGEOJSONHelper.isDeprecated(mapPlot.getGeoUrl()); + GUICoreUtils.setEnabled(sourceComboBox, enabled); + } + + public String update() { + return mapDataTree.getSelectNodeJSONPath(); + } + + protected void resetComponentValue(VanChartMapPlot mapPlot, boolean samePlotChange) { + MapType mapType = mapPlot.getMapType(); + + //获取最新的参数 + String[] params = getParamsName(); + + if (!ComparatorUtils.equals(oldParams, params)) { + oldParams = params; + GEOJSONTreeHelper.getInstance().updateParamRootNode(params); + } + + mapDataTree.changeRootNode(this.getRootNode()); + if (samePlotChange) { + String nodePath = ChartGEOJSONHelper.getDefaultJSONURL(); + mapPlot.setGeoUrl(nodePath); + mapDataTree.setSelectNodePath(nodePath); + selectTreePath = mapDataTree.getSelectionPath(); + sourceComboBox.setSelectedItem(selectTreePath); + } + switch (mapType) { + case CUSTOM: + sourceTitleLabel.setText(Toolkit.i18nText("Fine-Design_Chart_Map_Area_And_Point")); + break; + case POINT: + sourceTitleLabel.setText(Toolkit.i18nText("Fine-Design_Chart_Map_Point")); + break; + case LINE: + sourceTitleLabel.setText(Toolkit.i18nText("Fine-Design_Chart_Map_Point")); + break; + default: + sourceTitleLabel.setText(Toolkit.i18nText("Fine-Design_Chart_Map_Area")); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java new file mode 100644 index 000000000..406b89610 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java @@ -0,0 +1,303 @@ +package com.fr.van.chart.map.designer.type; + +import com.fr.base.Utils; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.icombobox.UIComboBox; +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.general.ComparatorUtils; +import com.fr.plugin.chart.base.GisLayer; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.server.MapLayerConfigManager; +import com.fr.plugin.chart.type.GISLayerType; +import com.fr.plugin.chart.type.GaoDeGisType; +import com.fr.plugin.chart.type.ZoomLevel; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JPanel; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ItemEvent; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-07 + */ +public class GisLayerPane extends JPanel implements UIObserver { + + private UIButtonGroup gisButton; + private JPanel layerPaneCheckPane; + private UIComboBox gisGaoDeLayer; + private UIComboBox gisLayer; + private JPanel layerCardPane; + + private WMSLayerPane wmsLayerPane; + private TileLayerPane tileLayerPane; + + private UIComboBox zoomLevel; + + private String[] layers = MapLayerConfigManager.getLayerItems(); + + public GisLayerPane() { + initComps(); + } + + private void initComps() { + this.setLayout(new BorderLayout()); + this.add(createGISLayerPane(), BorderLayout.CENTER); + } + + @Override + public void registerChangeListener(UIObserverListener listener) { + this.wmsLayerPane.registerChangeListener(listener); + } + + @Override + public boolean shouldResponseChangeListener() { + return true; + } + + public void registerZoomLevel(UIComboBox zoomLevel) { + this.zoomLevel = zoomLevel; + } + + private boolean isStandardGis() { + return gisButton.getSelectedIndex() == 0; + } + + + private JPanel createGISLayerPane() { + gisButton = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Form_Widget_Style_Standard"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); + gisGaoDeLayer = new UIComboBox(MapLayerConfigManager.getGaoDeLayerItems()); + gisButton.addActionListener(event -> { + refreshZoomLevel(); + checkLayerCardPane(); + }); + + gisGaoDeLayer.addItemListener(event -> refreshZoomLevel()); + + initCustomGISLayerPane(); + initLayerCardPane(); + + layerPaneCheckPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (isStandardGis()) { + return gisGaoDeLayer.getPreferredSize(); + } else { + return gisLayer.getPreferredSize(); + } + } + }; + layerPaneCheckPane.add(gisGaoDeLayer, "standard"); + layerPaneCheckPane.add(gisLayer, "custom"); + + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] row = {p, p, p}; + double[] col = {f, e}; + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Gis_Layer")), gisButton}, + new Component[]{null, layerPaneCheckPane}, + new Component[]{layerCardPane, null}, + }; + + JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); + panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + return panel; + } + + private void initLayerCardPane() { + tileLayerPane = new TileLayerPane(); + wmsLayerPane = new WMSLayerPane(); + + layerCardPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (isStandardGis()) { + return new Dimension(0, 0); + } + String itemName = Utils.objectToString(gisLayer.getSelectedItem()); + if (MapLayerConfigManager.isCustomLayer(itemName)) { + return tileLayerPane.getPreferredSize(); + } else if (MapLayerConfigManager.isCustomWmsLayer(itemName)) { + return wmsLayerPane.getPreferredSize(); + } + return new Dimension(0, 0); + } + }; + + for (String itemName : layers) { + JPanel pane = new JPanel(); + if (MapLayerConfigManager.isCustomLayer(itemName)) { + pane = tileLayerPane; + } else if (MapLayerConfigManager.isCustomWmsLayer(itemName)) { + pane = wmsLayerPane; + } + layerCardPane.add(pane, itemName); + } + } + + private void initCustomGISLayerPane() { + gisLayer = new UIComboBox(layers); + + gisLayer.addItemListener(e -> + { + if (e.getStateChange() == ItemEvent.SELECTED) { + checkCustomLayerCardPane(); + } + refreshZoomLevel(); + } + ); + + gisLayer.addPopupMenuListener(new PopupMenuListener() { + public void popupMenuCanceled(PopupMenuEvent e) { + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + } + + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + + String selected = Utils.objectToString(gisLayer.getSelectedItem()); + ZoomLevel zoomSelected = (ZoomLevel) zoomLevel.getSelectedItem(); + + gisLayer.setModel(new DefaultComboBoxModel(MapLayerConfigManager.getLayerItems())); + + gisLayer.setSelectedItem(selected); + zoomLevel.setSelectedItem(zoomSelected); + } + }); + } + + private void refreshZoomLevel() { + //gis图层不同,对应的缩放等级不同。 + ZoomLevel[] levels; + if (isStandardGis()) { + if (gisGaoDeLayer.getSelectedIndex() == gisGaoDeLayer.getItemCount() - 1) { + levels = MapStatusPane.ZOOM_LEVELS; + } else { + levels = MapStatusPane.GAODE_ZOOM_LEVELS; + } + } else { + if (ComparatorUtils.equals(gisLayer.getSelectedItem(), Toolkit.i18nText("Fine-Design_Chart_Layer_Blue"))) { + levels = MapStatusPane.BLUE_ZOOM_LEVELS; + } else if (ComparatorUtils.equals(gisLayer.getSelectedItem(), Toolkit.i18nText("Fine-Design_Chart_Layer_GaoDe"))) { + levels = MapStatusPane.GAODE_ZOOM_LEVELS; + } else { + levels = MapStatusPane.ZOOM_LEVELS; + } + } + zoomLevel.setModel(new DefaultComboBoxModel(levels)); + } + + + private void checkLayerCardPane() { + CardLayout cardLayout = (CardLayout) layerPaneCheckPane.getLayout(); + cardLayout.show(layerPaneCheckPane, isStandardGis() ? "standard" : "custom"); + } + + private void checkCustomLayerCardPane() { + CardLayout cardLayout = (CardLayout) layerCardPane.getLayout(); + cardLayout.show(layerCardPane, Utils.objectToString(gisLayer.getSelectedItem())); + } + + public void resetGisLayer(VanChartMapPlot mapPlot) { + //TODO Bjorn 地图gis图层自动逻辑 + /* mapPlot.getGisLayer().setGisLayerType(GISLayerType.AUTO); + mapPlot.getGisLayer().setLayerName(GISLayerType.getLocString(GISLayerType.AUTO));*/ + + GaoDeGisType gaoDeGisType= mapPlot.getDefaultGisLayerType(); + + mapPlot.getGisLayer().setGisLayerType(GISLayerType.GAO_DE_API); + mapPlot.getGisLayer().setLayerName(gaoDeGisType.getTypeName()); + mapPlot.getGisLayer().setGaoDeGisType(gaoDeGisType); + populate(mapPlot.getGisLayer()); + } + + public void populate(GisLayer layer) { + switch (layer.getGisLayerType()) { + case GAO_DE_API: + case LAYER_NULL: + populateStandardGis(layer); + break; + default: + populateCustomGis(layer); + } + refreshZoomLevel(); + + checkCustomLayerCardPane(); + checkLayerCardPane(); + } + + private void populateStandardGis(GisLayer layer) { + gisButton.setSelectedIndex(0); + if (layer.getGisLayerType() == GISLayerType.LAYER_NULL) { + gisGaoDeLayer.setSelectedIndex(gisGaoDeLayer.getItemCount() - 1); + } else { + gisGaoDeLayer.setSelectedItem(layer.getGaoDeGisType().getTypeName()); + } + } + + private void populateCustomGis(GisLayer layer) { + gisButton.setSelectedIndex(1); + gisLayer.setSelectedItem(layer.getShowItemName()); + + switch (layer.getGisLayerType()) { + case CUSTOM_WMS_LAYER: + wmsLayerPane.populate(layer); + break; + case CUSTOM_TILE_LAYER: + tileLayerPane.populate(layer); + break; + } + } + + public void update(GisLayer layer) { + if (isStandardGis()) { + updateStandardGis(layer); + } else { + updateCustomGis(layer); + } + } + + private void updateStandardGis(GisLayer layer) { + String layerName = Utils.objectToString(gisGaoDeLayer.getSelectedItem()); + layer.setLayerName(layerName); + if (gisGaoDeLayer.getSelectedIndex() == gisGaoDeLayer.getItemCount() - 1) { + layer.setGisLayerType(MapLayerConfigManager.getGisLayerType(layerName)); + } else { + layer.setGisLayerType(GISLayerType.GAO_DE_API); + layer.setGaoDeGisType(GaoDeGisType.parseByLocaleName(layerName)); + } + } + + private void updateCustomGis(GisLayer layer) { + String layerName = Utils.objectToString(gisLayer.getSelectedItem()); + layer.setLayerName(layerName); + layer.setGisLayerType(MapLayerConfigManager.getGisLayerType(layerName)); + + switch (layer.getGisLayerType()) { + case CUSTOM_WMS_LAYER: + wmsLayerPane.update(layer); + break; + case CUSTOM_TILE_LAYER: + tileLayerPane.update(layer); + break; + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/MapStatusPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/MapStatusPane.java new file mode 100644 index 000000000..668a9b774 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/MapStatusPane.java @@ -0,0 +1,167 @@ +package com.fr.van.chart.map.designer.type; + +import com.fr.design.gui.ibutton.UIButtonGroup; +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.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.plugin.chart.base.ViewCenter; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.type.ZoomLevel; +import com.fr.stable.ArrayUtils; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-07 + */ +public class MapStatusPane extends JPanel { + + public static final ZoomLevel[] ZOOM_LEVELS = new ZoomLevel[]{ + ZoomLevel.AUTO, + ZoomLevel.ZERO, ZoomLevel.ZEROPOINTFIVE, + ZoomLevel.ONE, ZoomLevel.ONEPOINTFIVE, + ZoomLevel.TWO, ZoomLevel.TWOPOINTFIVE, + ZoomLevel.THREE, ZoomLevel.THREEPOINTFIVE, + ZoomLevel.FOUR, ZoomLevel.FOURPOINTFIVE, + ZoomLevel.FIVE, ZoomLevel.FIVEPOINTFIVE, + ZoomLevel.SIX, ZoomLevel.SIXPOINTFIVE, + ZoomLevel.SEVEN, ZoomLevel.SEVENPOINTFIVE, + ZoomLevel.EIGHT, ZoomLevel.EIGHTPOINTFIVE, + ZoomLevel.NINE, ZoomLevel.NINEPOINTFIVE, + ZoomLevel.TEN, ZoomLevel.TENPOINTFIVE, + ZoomLevel.ELEVEN, ZoomLevel.ELEVENTPOINTFIVE, + ZoomLevel.TWELVE, ZoomLevel.TWELVEPOINTFIVE, + ZoomLevel.THIRTEEN, ZoomLevel.THIRTEENPOINTFIVE, + ZoomLevel.FOURTEEN, ZoomLevel.FOURTEENPOINTFIVE, + ZoomLevel.FIFTEEN, ZoomLevel.FIFTEENPOINTFIVE, + ZoomLevel.SIXTEEN, ZoomLevel.SIXTEENPOINTFIVE, + ZoomLevel.SEVENTEEN, ZoomLevel.SEVENTEENPOINTFIVE, + ZoomLevel.EIGHTEEN + }; + //深蓝和高德地图下拉框层级 + public static final ZoomLevel[] BLUE_ZOOM_LEVELS = ArrayUtils.subarray(ZOOM_LEVELS, 0, 34); + public static final ZoomLevel[] GAODE_ZOOM_LEVELS = ArrayUtils.addAll(new ZoomLevel[]{ZoomLevel.AUTO}, (ZoomLevel[]) ArrayUtils.subarray(ZOOM_LEVELS, 7, 38)); + private static final String AUTO_CENTER_STRING = Toolkit.i18nText("Fine-Design_Chart_Automatic"); + private static final String CUSTOM_CENTER_STRING = Toolkit.i18nText("Fine-Design_Chart_Custom"); + + + private JPanel levelAndCenterPane; + private JPanel longAndLatPane; + + private UIComboBox zoomLevel; + private UIButtonGroup viewCenterCom; + private UISpinner longitude; + private UISpinner latitude; + + public MapStatusPane() { + initComps(); + } + + public UIComboBox getZoomLevel() { + return zoomLevel; + } + + private void initComps() { + zoomLevel = new UIComboBox(ZOOM_LEVELS); + viewCenterCom = new UIButtonGroup(new String[]{AUTO_CENTER_STRING, CUSTOM_CENTER_STRING}); + longitude = new UISpinner(-Double.MAX_VALUE, Double.MAX_VALUE, 1, 0.0); + latitude = new UISpinner(-Double.MAX_VALUE, Double.MAX_VALUE, 1, 0.0); + + double p = TableLayout.PREFERRED; + double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double s = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + double[] rowSize = {p, p, p}; + double[] columnSize = {d, e}; + double[] column = {d, s}; + + Component[][] comps = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Zoom_Layer")), zoomLevel}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_View_Center")), viewCenterCom}, + }; + levelAndCenterPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, rowSize, columnSize); + + Component[][] longAndLatComps = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Longitude")), longitude}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Latitude")), latitude} + }; + longAndLatPane = TableLayout4VanChartHelper.createGapTableLayoutPane(longAndLatComps, rowSize, column); + longAndLatPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); + longAndLatPane.setVisible(false); + + this.setLayout(new BorderLayout(0, 6)); + + this.add(levelAndCenterPane, BorderLayout.NORTH); + this.add(longAndLatPane, BorderLayout.CENTER); + + viewCenterCom.addActionListener(event -> + longAndLatPane.setVisible(!isAutoViewCenter())); + } + + @Override + public Dimension getPreferredSize() { + if (longAndLatPane.isVisible()) { + return super.getPreferredSize(); + } else { + return levelAndCenterPane.getPreferredSize(); + } + } + + private boolean isAutoViewCenter() { + return viewCenterCom.getSelectedIndex() == 0; + } + + + public void resetViewCenter(VanChartMapPlot mapPlot) { + mapPlot.setViewCenter(new ViewCenter()); + viewCenterCom.setSelectedIndex(0); + longitude.setValue(0); + latitude.setValue(0); + longAndLatPane.setVisible(false); + } + + public void resetZoomLevel(VanChartMapPlot mapPlot) { + mapPlot.setZoomLevel(ZoomLevel.AUTO); + zoomLevel.setSelectedItem(mapPlot.getZoomLevel()); + } + + public void populate(VanChartMapPlot mapPlot) { + zoomLevel.setSelectedItem(mapPlot.getZoomLevel()); + + ViewCenter viewCenter = mapPlot.getViewCenter(); + if (viewCenter.isAuto()) { + viewCenterCom.setSelectedIndex(0); + longitude.setValue(0); + latitude.setValue(0); + } else { + viewCenterCom.setSelectedIndex(1); + longitude.setValue(viewCenter.getLongitude()); + latitude.setValue(viewCenter.getLatitude()); + } + + longAndLatPane.setVisible(!isAutoViewCenter()); + } + + public void update(VanChartMapPlot mapPlot) { + mapPlot.setZoomLevel((ZoomLevel) zoomLevel.getSelectedItem()); + + ViewCenter viewCenter = mapPlot.getViewCenter(); + if (isAutoViewCenter()) { + viewCenter.setAuto(true); + } else { + viewCenter.setAuto(false); + viewCenter.setLongitude(longitude.getValue()); + viewCenter.setLatitude(latitude.getValue()); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/TileLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/TileLayerPane.java new file mode 100644 index 000000000..4101fbd9d --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/TileLayerPane.java @@ -0,0 +1,51 @@ +package com.fr.van.chart.map.designer.type; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextarea.UITextArea; +import com.fr.design.layout.TableLayout; +import com.fr.plugin.chart.base.GisLayer; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-07 + */ +public class TileLayerPane extends JPanel { + + private UITextArea customTileLayer; + private UITextArea attribution; + + + public TileLayerPane() { + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] COLUMN_SIZE = {TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH - 3}; + + customTileLayer = new UITextArea(); + attribution = new UITextArea(); + Component[][] comps = new Component[][]{ + new Component[]{new UILabel("url"), customTileLayer}, + new Component[]{new UILabel("Attribution"), attribution} + }; + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, rowSize, COLUMN_SIZE); + panel.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); + + this.setLayout(new BorderLayout()); + this.add(panel, BorderLayout.CENTER); + } + + public void populate(GisLayer layer) { + customTileLayer.setText(layer.getCustomTileLayer()); + attribution.setText(layer.getAttribution()); + } + + public void update(GisLayer layer) { + layer.setCustomTileLayer(customTileLayer.getText()); + layer.setAttribution(attribution.getText()); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java index a4356be87..a5e26427b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java @@ -78,7 +78,6 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { boolean enabled = !CompatibleGEOJSONHelper.isDeprecated(plot.getGeoUrl()); GUICoreUtils.setEnabled(this.getTypePane(), enabled); - GUICoreUtils.setEnabled(this.sourceChoosePane.getSourceComboBox(), enabled); checkDemosBackground(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java index bbe9d7dd4..5be437619 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java @@ -1,739 +1,113 @@ package com.fr.van.chart.map.designer.type; -import com.fr.base.Parameter; -import com.fr.base.Utils; -import com.fr.decision.webservice.v10.map.WMSFactory; -import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; -import com.fr.design.constants.LayoutConstants; -import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; -import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIButtonGroup; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.icombobox.FRTreeComboBox; -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.itextarea.UITextArea; -import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.JTemplate; -import com.fr.general.ComparatorUtils; -import com.fr.general.IOUtils; -import com.fr.general.http.HttpClient; -import com.fr.plugin.chart.base.GisLayer; -import com.fr.plugin.chart.base.ViewCenter; import com.fr.plugin.chart.map.VanChartMapPlot; -import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; -import com.fr.plugin.chart.map.layer.WMSLayer; -import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; -import com.fr.plugin.chart.map.server.MapLayerConfigManager; -import com.fr.plugin.chart.type.GISLayerType; -import com.fr.plugin.chart.type.MapType; -import com.fr.plugin.chart.type.ZoomLevel; -import com.fr.stable.ArrayUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.drillmap.designer.data.comp.MapDataTree; -import com.fr.workspace.WorkContext; import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.SwingWorker; -import javax.swing.event.PopupMenuEvent; -import javax.swing.event.PopupMenuListener; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreeNode; -import javax.swing.tree.TreePath; -import java.util.ArrayList; -import java.util.List; import java.awt.BorderLayout; -import java.awt.CardLayout; import java.awt.Component; -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; /** * Created by Mitisky on 16/5/11. * 地图类型选择面板,关于json资源路径/gis图层等设置面板 */ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { - private static final double[] COLUMN_SIZE = {48, TableLayout.FILL, TableLayout.PREFERRED}; - public static final ZoomLevel[] ZOOM_LEVELS = new ZoomLevel[]{ - ZoomLevel.AUTO, - ZoomLevel.ZERO, ZoomLevel.ZEROPOINTFIVE, - ZoomLevel.ONE, ZoomLevel.ONEPOINTFIVE, - ZoomLevel.TWO, ZoomLevel.TWOPOINTFIVE, - ZoomLevel.THREE, ZoomLevel.THREEPOINTFIVE, - ZoomLevel.FOUR, ZoomLevel.FOURPOINTFIVE, - ZoomLevel.FIVE, ZoomLevel.FIVEPOINTFIVE, - ZoomLevel.SIX, ZoomLevel.SIXPOINTFIVE, - ZoomLevel.SEVEN, ZoomLevel.SEVENPOINTFIVE, - ZoomLevel.EIGHT, ZoomLevel.EIGHTPOINTFIVE, - ZoomLevel.NINE, ZoomLevel.NINEPOINTFIVE, - ZoomLevel.TEN, ZoomLevel.TENPOINTFIVE, - ZoomLevel.ELEVEN, ZoomLevel.ELEVENTPOINTFIVE, - ZoomLevel.TWELVE, ZoomLevel.TWELVEPOINTFIVE, - ZoomLevel.THIRTEEN, ZoomLevel.THIRTEENPOINTFIVE, - ZoomLevel.FOURTEEN, ZoomLevel.FOURTEENPOINTFIVE, - ZoomLevel.FIFTEEN, ZoomLevel.FIFTEENPOINTFIVE, - ZoomLevel.SIXTEEN, ZoomLevel.SIXTEENPOINTFIVE, - ZoomLevel.SEVENTEEN, ZoomLevel.SEVENTEENPOINTFIVE, - ZoomLevel.EIGHTEEN - }; - //深蓝和高德地图下拉框层级 - private static final ZoomLevel[] BLUE_ZOOM_LEVELS =(ZoomLevel[]) ArrayUtils.subarray(ZOOM_LEVELS, 0, 34); - private static final ZoomLevel[] GAODE_ZOOM_LEVELS =ArrayUtils.addAll(new ZoomLevel[]{ZoomLevel.AUTO}, (ZoomLevel[])ArrayUtils.subarray(ZOOM_LEVELS, 7, 38)); - private static final String AUTO_CENTER_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"); - private static final String CUSTOM_CENTER_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom"); - private UILabel sourceTitleLabel; - private FRTreeComboBox sourceComboBox; - private MapDataTree mapDataTree; - private TreePath selectTreePath; + private GeoUrlPane geoUrlPane; - private UIComboBox gisLayer; - private JPanel layerCardPane; + private GisLayerPane gisLayerPane; - private UITextArea wmsUrl; - private UIButton connectButton; - private JPanel wmsLayerPane; - - private java.util.List wmsLayerCheckBoxs = new ArrayList(); - - private UITextArea customTileLayer; - private UITextArea attribution; - - private UIComboBox zoomLevel; - private UIButtonGroup viewCenterCom; - private JPanel longAndLatPane; - private UISpinner longitude; - private UISpinner latitude; - - private String[] oldParams; - - private UIObserverListener listener; - private String[] layers = MapLayerConfigManager.getLayerItems(); - /** - * 给组件登记一个观察者监听事件 - * - * @param listener 观察者监听事件 - */ - @Override - public void registerChangeListener(UIObserverListener listener) { - this.listener = listener; - } - - /** - * 组件是否需要响应添加的观察者事件 - * - * @return 如果需要响应观察者事件则返回true,否则返回false - */ - @Override - public boolean shouldResponseChangeListener() { - return true; - } + private MapStatusPane mapStatusPane; public VanChartMapSourceChoosePane() { + initGeoUrlPane(); + initMapStatusPane(); + initGisLayerPane(); + this.setLayout(new BorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10,5,0,0)); + this.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); double p = TableLayout.PREFERRED; double[] columnSize = {230}; - double[] rowSize = {p,p,p,p,p,p,p,p}; + double[] rowSize = {p, p, p, p, p, p, p, p}; JPanel panel = new JPanel(new BorderLayout()); - panel.add(createMapSourcesPane(), BorderLayout.NORTH); - panel.add(createGISLayerPane(), BorderLayout.CENTER); - JPanel BasePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic"), panel); + panel.add(geoUrlPane, BorderLayout.NORTH); + panel.add(gisLayerPane, BorderLayout.CENTER); + JPanel basePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Report_Basic"), panel); + + JPanel mapStatusPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Map_Init_Status"), mapStatusPane); Component[][] comps = new Component[][]{ - new Component[]{BasePane}, - new Component[]{createMapInitStatusPane()} + new Component[]{basePane}, + new Component[]{mapStatusPaneWithTitle} }; - JPanel contentPane = TableLayoutHelper.createTableLayoutPane(comps,rowSize,columnSize); + JPanel contentPane = TableLayoutHelper.createTableLayoutPane(comps, rowSize, columnSize); this.add(contentPane, BorderLayout.CENTER); } - protected boolean supportParam(){ - return true; - } - - protected TreeNode getRootNode() { - return supportParam() ? GEOJSONTreeHelper.getInstance().getRootNodeWithPara() : GEOJSONTreeHelper.getInstance().getRootNodeWithoutPara(); + public void setGeoUrlPane(GeoUrlPane geoUrlPane) { + this.geoUrlPane = geoUrlPane; } - protected UILabel createSourceTitleLabel() { - return new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Area")); - } - - private JPanel createMapSourcesPane() { - mapDataTree = new MapDataTree(this.getRootNode()); - mapDataTree.setEditable(false); - mapDataTree.selectDefaultTreeNode(); - sourceComboBox = new FRTreeComboBox(mapDataTree, mapDataTree.getCellRenderer()){ - //搜索 - protected void dealSamePath(TreePath parent, TreeNode node, UITextField textField){ - String searchText = textField.getText(); - VanChartMapSourceChoosePane.this.mapDataTree.search(searchText); - } - - //选中 tree---combobox - public void setSelectedItem(Object o) { - TreePath oldPath = mapDataTree.getSelectionPath(); - Object oldText = getSelectedItem(); - if(o != null && o instanceof TreePath){ - selectTreePath =(TreePath)o; - this.tree.setSelectionPath(selectTreePath); - this.getModel().setSelectedItem(pathToString(selectTreePath)); - if(ComparatorUtils.equals(oldText, getSelectedItem()) && !ComparatorUtils.equals(oldPath, selectTreePath)) { - //point的江苏省切换到area的江苏省 - listener.doChange(); - } - } else if(o instanceof String){//list里面没有 - selectTreePath = null; - this.tree.setSelectionPath(null); - this.getModel().setSelectedItem(ChartGEOJSONHelper.getPresentNameWithPath((String) o)); - } - } - - @Override - protected String pathToString(TreePath path) { - DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); - //不显示后缀 - return ChartGEOJSONHelper.getPresentNameWithPath(node.toString()); - } - - @Override - protected boolean customSelectable(DefaultMutableTreeNode node){ - return GEOJSONTreeHelper.isSelectableTreeNode(node); - } - }; - sourceComboBox.setEditable(true); - sourceComboBox.setOnlyLeafSelectable(false); - sourceComboBox.addPopupMenuListener(popupMenuListener); - - sourceTitleLabel = createSourceTitleLabel(); - - boolean hasRefreshButton = !WorkContext.getCurrent().isLocal(); - - UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/images/control/refresh.png")); - button.setToolTipText(Toolkit.i18nText("Fine-Design_Chart_Update_Remote_Map_JSON")); - button.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - GEOJSONHelper.reset(); - GEOJSONHelper.getInstance(); - } - }); - - - double p = TableLayout.PREFERRED; - double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] rowSize = {p, p}; - - double[] columnSize = hasRefreshButton ? new double[]{d + 10, e - 20, 20} : new double[]{d, e}; - Component[] comps = hasRefreshButton ? new Component[]{sourceTitleLabel, sourceComboBox, button} : new Component[]{sourceTitleLabel, sourceComboBox}; - double hGap = hasRefreshButton ? 0 : TableLayout4VanChartHelper.COMPONENT_INTERVAL; - Component[][] components = new Component[][]{ - new Component[]{null,null}, - comps, - - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, hGap, LayoutConstants.VGAP_LARGE); - } - - private JPanel createGISLayerPane() { - JPanel panel = new JPanel(new BorderLayout(0, 8)); - - gisLayer = new UIComboBox(layers); - - gisLayer.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - refreshZoomLevel(); - } - }); - - gisLayer.addPopupMenuListener(new PopupMenuListener() { - public void popupMenuCanceled(PopupMenuEvent e) { - } - - public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { - } - - public void popupMenuWillBecomeVisible(PopupMenuEvent e) { - - String selected = Utils.objectToString(gisLayer.getSelectedItem()); - ZoomLevel zoomSelected = (ZoomLevel) zoomLevel.getSelectedItem(); - - gisLayer.setModel(new DefaultComboBoxModel(MapLayerConfigManager.getLayerItems())); - - gisLayer.setSelectedItem(selected); - zoomLevel.setSelectedItem(zoomSelected); - } - }); - - - gisLayer.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - checkLayerCardPane(); - } - } - }); - - final JPanel tileLyaerPane = createCustomTileLayer(); - final JPanel wmsLayerPane = createWMSPanel(); - - layerCardPane = new JPanel(new CardLayout()){ - @Override - public Dimension getPreferredSize() { - String itemName = Utils.objectToString(gisLayer.getSelectedItem()); - if (MapLayerConfigManager.isCustomLayer(itemName)) { - return tileLyaerPane.getPreferredSize(); - } else if (MapLayerConfigManager.isCustomWmsLayer(itemName)) { - return wmsLayerPane.getPreferredSize(); - } - return new Dimension(0,0); - } - }; - - for(String itemName : layers){ - JPanel pane = new JPanel(); - if (MapLayerConfigManager.isCustomLayer(itemName)) { - pane = tileLyaerPane; - } else if (MapLayerConfigManager.isCustomWmsLayer(itemName)) { - pane = wmsLayerPane; - } - - layerCardPane.add(pane, itemName); - } - - JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gis_Layer"), gisLayer); - - panel.add(panel1, BorderLayout.CENTER); - panel.add(layerCardPane, BorderLayout.SOUTH); - - return panel; - } - - private void refreshZoomLevel(){ - //gis图层不同,对应的缩放等级不同。 - ZoomLevel[] levels; - if (ComparatorUtils.equals(gisLayer.getSelectedItem(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layer_Blue"))) { - levels = BLUE_ZOOM_LEVELS; - } else if (ComparatorUtils.equals(gisLayer.getSelectedItem(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layer_GaoDe"))) { - levels = GAODE_ZOOM_LEVELS; - } else { - levels = ZOOM_LEVELS; - } - zoomLevel.setModel(new DefaultComboBoxModel(levels)); - } - - - private JPanel createCustomTileLayer() { - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] COLUMN_SIZE = {TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH-3}; - - customTileLayer = new UITextArea(); - attribution = new UITextArea(); - Component[][] comps = new Component[][]{ - new Component[]{new UILabel("url"), customTileLayer}, - new Component[]{new UILabel("Attribution"), attribution} - }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, rowSize, COLUMN_SIZE); - panel.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); - return panel; - } - - private JPanel createWMSPanel() { - - final double p = TableLayout.PREFERRED; - double[] rowSize = {p}; - double[] COLUMN_SIZE = {TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH, 84,44}; - - - wmsUrl = new UITextArea(); - connectButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Connect_WMP")); - - Component[][] comps = new Component[][]{ - new Component[]{new UILabel("url"), wmsUrl, connectButton} - }; - JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, rowSize, COLUMN_SIZE); - northPane.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); - JPanel wmsPanel = new JPanel(new BorderLayout(0, 4)); - wmsLayerPane = new JPanel(new BorderLayout()); - resetWMSLayerPane(new ArrayList()); - wmsPanel.add(northPane, BorderLayout.NORTH); - wmsPanel.add(wmsLayerPane, BorderLayout.CENTER); - - connectButton.addActionListener(actionListener); - - addMouseListener(); - - return wmsPanel; - } - - ActionListener actionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - - new SwingWorker() { - private java.util.List list = new ArrayList<>(); - - @Override - protected Void doInBackground() throws Exception { - HttpClient httpClient = new HttpClient(wmsUrl.getText() + "service=WMS&request=GetCapabilities"); - httpClient.asGet(); - - if (!httpClient.isServerAlive()) { - return null; - } - - String res = httpClient.getResponseText(); - List layers = WMSFactory.readLayers(res); - list.clear(); - for (String layer : layers) { - list.add(new WMSLayer(layer, false)); - } - return null; - } - - @Override - protected void done() { - connectButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Connect_WMP")); - if(list != null && list.size() > 0) { - resetWMSLayerPane(list); - } else { - FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Invalid_WMS")); - } - } - }.execute(); - } - }; - - private void addMouseListener() { - connectButton.addMouseListener(new MouseListener() { - @Override - public void mouseClicked(MouseEvent e) { - - } - - @Override - public void mousePressed(MouseEvent e) { - connectButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Connecting_WMP")); - } - - @Override - public void mouseReleased(MouseEvent e) { - - } - - @Override - public void mouseEntered(MouseEvent e) { - - } - - @Override - public void mouseExited(MouseEvent e) { - - } - }); + @Override + public void registerChangeListener(UIObserverListener listener) { + geoUrlPane.registerChangeListener(listener); + gisLayerPane.registerChangeListener(listener); } - private void resetWMSLayerPane(java.util.List wmsLayers) { - - int size = wmsLayers.size(); - double[] rowSize = new double[size]; - Component[][] comps = new Component[size][2]; - wmsLayerCheckBoxs.clear(); - wmsLayerPane.removeAll(); - for(int i =0; i < size; i++){ - rowSize[i] = TableLayout.PREFERRED; - comps[i][0] = i == 0 ? new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_WMS_Layers"), SwingConstants.RIGHT) : null; - WMSLayer layer = wmsLayers.get(i); - UICheckBox checkBox = new UICheckBox(layer.getLayer()); - checkBox.registerChangeListener(listener); - checkBox.setToolTipText(layer.getLayer()); - checkBox.setSelected(layer.isSelected()); - comps[i][1] = checkBox; - wmsLayerCheckBoxs.add(checkBox); - } - - wmsLayerPane.add(TableLayoutHelper.createCommonTableLayoutPane(comps,rowSize, COLUMN_SIZE,0), BorderLayout.CENTER); - - VanChartMapSourceChoosePane.this.updateUI(); + @Override + public boolean shouldResponseChangeListener() { + return true; } - private JPanel createMapInitStatusPane() { - zoomLevel = new UIComboBox(ZOOM_LEVELS); - viewCenterCom = new UIButtonGroup(new String[]{AUTO_CENTER_STRING, CUSTOM_CENTER_STRING}); - longitude = new UISpinner(-Double.MAX_VALUE,Double.MAX_VALUE,1,0.0); - latitude = new UISpinner(-Double.MAX_VALUE,Double.MAX_VALUE,1,0.0); - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double s = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; - double[] rowSize = {p,p,p}; - double[] columnSize = {d, e}; - double[] column = {d, s}; - - Component[][] comps = new Component[][]{ - new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Layer")), zoomLevel}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_View_Center")), viewCenterCom}, - }; - final JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps,rowSize,columnSize); - - Component[][] longAndLatComps = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude")), longitude}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude")), latitude} - }; - longAndLatPane =TableLayout4VanChartHelper.createGapTableLayoutPane(longAndLatComps,rowSize,column); - longAndLatPane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); - longAndLatPane.setVisible(false); - - JPanel contentPane = new JPanel(new BorderLayout(0, 6)){ - - @Override - public Dimension getPreferredSize() { - if(longAndLatPane.isVisible()) { - return super.getPreferredSize(); - } else { - return northPane.getPreferredSize(); - } - } - }; - contentPane.add(northPane, BorderLayout.NORTH); - contentPane.add(longAndLatPane, BorderLayout.CENTER); - - viewCenterCom.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - longAndLatPane.setVisible(!isAutoViewCenter()); - } - }); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Init_Status"), contentPane); + protected void initGeoUrlPane() { + geoUrlPane = new GeoUrlPane(); } - private boolean isAutoViewCenter() { - return viewCenterCom.getSelectedIndex()==0; + private void initGisLayerPane() { + gisLayerPane = new GisLayerPane(); + gisLayerPane.registerZoomLevel(mapStatusPane.getZoomLevel()); } - private PopupMenuListener popupMenuListener = new PopupMenuListener() { - public void popupMenuCanceled(PopupMenuEvent e) { - } - - public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { - } - - public void popupMenuWillBecomeVisible(PopupMenuEvent e) { - - GEOJSONTreeHelper.reset(); - mapDataTree.changeRootNode(VanChartMapSourceChoosePane.this.getRootNode()); - GEOJSONTreeHelper.getInstance().updateParamRootNode(VanChartMapSourceChoosePane.this.getParams()); - - if(selectTreePath != null){ - mapDataTree.setSelectNodePath(CompatibleGEOJSONHelper.completeJSONName(selectTreePath.getLastPathComponent().toString())); - selectTreePath = mapDataTree.getSelectionPath(); - } - - mapDataTree.updateUI();//因为服务器那边可能随时编辑,所以这边要重画 - mapDataTree.setSelectionPath(selectTreePath); - mapDataTree.scrollPathToVisible(selectTreePath); - } - }; - - private void checkLayerCardPane() { - CardLayout cardLayout = (CardLayout) layerCardPane.getLayout(); - cardLayout.show(layerCardPane, Utils.objectToString(gisLayer.getSelectedItem())); + private void initMapStatusPane() { + mapStatusPane = new MapStatusPane(); } public void resetComponentValue(VanChartMapPlot mapPlot) { - resetComponentValue(mapPlot, true); + geoUrlPane.resetComponentValue(mapPlot, true); //重置图层属性 - resetGisLayer(mapPlot); + gisLayerPane.resetGisLayer(mapPlot); //重置缩放等级 - resetZoomLevel(mapPlot); + mapStatusPane.resetZoomLevel(mapPlot); //重置中心点位置 - resetViewCenter(mapPlot); + mapStatusPane.resetViewCenter(mapPlot); } - protected void resetComponentValue(VanChartMapPlot mapPlot, boolean samePlotChange) { - MapType mapType = mapPlot.getMapType(); - - //获取最新的参数 - String[] params = getParams(); - - if (!ComparatorUtils.equals(oldParams, params)){ - oldParams = params; - GEOJSONTreeHelper.getInstance().updateParamRootNode(params); - } - - mapDataTree.changeRootNode(this.getRootNode()); - if(samePlotChange) { - String nodePath = ChartGEOJSONHelper.getDefaultJSONURL(); - mapPlot.setGeoUrl(nodePath); - mapDataTree.setSelectNodePath(nodePath); - selectTreePath = mapDataTree.getSelectionPath(); - sourceComboBox.setSelectedItem(selectTreePath); - } - switch (mapType){ - case CUSTOM: - sourceTitleLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Area_And_Point")); - break; - case POINT: - sourceTitleLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Point")); - break; - case LINE: - sourceTitleLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Point")); - break; - default: - sourceTitleLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Area")); - } - - } - - private String[] getParams() { - JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jTemplate == null){ - return new String[0]; - } - - return getParamsName((jTemplate.getJTemplateParameters())); - } - - private String[] getParamsName(Parameter[] parameters) { - String[] names = new String[parameters.length]; - for (int i = 0; i < parameters.length; i++){ - names[i] = parameters[i].getName(); - } - return names; - } - - private void resetViewCenter(VanChartMapPlot mapPlot) { - mapPlot.setViewCenter(new ViewCenter()); - viewCenterCom.setSelectedIndex(0); - longitude.setValue(0); - latitude.setValue(0); - longAndLatPane.setVisible(false); - } - - private void resetZoomLevel(VanChartMapPlot mapPlot) { - mapPlot.setZoomLevel(ZoomLevel.AUTO); - zoomLevel.setSelectedItem(mapPlot.getZoomLevel()); - } - - private void resetGisLayer(VanChartMapPlot mapPlot) { - //TODO Bjorn 地图gis图层自动逻辑 - /* mapPlot.getGisLayer().setGisLayerType(GISLayerType.AUTO); - mapPlot.getGisLayer().setLayerName(GISLayerType.getLocString(GISLayerType.AUTO));*/ - - String layerName = mapPlot.getDefaultGisLayerName(); - - mapPlot.getGisLayer().setGisLayerType(GISLayerType.PREDEFINED_LAYER); - mapPlot.getGisLayer().setLayerName(layerName); - gisLayer.setSelectedItem(mapPlot.getGisLayer().getShowItemName()); - } public void populateBean(VanChartMapPlot mapPlot) { - resetComponentValue(mapPlot, false); - - mapDataTree.setSelectNodePath(mapPlot.getGeoUrl()); - selectTreePath = mapDataTree.getSelectionPath(); - - if(selectTreePath == null){//此url当前环境没有 - sourceComboBox.setSelectedItem(mapPlot.getGeoUrl()); - } else { - sourceComboBox.setSelectedItem(selectTreePath); - } - - GisLayer layer = mapPlot.getGisLayer(); - gisLayer.setSelectedItem(layer.getShowItemName()); - - wmsUrl.setText(layer.getWmsUrl()); - resetWMSLayerPane(layer.getWmsLayers()); - customTileLayer.setText(layer.getCustomTileLayer()); - attribution.setText(layer.getAttribution()); - - refreshZoomLevel(); - zoomLevel.setSelectedItem(mapPlot.getZoomLevel()); - - ViewCenter viewCenter = mapPlot.getViewCenter(); - if(viewCenter.isAuto()){ - viewCenterCom.setSelectedIndex(0); - longitude.setValue(0); - latitude.setValue(0); - } else { - viewCenterCom.setSelectedIndex(1); - longitude.setValue(viewCenter.getLongitude()); - latitude.setValue(viewCenter.getLatitude()); - } - - longAndLatPane.setVisible(!isAutoViewCenter()); - - checkLayerCardPane(); + geoUrlPane.populate(mapPlot); + gisLayerPane.populate(mapPlot.getGisLayer()); + mapStatusPane.populate(mapPlot); } public void updateBean(VanChartMapPlot mapPlot) { - if(!CompatibleGEOJSONHelper.isDeprecated(mapPlot.getGeoUrl())){ - mapPlot.setGeoUrl(mapDataTree.getSelectNodeJSONPath()); - } - - GisLayer layer = mapPlot.getGisLayer(); - String layerName = Utils.objectToString(gisLayer.getSelectedItem()); - - layer.setLayerName(layerName); - layer.setGisLayerType(MapLayerConfigManager.getGisLayerType(layerName)); - - switch (layer.getGisLayerType()){ - case CUSTOM_WMS_LAYER: - layer.setWmsUrl(wmsUrl.getText()); - layer.setWmsLayers(new ArrayList()); - for(UICheckBox checkBox : wmsLayerCheckBoxs){ - layer.addWmsLayer(new WMSLayer(checkBox.getText(), checkBox.isSelected())); - } - break; - case CUSTOM_TILE_LAYER: - layer.setCustomTileLayer(customTileLayer.getText()); - layer.setAttribution(attribution.getText()); - break; + if (!CompatibleGEOJSONHelper.isDeprecated(mapPlot.getGeoUrl())) { + mapPlot.setGeoUrl(geoUrlPane.update()); } - mapPlot.setZoomLevel((ZoomLevel) zoomLevel.getSelectedItem()); - - ViewCenter viewCenter = mapPlot.getViewCenter(); - if(isAutoViewCenter()){ - viewCenter.setAuto(true); - } else { - viewCenter.setAuto(false); - viewCenter.setLongitude(longitude.getValue()); - viewCenter.setLatitude(latitude.getValue()); - } - } - - public UIComboBox getSourceComboBox(){ - return this.sourceComboBox; + gisLayerPane.update(mapPlot.getGisLayer()); + mapStatusPane.update(mapPlot); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java new file mode 100644 index 000000000..19afd688f --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java @@ -0,0 +1,165 @@ +package com.fr.van.chart.map.designer.type; + +import com.fr.decision.webservice.v10.map.WMSFactory; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextarea.UITextArea; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.http.HttpClient; +import com.fr.plugin.chart.base.GisLayer; +import com.fr.plugin.chart.map.layer.WMSLayer; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.SwingWorker; +import java.util.ArrayList; +import java.util.List; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-07 + */ +public class WMSLayerPane extends JPanel implements UIObserver { + private static final double[] COLUMN_SIZE = {48, TableLayout.FILL, TableLayout.PREFERRED}; + + private UITextArea wmsUrl; + private UIButton connectButton; + private JPanel wmsLayerPane; + + private List wmsLayerCheckBoxs = new ArrayList<>(); + + private UIObserverListener listener; + + @Override + public void registerChangeListener(UIObserverListener listener) { + this.listener = listener; + } + + @Override + public boolean shouldResponseChangeListener() { + return true; + } + + + public WMSLayerPane() { + final double p = TableLayout.PREFERRED; + double[] rowSize = {p}; + double[] COLUMN_SIZE = {TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH, 84, 44}; + + + wmsUrl = new UITextArea(); + connectButton = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Connect_WMP")); + + Component[][] comps = new Component[][]{ + new Component[]{new UILabel("url"), wmsUrl, connectButton} + }; + JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, rowSize, COLUMN_SIZE); + northPane.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); + + wmsLayerPane = new JPanel(new BorderLayout()); + resetWMSLayerPane(new ArrayList<>()); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + this.add(wmsLayerPane, BorderLayout.CENTER); + addListener(); + } + + private void addListener() { + connectButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + + new SwingWorker() { + private java.util.List list = new ArrayList<>(); + + @Override + protected Void doInBackground() { + HttpClient httpClient = new HttpClient(wmsUrl.getText() + "service=WMS&request=GetCapabilities"); + httpClient.asGet(); + + if (!httpClient.isServerAlive()) { + return null; + } + + String res = httpClient.getResponseText(); + List layers = WMSFactory.readLayers(res); + list.clear(); + for (String layer : layers) { + list.add(new WMSLayer(layer, false)); + } + return null; + } + + @Override + protected void done() { + connectButton.setText(Toolkit.i18nText("Fine-Design_Chart_Connect_WMP")); + if (list != null && list.size() > 0) { + resetWMSLayerPane(list); + } else { + FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Chart_Invalid_WMS")); + } + } + }.execute(); + } + }); + + connectButton.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + connectButton.setText(Toolkit.i18nText("Fine-Design_Chart_Connecting_WMP")); + } + }); + } + + private void resetWMSLayerPane(java.util.List wmsLayers) { + int size = wmsLayers.size(); + double[] rowSize = new double[size]; + Component[][] comps = new Component[size][2]; + wmsLayerCheckBoxs.clear(); + wmsLayerPane.removeAll(); + for (int i = 0; i < size; i++) { + rowSize[i] = TableLayout.PREFERRED; + comps[i][0] = i == 0 ? new UILabel(Toolkit.i18nText("Fine-Design_Chart_WMS_Layers"), SwingConstants.RIGHT) : null; + WMSLayer layer = wmsLayers.get(i); + UICheckBox checkBox = new UICheckBox(layer.getLayer()); + checkBox.registerChangeListener(listener); + checkBox.setToolTipText(layer.getLayer()); + checkBox.setSelected(layer.isSelected()); + comps[i][1] = checkBox; + wmsLayerCheckBoxs.add(checkBox); + } + + wmsLayerPane.add(TableLayoutHelper.createCommonTableLayoutPane(comps, rowSize, COLUMN_SIZE, 0), BorderLayout.CENTER); + + updateUI(); + } + + public void populate(GisLayer layer) { + wmsUrl.setText(layer.getWmsUrl()); + resetWMSLayerPane(layer.getWmsLayers()); + } + + public void update(GisLayer layer) { + layer.setWmsUrl(wmsUrl.getText()); + layer.setWmsLayers(new ArrayList<>()); + for (UICheckBox checkBox : wmsLayerCheckBoxs) { + layer.addWmsLayer(new WMSLayer(checkBox.getText(), checkBox.isSelected())); + } + } +} + From 2850c9e04b75b9d5cea5e403e1a7366eb03309e5 Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 16 Dec 2020 17:51:56 +0800 Subject: [PATCH 010/147] =?UTF-8?q?CHART-17231=20=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=B8=8D=E9=80=89=E4=B8=AD=E4=BB=BB=E4=BD=95=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/extended/chart/UIComboBoxWithNone.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java b/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java index 65e7bbb43..9c6636fd7 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java @@ -23,7 +23,11 @@ public class UIComboBoxWithNone extends UIComboBox { } protected void setDefaultSelectedItem() { - setSelectedItem(StringUtils.EMPTY); + // JComboBox.setSelectedItem(o) + // if(o!=null)寻找o对应的下拉选项 如果找不到 还是选中之前选中的 + // 所以空字符串 不是选中空 是选中上次选中的 + // 所以这边 可以写setSelectedItem(null) or setSelectedIndex(-1) + setSelectedIndex(-1); } @Override From 7624c346fe0b3b2620d632cba458196a20ed7c69 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 17 Dec 2020 10:51:06 +0800 Subject: [PATCH 011/147] =?UTF-8?q?REPORT-45441=20=E8=81=9A=E5=90=88?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8-=E8=AE=BE=E8=AE=A1-=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=9D=97-=E5=90=8D=E7=A7=B0=E5=8A=9F=E8=83=BD=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 3 +- .../widget/WidgetBoundsPaneFactory.java | 39 +++++++++++++++++-- .../component/WidgetAbsoluteBoundPane.java | 2 +- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index a95b92400..5ad434807 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -105,7 +105,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { FORM_REPORT, // 表单报表块 POLY, // 聚合报表 POLY_REPORT, // 聚合报表-报表块 - POLY_CHART, // 聚合报表-图表块 + POLY_CHART(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 聚合报表-图表块 AUTHORITY_EDITION, // 权限编辑 AUTHORITY_EDITION_DISABLED; // 权限编辑 @@ -416,6 +416,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void updatePropertyItemMap() { for (PropertyItem item : propertyItemMap.values()) { item.updateStatus(); + //增加这个函数来修改名称,保证cpt的名称变为控件设置,frm还是组件设置 item.updateTitle(); } } 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 9b2b64d09..472b33c0f 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 @@ -19,6 +19,35 @@ import java.awt.Component; * Created by plough on 2017/8/7. */ public class WidgetBoundsPaneFactory { + + public enum NameAttribute { + //默认的名称 + DEFAULT(), + //控件对应的名称 + WIDGET(Toolkit.i18nText("Fine-Design_Basic_Widget_Position"),Toolkit.i18nText("Fine-Design_Basic_Widget_Size")); + + private String positionName; + private String sizeName; + + NameAttribute() { + this.positionName = Toolkit.i18nText("Fine-Design_Basic_Component_Position"); + this.sizeName = Toolkit.i18nText("Fine-Design_Basic_Component_Size"); + } + + NameAttribute(String positionName,String sizeName) { + this.positionName = positionName; + this.sizeName = sizeName; + } + + public String getPositionName() { + return positionName; + } + + public String getSizeName() { + return sizeName; + } + } + private static final int RIGHT_PANE_WIDTH = 145; public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { @@ -49,16 +78,16 @@ 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) { + public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height,NameAttribute nameAttribute) { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] northComponents = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Position")), createRightPane(x, y)}, + 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))}, }; Component[][] centerComponents = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Size")), createRightPane(width, height)}, + 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))}, }; double[] rowSize = {p, p}; @@ -74,6 +103,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) { + return createAbsoluteBoundsPane( x, y, width, height,NameAttribute.DEFAULT); + } + public static UIExpandablePane createCardTagBoundPane(UISpinner width) { JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); 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 7ddff022f..5604ef4be 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 @@ -34,7 +34,7 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane { 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")); - this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height)); + this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height, WidgetBoundsPaneFactory.NameAttribute.WIDGET)); } @Override From df2002c40a7183913c69d2e4bbdf32ad5cad160c Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 17 Dec 2020 11:12:34 +0800 Subject: [PATCH 012/147] =?UTF-8?q?REPORT-45441=20=E8=81=9A=E5=90=88?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8-=E8=AE=BE=E8=AE=A1-=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=9D=97-=E5=90=8D=E7=A7=B0=E5=8A=9F=E8=83=BD=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/EastRegionContainerPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 5ad434807..4c908940a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -416,7 +416,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void updatePropertyItemMap() { for (PropertyItem item : propertyItemMap.values()) { item.updateStatus(); - //增加这个函数来修改名称,保证cpt的名称变为控件设置,frm还是组件设置 item.updateTitle(); } } From ad8b0577f478b100d55323723ed7fbe4af98176e Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 17 Dec 2020 11:21:55 +0800 Subject: [PATCH 013/147] =?UTF-8?q?REPORT-45441=20=E8=81=9A=E5=90=88?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8-=E8=AE=BE=E8=AE=A1-=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=9D=97-=E5=90=8D=E7=A7=B0=E5=8A=9F=E8=83=BD=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/WidgetBoundsPaneFactory.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) 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 472b33c0f..d91f89b89 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 @@ -22,19 +22,14 @@ public class WidgetBoundsPaneFactory { public enum NameAttribute { //默认的名称 - DEFAULT(), + DEFAULT(Toolkit.i18nText("Fine-Design_Basic_Component_Position"), Toolkit.i18nText("Fine-Design_Basic_Component_Size")), //控件对应的名称 - WIDGET(Toolkit.i18nText("Fine-Design_Basic_Widget_Position"),Toolkit.i18nText("Fine-Design_Basic_Widget_Size")); + WIDGET(Toolkit.i18nText("Fine-Design_Basic_Widget_Position"), Toolkit.i18nText("Fine-Design_Basic_Widget_Size")); private String positionName; private String sizeName; - - NameAttribute() { - this.positionName = Toolkit.i18nText("Fine-Design_Basic_Component_Position"); - this.sizeName = Toolkit.i18nText("Fine-Design_Basic_Component_Size"); - } - - NameAttribute(String positionName,String sizeName) { + + NameAttribute(String positionName, String sizeName) { this.positionName = positionName; this.sizeName = sizeName; } @@ -66,7 +61,8 @@ public class WidgetBoundsPaneFactory { boundsPane.add(panel); return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); } - public static JPanel createRightPane(Component com1, Component com2){ + + public static JPanel createRightPane(Component com1, Component com2) { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p}; @@ -78,7 +74,7 @@ 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 UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height, NameAttribute nameAttribute) { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; @@ -104,7 +100,7 @@ public class WidgetBoundsPaneFactory { } public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) { - return createAbsoluteBoundsPane( x, y, width, height,NameAttribute.DEFAULT); + return createAbsoluteBoundsPane(x, y, width, height, NameAttribute.DEFAULT); } From 95221b9e7cf6b59f584c4d60adb79a72e32c0102 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 17 Dec 2020 20:48:44 +0800 Subject: [PATCH 014/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.1?= =?UTF-8?q?=20=E5=B0=86=E8=BD=AC=E5=8C=96SVG=E5=9B=BE=E6=A0=87=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=85=88=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/base/svg/SVGIcon.java | 59 ++++++ .../main/java/com/fr/base/svg/SVGLoader.java | 74 ++++++++ .../java/com/fr/base/svg/SVGTranscoder.java | 170 ++++++++++++++++++ .../com/fr/base/svg/SystemScaleUtils.java | 96 ++++++++++ 4 files changed, 399 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/base/svg/SVGIcon.java create mode 100644 designer-base/src/main/java/com/fr/base/svg/SVGLoader.java create mode 100644 designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java create mode 100644 designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java new file mode 100644 index 000000000..e5300a821 --- /dev/null +++ b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java @@ -0,0 +1,59 @@ +package com.fr.base.svg; + +import javax.swing.Icon; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; + +/** + * SVG转化而来的Icon + * @author Yvan + * @version 10.0 + * Created by Yvan on 2020/12/17 + */ +public class SVGIcon implements Icon { + + private BufferedImage image; + + private static final boolean HI_DPI_SURPORT = SystemScaleUtils.isJreHiDPIEnabled(); + + public static final float SYSTEM_SCALE = SystemScaleUtils.sysScale(); + + public SVGIcon(BufferedImage image) { + this.image = image; + } + + @Override + public void paintIcon(Component c, Graphics g, int x, int y) { + if (HI_DPI_SURPORT) { + Graphics2D graphics = (Graphics2D) g.create(x, y, image.getWidth(null), image.getHeight(null)); + float scale = SYSTEM_SCALE; + graphics.scale(1 / scale, 1 / scale); + graphics.drawImage(image, 0, 0, null); + graphics.scale(1.0D, 1.0D); + graphics.dispose(); + } else { + g.drawImage(image, x, y, null); + } + } + + @Override + public int getIconWidth() { + return HI_DPI_SURPORT ? (int) (image.getWidth() / SYSTEM_SCALE) : image.getWidth(); + } + + @Override + public int getIconHeight() { + return HI_DPI_SURPORT ? (int) (image.getHeight() / SYSTEM_SCALE) : image.getHeight(); + } + + /** + * 外界读取高清图标 + * @param url + * @return + */ + public static Icon readSVGIcon(String url) { + return new SVGIcon((BufferedImage) SVGLoader.load(url)); + } +} diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java b/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java new file mode 100644 index 000000000..1649454a1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java @@ -0,0 +1,74 @@ +package com.fr.base.svg; + +import com.fr.general.IOUtils; +import org.apache.batik.transcoder.TranscoderException; +import org.apache.batik.transcoder.TranscoderInput; +import org.apache.xmlgraphics.java2d.Dimension2DDouble; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.awt.Image; +import java.io.IOException; +import java.net.URL; + +/** + * SVG图标加载器 + * @author Yvan + * @version 10.0 + * Created by Yvan on 2020/12/17 + */ +public class SVGLoader { + public static final int ICON_DEFAULT_SIZE = 16; + + public SVGLoader() { + } + + @Nullable + public static Image load(@NotNull String url) { + try { + return load(IOUtils.getResource(url, SVGLoader.class), SVGIcon.SYSTEM_SCALE); + } catch (IOException ignore) { + return null; + } + } + + @Nullable + public static Image load(@NotNull URL url) throws IOException { + return load(url, SVGIcon.SYSTEM_SCALE); + } + + @Nullable + public static Image load(@NotNull URL url, double scale) throws IOException { + try { + String svgUri = url.toString(); + TranscoderInput input = new TranscoderInput(svgUri); + return SVGTranscoder.createImage(scale, input).getImage(); + } catch (TranscoderException e) { + throw new IOException(e); + } + } + + @Nullable + public static Image load(@NotNull URL url, double scale, Dimension2DDouble dimension) throws IOException { + try { + String svgUri = url.toString(); + TranscoderInput input = new TranscoderInput(svgUri); + return SVGTranscoder.createImage(scale, input, + (float) (dimension.getWidth() * scale), (float) (dimension.getHeight() * scale)).getImage(); + } catch (TranscoderException e) { + throw new IOException(e); + } + } + + + @Nullable + public static Image load(@NotNull URL url, double scale, double width, double height) throws IOException { + try { + String svgUri = url.toString(); + TranscoderInput input = new TranscoderInput(svgUri); + return SVGTranscoder.createImage(scale, input, (float) (width * scale), (float) (height * scale)).getImage(); + } catch (TranscoderException e) { + throw new IOException(e); + } + } +} diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java b/designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java new file mode 100644 index 000000000..2f547fe07 --- /dev/null +++ b/designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java @@ -0,0 +1,170 @@ +package com.fr.base.svg; + +import com.fr.stable.AssistUtils; +import com.fr.value.AtomicNotNullLazyValue; +import org.apache.batik.anim.dom.SAXSVGDocumentFactory; +import org.apache.batik.anim.dom.SVGOMDocument; +import org.apache.batik.bridge.BridgeContext; +import org.apache.batik.bridge.UserAgent; +import org.apache.batik.transcoder.SVGAbstractTranscoder; +import org.apache.batik.transcoder.TranscoderException; +import org.apache.batik.transcoder.TranscoderInput; +import org.apache.batik.transcoder.TranscoderOutput; +import org.apache.batik.transcoder.image.ImageTranscoder; +import org.apache.batik.util.XMLResourceDescriptor; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.w3c.dom.Element; +import org.w3c.dom.svg.SVGDocument; + +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Rectangle; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.StringReader; + +/** + * 可以根据某个缩放倍数scale,将SVG图片转化为Image对象 + * @author Yvan + * @version 10.0 + * Created by Yvan on 2020/12/17 + */ +public class SVGTranscoder extends ImageTranscoder { + + private static final float DEFAULT_VALUE = -1.0F; + public static final float ICON_DEFAULT_SIZE = 16F; + private float origDocWidth; + private float origDocHeight; + @Nullable + private BufferedImage image; + private final double scale; + + @NotNull + private static AtomicNotNullLazyValue iconMaxSize = new AtomicNotNullLazyValue() { + @NotNull + @Override + protected Double compute() { + double maxSize = Double.MAX_VALUE; + if (!GraphicsEnvironment.isHeadless()) { + GraphicsDevice defaultScreenDevice = GraphicsEnvironment + .getLocalGraphicsEnvironment() + .getDefaultScreenDevice(); + Rectangle bounds = defaultScreenDevice.getDefaultConfiguration().getBounds(); + AffineTransform tx = defaultScreenDevice + .getDefaultConfiguration() + .getDefaultTransform(); + maxSize = Math.max(bounds.width * tx.getScaleX(), bounds.height * tx.getScaleY()); + } + return maxSize; + } + }; + + public SVGTranscoder(double scale) { + this.scale = scale; + this.width = ICON_DEFAULT_SIZE; + this.height = ICON_DEFAULT_SIZE; + } + + public final float getOrigDocWidth() { + return this.origDocWidth; + } + + public final void setOrigDocWidth(float origDocWidth) { + this.origDocWidth = origDocWidth; + } + + public final float getOrigDocHeight() { + return this.origDocHeight; + } + + public final void setOrigDocHeight(float origDocHeight) { + this.origDocHeight = origDocHeight; + } + + public static double getIconMaxSize() { + return iconMaxSize.getValue(); + } + + @Nullable + public final BufferedImage getImage() { + return this.image; + } + + @NotNull + public static SVGTranscoder createImage(double scale, @NotNull TranscoderInput input) throws TranscoderException { + return createImage(scale, input, -1, -1); + } + + @NotNull + public static SVGTranscoder createImage(double scale, @NotNull TranscoderInput input, float overriddenWidth, float overriddenHeight) throws TranscoderException { + SVGTranscoder transcoder = new SVGTranscoder(scale); + if (!AssistUtils.equals(overriddenWidth, DEFAULT_VALUE)) { + transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, overriddenWidth); + } + + if (!AssistUtils.equals(overriddenHeight, DEFAULT_VALUE)) { + transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_HEIGHT, overriddenHeight); + } + + double iconMaxSize = SVGTranscoder.iconMaxSize.getValue(); + transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_MAX_WIDTH, (float) iconMaxSize); + transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_MAX_HEIGHT, (float) iconMaxSize); + transcoder.transcode(input, null); + return transcoder; + } + + private static SVGDocument createFallbackPlaceholder() { + try { + String fallbackIcon = "\n" + + " \n" + + " \n" + + " \n" + + "\n"; + + SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(XMLResourceDescriptor.getXMLParserClassName()); + return (SVGDocument) factory.createDocument(null, new StringReader(fallbackIcon)); + } catch (IOException e) { + throw new IllegalStateException(e); + } + } + + @Override + protected void setImageSize(float docWidth, float docHeight) { + super.setImageSize((float) (docWidth * this.scale), (float) (docHeight * this.scale)); + this.origDocWidth = docWidth; + this.origDocHeight = docHeight; + } + + @Override + @NotNull + public BufferedImage createImage(int width, int height) { + return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); + } + + @Override + public void writeImage(@NotNull BufferedImage image, @Nullable TranscoderOutput output) { + this.image = image; + } + + @Override + @NotNull + protected UserAgent createUserAgent() { + return new SVGAbstractTranscoderUserAgent() { + @Override + @NotNull + public SVGDocument getBrokenLinkDocument(@NotNull Element e, @NotNull String url, @NotNull String message) { + return createFallbackPlaceholder(); + } + }; + } + + /** + * 开放访问权限 + */ + @Override + public BridgeContext createBridgeContext(SVGOMDocument doc) { + return super.createBridgeContext(doc); + } +} diff --git a/designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java b/designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java new file mode 100644 index 000000000..ee289b4c8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java @@ -0,0 +1,96 @@ +package com.fr.base.svg; + +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StableUtils; +import com.fr.stable.os.OperatingSystem; +import org.jetbrains.annotations.NotNull; + +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.lang.reflect.Method; +import java.util.concurrent.atomic.AtomicReference; + +/** + * 获取系统Scale相关的工具类 + * @author Yvan + * @version 10.0 + * Created by Yvan on 2020/12/17 + */ +public class SystemScaleUtils { + + private static final AtomicReference JRE_HIDPI = new AtomicReference<>(); + + private static final String HI_DPI = "hidpi"; + + /** + * 判断是否支持高清 + * @return + */ + public static boolean isJreHiDPIEnabled() { + if (JRE_HIDPI.get() != null) { + return JRE_HIDPI.get(); + } + if (OperatingSystem.isMacos()) { + // 如果是mac os系统,直接返回true + return true; + } + if (OperatingSystem.isWindows() && StableUtils.getMajorJavaVersion() <= 8) { + // 如果是jdk8 + Windows系统,直接返回false + return false; + } + synchronized (JRE_HIDPI) { + if (JRE_HIDPI.get() != null) { + return JRE_HIDPI.get(); + } + boolean result = false; + if (getBooleanProperty(HI_DPI, true)) { + try { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + Class sunGraphicsEnvironmentClass = Class.forName("sun.java2d.SunGraphicsEnvironment"); + if (sunGraphicsEnvironmentClass.isInstance(ge)) { + try { + Method method = sunGraphicsEnvironmentClass.getDeclaredMethod("isUIScaleEnabled"); + method.setAccessible(true); + result = (Boolean)method.invoke(ge); + } + catch (NoSuchMethodException e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } + } + } + catch (Throwable ignore) { + } + } + JRE_HIDPI.set(result); + return result; + } + } + + public static boolean getBooleanProperty(@NotNull final String key, final boolean defaultValue) { + final String value = System.getProperty(key); + return value == null ? defaultValue : Boolean.parseBoolean(value); + } + + /** + * 获取系统Scale + * @return + */ + public static float sysScale() { + float scale = 1.0f; + // 先判断是否支持高清,不支持代表此时是Windows + jdk8 的设计器,返回的scale值为1.0 + if (isJreHiDPIEnabled()) { + // 获取屏幕图形设备对象 + GraphicsDevice graphicsDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + if (graphicsDevice != null) { + // 获取图形配置对象 + GraphicsConfiguration configuration = graphicsDevice.getDefaultConfiguration(); + if (configuration != null && configuration.getDevice().getType() != GraphicsDevice.TYPE_PRINTER) { + // 获取屏幕缩放率,mac下固定为2,Windows+jdk11则将得到用户设置的dpi值 + scale = (float) configuration.getDefaultTransform().getScaleX(); + } + } + } + return scale; + } +} From 1df5af6bc3c3b9f6223b569479b3ca520a746561 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 18 Dec 2020 09:49:13 +0800 Subject: [PATCH 015/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.2:?= =?UTF-8?q?=E6=8F=90=E4=BA=A4UpdateAction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/UpdateAction.java | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java index 4fd7e6c42..c284b9d56 100644 --- a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java @@ -78,6 +78,16 @@ public abstract class UpdateAction extends ShortCut implements Action { private String searchText = StringUtils.EMPTY; + /** + * 按钮在按压状态的图标key + */ + public static final String PRESSED_ICON = "pressedIcon"; + + /** + * 按钮在灰化状态的图标key + */ + public static final String DISABLED_ICON = "disabledIcon"; + /** @@ -251,6 +261,14 @@ public abstract class UpdateAction extends ShortCut implements Action { } + public void setPressedIcon(Icon pressedIcon) { + this.putValue(UpdateAction.PRESSED_ICON, pressedIcon); + } + + public void setDisabledIcon(Icon disabledIcon) { + this.putValue(UpdateAction.DISABLED_ICON, disabledIcon); + } + @Override public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { @@ -271,6 +289,8 @@ public abstract class UpdateAction extends ShortCut implements Action { UIMenuItem menuItem = new UIMenuItem(this); // 设置名字用作单元测 menuItem.setName(getName()); + setPressedIcon4Button(menuItem); + setDisabledIcon4Button(menuItem); object = menuItem; this.putValue(UIMenuItem.class.getName(), object); @@ -282,6 +302,8 @@ public abstract class UpdateAction extends ShortCut implements Action { UIMenuEastAttrItem menuItem = new UIMenuEastAttrItem(this); // 设置名字用作单元测 menuItem.setName(getName()); + setPressedIcon4Button(menuItem); + setDisabledIcon4Button(menuItem); this.putValue(UIMenuItem.class.getName(), menuItem); return menuItem; } @@ -307,6 +329,8 @@ public abstract class UpdateAction extends ShortCut implements Action { } button.setIcon((Icon) this.getValue(Action.SMALL_ICON)); + setPressedIcon4Button(button); + setDisabledIcon4Button(button); button.addActionListener(this); button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); @@ -454,6 +478,8 @@ public abstract class UpdateAction extends ShortCut implements Action { object = new UseMenuItem(this); this.putValue(UseMenuItem.class.getName(), object); } + setPressedIcon4Button((UseMenuItem) object); + setDisabledIcon4Button((UseMenuItem) object); return (UseMenuItem) object; } @@ -594,4 +620,17 @@ public abstract class UpdateAction extends ShortCut implements Action { shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator); } -} \ No newline at end of file + private void setPressedIcon4Button(AbstractButton button) { + Icon pressedIcon = (Icon) this.getValue(UpdateAction.PRESSED_ICON); + if (pressedIcon != null) { + button.setPressedIcon(pressedIcon); + } + } + + private void setDisabledIcon4Button(AbstractButton button) { + Icon disabledIcon = (Icon) this.getValue(UpdateAction.DISABLED_ICON); + if (disabledIcon != null) { + button.setDisabledIcon(disabledIcon); + } + } +} From 276fd0a8369ba0f4154bca37b98752f007dde031 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 18 Dec 2020 13:58:41 +0800 Subject: [PATCH 016/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.3:?= =?UTF-8?q?=20=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=8F=9C=E5=8D=95=E6=A0=8F?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E5=B7=A5=E5=85=B7=E6=A0=8F-=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E3=80=81=E6=92=A4=E9=94=80=E3=80=81=E9=87=8D=E5=81=9A?= =?UTF-8?q?=E3=80=81=E5=89=AA=E5=88=87=E3=80=81=E5=A4=8D=E5=88=B6=E3=80=81?= =?UTF-8?q?=E7=B2=98=E8=B4=B4=E3=80=81=E6=A0=BC=E5=BC=8F=E5=88=B7=E3=80=81?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/edit/CopyAction.java | 7 ++++--- .../com/fr/design/actions/edit/CutAction.java | 8 ++++---- .../com/fr/design/actions/edit/PasteAction.java | 7 ++++--- .../fr/design/images/buttonicon/redo_disabled.svg | 7 +++++++ .../fr/design/images/buttonicon/redo_normal.svg | 7 +++++++ .../fr/design/images/buttonicon/save_disabled.svg | 12 ++++++++++++ .../fr/design/images/buttonicon/save_normal.svg | 12 ++++++++++++ .../fr/design/images/buttonicon/undo_disabled.svg | 7 +++++++ .../fr/design/images/buttonicon/undo_normal.svg | 7 +++++++ .../com/fr/design/images/m_edit/copy_disabled.svg | 7 +++++++ .../com/fr/design/images/m_edit/copy_normal.svg | 10 ++++++++++ .../com/fr/design/images/m_edit/cut_disabled.svg | 9 +++++++++ .../com/fr/design/images/m_edit/cut_normal.svg | 10 ++++++++++ .../design/images/m_edit/formatBrush_normal.svg | 9 +++++++++ .../fr/design/images/m_edit/paste_disabled.svg | 10 ++++++++++ .../com/fr/design/images/m_edit/paste_normal.svg | 11 +++++++++++ .../fr/design/images/m_report/delete_disabled.svg | 7 +++++++ .../fr/design/images/m_report/delete_normal.svg | 7 +++++++ .../design/designer/beans/actions/CopyAction.java | 7 ++++--- .../design/designer/beans/actions/CutAction.java | 7 ++++--- .../designer/beans/actions/FormDeleteAction.java | 5 +++-- .../designer/beans/actions/PasteAction.java | 7 ++++--- .../com/fr/design/actions/edit/DeleteAction.java | 9 ++++----- .../fr/design/mainframe/FormatBrushAction.java | 3 ++- .../com/fr/poly/actions/DeleteBlockAction.java | 5 +++-- .../src/main/java/com/fr/start/MainDesigner.java | 11 +++++++---- .../java/com/fr/start/preload/ImagePreLoader.java | 15 +++++++++++++++ 27 files changed, 190 insertions(+), 33 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/save_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/save_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/copy_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/copy_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/cut_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/cut_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/formatBrush_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/paste_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/paste_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/delete_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/delete_normal.svg diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java index a31177374..2dc001a49 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.edit; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.TemplateComponentAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.TargetComponent; @@ -22,7 +22,8 @@ public class CopyAction extends TemplateComponentAction { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Copy")); this.setMnemonic('C'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/copy_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/copy_disabled.svg")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)); this.setEnabled(!DesignModeContext.isBanCopyAndCut()); } @@ -32,4 +33,4 @@ public class CopyAction extends TemplateComponentAction { DesignModeContext.doCopy(getEditingComponent()); return false; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java index c03d5d3de..813524984 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java @@ -3,11 +3,10 @@ */ package com.fr.design.actions.edit; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.TemplateComponentAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.TargetComponent; -import com.fr.general.IOUtils; import javax.swing.KeyStroke; import java.awt.event.KeyEvent; @@ -26,7 +25,8 @@ public class CutAction extends TemplateComponentAction { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut")); this.setMnemonic('T'); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/cut_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/cut_disabled.svg")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); this.setEnabled(!DesignModeContext.isBanCopyAndCut()); } @@ -35,4 +35,4 @@ public class CutAction extends TemplateComponentAction { public boolean executeActionReturnUndoRecordNeeded() { return DesignModeContext.doCut(getEditingComponent()); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java index 6c8a9a515..39adec806 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.edit; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.TemplateComponentAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.TargetComponent; @@ -25,7 +25,8 @@ public class PasteAction extends TemplateComponentAction { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Edit_Paste")); this.setMnemonic('P'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/paste_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/paste_disabled.svg")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)); } @@ -33,4 +34,4 @@ public class PasteAction extends TemplateComponentAction { public boolean executeActionReturnUndoRecordNeeded() { return DesignModeContext.doPaste(getEditingComponent()); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_disabled.svg new file mode 100644 index 000000000..7866d7b44 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_disabled.svg @@ -0,0 +1,7 @@ + + + icon_重做_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_normal.svg new file mode 100644 index 000000000..3f1e16e89 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_normal.svg @@ -0,0 +1,7 @@ + + + icon_重做_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/save_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/save_disabled.svg new file mode 100644 index 000000000..7b44ca672 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/save_disabled.svg @@ -0,0 +1,12 @@ + + + icon_保存_disabled + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/save_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/save_normal.svg new file mode 100644 index 000000000..c821dbecf --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/save_normal.svg @@ -0,0 +1,12 @@ + + + icon_保存_normal + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_disabled.svg new file mode 100644 index 000000000..ca7b9f1c6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_disabled.svg @@ -0,0 +1,7 @@ + + + icon_撤销_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_normal.svg new file mode 100644 index 000000000..72f9e2933 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_normal.svg @@ -0,0 +1,7 @@ + + + icon_撤销_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/copy_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/copy_disabled.svg new file mode 100644 index 000000000..8f4820de1 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/copy_disabled.svg @@ -0,0 +1,7 @@ + + + icon_复制_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/copy_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/copy_normal.svg new file mode 100644 index 000000000..31127a957 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/copy_normal.svg @@ -0,0 +1,10 @@ + + + icon_复制_normal + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/cut_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/cut_disabled.svg new file mode 100644 index 000000000..c4982036b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/cut_disabled.svg @@ -0,0 +1,9 @@ + + + icon_剪切_disabled + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/cut_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/cut_normal.svg new file mode 100644 index 000000000..a4cc6a17d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/cut_normal.svg @@ -0,0 +1,10 @@ + + + icon_剪切_normal + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/formatBrush_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/formatBrush_normal.svg new file mode 100644 index 000000000..009e60355 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/formatBrush_normal.svg @@ -0,0 +1,9 @@ + + + icon_格式刷_normal + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/paste_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/paste_disabled.svg new file mode 100644 index 000000000..c2536b377 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/paste_disabled.svg @@ -0,0 +1,10 @@ + + + icon_粘贴_disabled + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/paste_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/paste_normal.svg new file mode 100644 index 000000000..5ae337072 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/paste_normal.svg @@ -0,0 +1,11 @@ + + + icon_粘贴_normal + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/delete_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/delete_disabled.svg new file mode 100644 index 000000000..93b0f0302 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/delete_disabled.svg @@ -0,0 +1,7 @@ + + + icon_关闭_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/delete_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/delete_normal.svg new file mode 100644 index 000000000..90832de79 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/delete_normal.svg @@ -0,0 +1,7 @@ + + + icon_关闭_red + + + + \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java index 47f7e3924..2ae2ae973 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java @@ -1,6 +1,6 @@ package com.fr.design.designer.beans.actions; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.beans.actions.behavior.ComponentEnable; import com.fr.design.mainframe.FormDesigner; @@ -16,7 +16,8 @@ public class CopyAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Copy")); this.setMnemonic('C'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/copy_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/copy_disabled.svg")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)); setUpdateBehavior(new ComponentEnable()); this.setEnabled(!DesignModeContext.isBanCopyAndCut()); @@ -27,4 +28,4 @@ public class CopyAction extends FormWidgetEditAction { DesignModeContext.doCopy(getEditingComponent()); return false; } -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java index 421cae2e6..f366602f9 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java @@ -1,6 +1,6 @@ package com.fr.design.designer.beans.actions; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.beans.actions.behavior.ComponentEnable; import com.fr.design.mainframe.FormDesigner; @@ -16,7 +16,8 @@ public class CutAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut")); this.setMnemonic('T'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/cut_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/cut_disabled.svg")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); this.setUpdateBehavior(new ComponentEnable()); this.setEnabled(!DesignModeContext.isBanCopyAndCut()); @@ -26,4 +27,4 @@ public class CutAction extends FormWidgetEditAction { public boolean executeActionReturnUndoRecordNeeded() { return DesignModeContext.doCut(getEditingComponent()); } -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java index 7492f8cc8..94e434cc8 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java @@ -7,7 +7,7 @@ import java.awt.event.KeyEvent; import javax.swing.*; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.designer.beans.actions.behavior.ComponentEnable; import com.fr.design.mainframe.FormDesigner; @@ -24,7 +24,8 @@ public class FormDeleteAction extends FormWidgetEditAction { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_Delete")); this.setMnemonic('D'); // Richie:删除菜单图标 - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/delete.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/delete_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/delete_disabled.svg")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)); this.setUpdateBehavior(new ComponentEnable()); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java index c02295f0f..1e6a17b2e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java @@ -1,6 +1,6 @@ package com.fr.design.designer.beans.actions; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.mainframe.FormDesigner; @@ -15,7 +15,8 @@ public class PasteAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Edit_Paste")); this.setMnemonic('P'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/paste_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/paste_disabled.svg")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)); } @@ -29,4 +30,4 @@ public class PasteAction extends FormWidgetEditAction { this.setEnabled(true); } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/edit/DeleteAction.java b/designer-realize/src/main/java/com/fr/design/actions/edit/DeleteAction.java index e7ca0bd96..5023ab5a4 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/edit/DeleteAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/edit/DeleteAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.edit; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.ElementCaseAction; import com.fr.design.mainframe.ElementCasePane; @@ -17,18 +17,17 @@ public class DeleteAction extends ElementCaseAction { */ public DeleteAction(ElementCasePane t) { super(t); - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_Delete")); this.setMnemonic('D'); //Richie:删除菜单图标 - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/delete.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/delete_normal.svg")); // this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)); } - + @Override public boolean executeActionReturnUndoRecordNeeded() { ElementCasePane ePane = getEditingComponent(); - + return ePane.getSelection().triggerDeleteAction(ePane); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java b/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java index 76298161f..b2b29421c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.Style; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.ElementCaseAction; import com.fr.grid.selection.CellSelection; @@ -31,7 +32,7 @@ public class FormatBrushAction extends ElementCaseAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_FormatBrush")); this.setMnemonic('B'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/formatBrush.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/formatBrush_normal.svg")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, DEFAULT_MODIFIER)); } diff --git a/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java b/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java index 908e235a6..d9a8cbf35 100644 --- a/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java +++ b/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java @@ -8,7 +8,7 @@ import java.awt.event.KeyEvent; import javax.swing.KeyStroke; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.TemplateComponentActionInterface; import com.fr.design.actions.UpdateAction; @@ -26,7 +26,8 @@ public class DeleteBlockAction extends UpdateAction implements TemplateComponent this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_Delete")); this.setMnemonic('D'); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/delete.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/delete_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/delete_disabled.svg")); } @Override 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 ff3aadd36..a538416fc 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -1,6 +1,6 @@ package com.fr.start; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.file.WebPreviewUtils; @@ -222,7 +222,8 @@ public class MainDesigner extends BaseDesigner { private void createSaveButton() { - saveButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/save.png")); + saveButton = new UIButton(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/save_normal.svg")); + saveButton.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/save_disabled.svg")); saveButton.setToolTipText(KeySetUtils.SAVE_TEMPLATE.getMenuKeySetName()); saveButton.set4ToolbarButton(); saveButton.addActionListener(new ActionListener() { @@ -238,7 +239,8 @@ public class MainDesigner extends BaseDesigner { private void createUndoButton() { - undo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/undo.png")); + undo = new UIButton(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/undo_normal.svg")); + undo.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/undo_disabled.svg")); undo.setToolTipText(KeySetUtils.UNDO.getMenuKeySetName()); undo.set4ToolbarButton(); undo.addActionListener(new ActionListener() { @@ -253,7 +255,8 @@ public class MainDesigner extends BaseDesigner { } private void createRedoButton() { - redo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/redo.png")); + redo = new UIButton(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/redo_normal.svg")); + redo.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/redo_disabled.svg")); redo.setToolTipText(KeySetUtils.REDO.getMenuKeySetName()); redo.set4ToolbarButton(); redo.addActionListener(new ActionListener() { diff --git a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java index 1204f9a88..3fddca218 100644 --- a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java +++ b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java @@ -94,8 +94,14 @@ public class ImagePreLoader { "com/fr/design/images/m_report/close_over.png", "com/fr/design/images/m_report/close_press.png", "com/fr/design/images/buttonicon/save.png", + "com/fr/design/images/buttonicon/save_normal.svg", + "com/fr/design/images/buttonicon/save_disabled.svg", "com/fr/design/images/buttonicon/undo.png", + "com/fr/design/images/buttonicon/undo_normal.svg", + "com/fr/design/images/buttonicon/undo_disabled.svg", "com/fr/design/images/buttonicon/redo.png", + "com/fr/design/images/buttonicon/redo_normal.svg", + "com/fr/design/images/buttonicon/redo_disabled.svg", "com/fr/design/images/buttonicon/additicon_grey.png", "com/fr/design/images/buttonicon/addicon.png", "com/fr/design/images/buttonicon/list_normal.png", @@ -130,6 +136,8 @@ public class ImagePreLoader { "com/fr/design/images/buttonicon/propertiestab/cellelement_selected.png", "com/fr/design/images/log/selectedall.png", "com/fr/design/images/m_edit/copy.png", + "com/fr/design/images/m_edit/copy_normal.svg", + "com/fr/design/images/m_edit/copy_disabled.svg", "com/fr/design/images/log/clear.png", "com/fr/design/images/log/clear.png", "com/fr/design/images/log/selectedall.png", @@ -233,8 +241,14 @@ public class ImagePreLoader { "com/fr/web/images/form/forbid.png", "com/fr/web/images/form/resources/layout_absolute.png", "com/fr/design/images/m_edit/cut.png", + "com/fr/design/images/m_edit/cut_normal.svg", + "com/fr/design/images/m_edit/cut_disabled.svg", "com/fr/design/images/m_edit/paste.png", + "com/fr/design/images/m_edit/paste_normal.svg", + "com/fr/design/images/m_edit/paste_disabled.svg", "com/fr/design/images/m_report/delete.png", + "com/fr/design/images/m_report/delete_normal.svg", + "com/fr/design/images/m_report/delete_disabled.svg", "com/fr/design/images/toolbarbtn/parametersetting.png", "com/fr/base/images/oem/addworksheet.png", "com/fr/design/images/sheet/addpolysheet.png", @@ -249,6 +263,7 @@ public class ImagePreLoader { "com/fr/design/images/data/source/normalUp20.png", "com/fr/design/images/data/source/hoverUp20.png", "com/fr/design/images/m_edit/formatBrush.png", + "com/fr/design/images/m_edit/formatBrush_normal.svg", "com/fr/design/images/expand/none16x16_selected@1x.png", "com/fr/design/images/expand/vertical.png", "com/fr/design/images/expand/vertical_selected@1x.png", From 941eb8ff646ea48e92f44ca141f45c60f262e9e7 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 18 Dec 2020 19:25:37 +0800 Subject: [PATCH 017/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.4:?= =?UTF-8?q?=20=E2=91=A0=E4=B8=BASVGIcon=E5=A2=9E=E5=8A=A0=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E8=AF=BB=E5=8F=96=E6=8C=87=E5=AE=9A=E5=AE=BD=E9=AB=98?= =?UTF-8?q?Icon=E7=9A=84=E6=8E=A5=E5=8F=A3=EF=BC=9B=E2=91=A1=E6=99=AE?= =?UTF-8?q?=E9=80=9A=E6=8A=A5=E8=A1=A8-=E5=B7=A5=E5=85=B7=E6=A0=8F=20&&=20?= =?UTF-8?q?=E8=81=9A=E5=90=88=E6=8A=A5=E8=A1=A8-=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=9D=97-=E5=B7=A5=E5=85=B7=E6=A0=8F=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0001-REPORT-42238-10.0.13-JDK11.patch | 110 ++++++++++++++++++ .../main/java/com/fr/base/svg/SVGIcon.java | 14 ++- .../main/java/com/fr/base/svg/SVGLoader.java | 15 ++- .../java/com/fr/base/svg/SVGTranscoder.java | 13 ++- .../main/java/com/fr/design/menu/MenuDef.java | 23 ++-- .../style/color/UIToolbarColorButton.java | 6 +- .../images/gui/color/background_normal.svg | 8 ++ .../images/gui/color/foreground_normal.svg | 7 ++ .../com/fr/design/images/gui/popup_normal.svg | 7 ++ .../design/images/m_edit/merge_disabled.svg | 11 ++ .../fr/design/images/m_edit/merge_normal.svg | 11 ++ .../design/images/m_edit/unmerge_disabled.svg | 10 ++ .../design/images/m_edit/unmerge_normal.svg | 8 ++ .../images/m_format/cellstyle/bold_normal.svg | 7 ++ .../m_format/cellstyle/bold_selected.svg | 7 ++ .../m_format/cellstyle/h_center_normal.svg | 7 ++ .../m_format/cellstyle/h_center_selected.svg | 7 ++ .../m_format/cellstyle/h_left_normal.svg | 7 ++ .../m_format/cellstyle/h_left_selected.svg | 7 ++ .../m_format/cellstyle/h_right_normal.svg | 7 ++ .../m_format/cellstyle/h_right_selected.svg | 7 ++ .../m_format/cellstyle/italic_normal.svg | 9 ++ .../m_format/cellstyle/italic_selected.svg | 9 ++ .../m_format/cellstyle/underline_normal.svg | 7 ++ .../m_format/cellstyle/underline_selected.svg | 7 ++ .../images/m_format/noborder_normal.svg | 7 ++ .../design/images/m_insert/bias_disabled.svg | 7 ++ .../fr/design/images/m_insert/bias_normal.svg | 7 ++ .../images/m_insert/bindColumn_disabled.svg | 7 ++ .../images/m_insert/bindColumn_normal.svg | 7 ++ .../design/images/m_insert/chart_disabled.svg | 7 ++ .../design/images/m_insert/chart_normal.svg | 7 ++ .../images/m_insert/floatPop_normal.svg | 9 ++ .../images/m_insert/formula_disabled.svg | 7 ++ .../design/images/m_insert/formula_normal.svg | 7 ++ .../design/images/m_insert/image_disabled.svg | 12 ++ .../design/images/m_insert/image_normal.svg | 10 ++ .../images/m_insert/richtext_disabled.svg | 7 ++ .../images/m_insert/richtext_normal.svg | 7 ++ .../images/m_insert/subReport_disabled.svg | 12 ++ .../images/m_insert/subReport_normal.svg | 10 ++ .../design/images/m_insert/text_disabled.svg | 7 ++ .../fr/design/images/m_insert/text_normal.svg | 7 ++ .../images/m_report/delete_disabled.svg | 4 +- .../actions/cell/UIToolbarBorderButton.java | 22 ++-- .../actions/cell/style/AlignmentAction.java | 7 +- .../cell/style/ReportFontBoldAction.java | 6 +- .../style/ReportFontForegroundAction.java | 5 +- .../cell/style/ReportFontItalicAction.java | 4 +- .../cell/style/ReportFontUnderlineAction.java | 6 +- .../cell/style/StyleBackgroundAction.java | 9 +- .../actions/edit/merge/MergeCellAction.java | 7 +- .../actions/edit/merge/UnmergeCellAction.java | 6 +- .../actions/insert/cell/BiasCellAction.java | 5 +- .../actions/insert/cell/ChartCellAction.java | 5 +- .../insert/cell/DSColumnCellAction.java | 7 +- .../insert/cell/FormulaCellAction.java | 5 +- .../insert/cell/GeneralCellAction.java | 5 +- .../actions/insert/cell/ImageCellAction.java | 5 +- .../insert/cell/RichTextCellAction.java | 6 +- .../insert/cell/SubReportCellAction.java | 5 +- .../actions/insert/flot/ChartFloatAction.java | 4 +- .../insert/flot/FormulaFloatAction.java | 4 +- .../actions/insert/flot/ImageFloatAction.java | 3 +- .../insert/flot/TextBoxFloatAction.java | 4 +- .../fr/design/mainframe/ElementCasePane.java | 5 +- .../com/fr/start/preload/ImagePreLoader.java | 37 ++++++ 67 files changed, 574 insertions(+), 77 deletions(-) create mode 100644 0001-REPORT-42238-10.0.13-JDK11.patch create mode 100644 designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/gui/color/foreground_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/gui/popup_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/merge_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/merge_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/noborder_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/bias_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/bias_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/chart_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/chart_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/floatPop_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/formula_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/formula_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/image_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/image_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/text_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/text_normal.svg diff --git a/0001-REPORT-42238-10.0.13-JDK11.patch b/0001-REPORT-42238-10.0.13-JDK11.patch new file mode 100644 index 000000000..f17452d9d --- /dev/null +++ b/0001-REPORT-42238-10.0.13-JDK11.patch @@ -0,0 +1,110 @@ +From 1df5af6bc3c3b9f6223b569479b3ca520a746561 Mon Sep 17 00:00:00 2001 +From: Yvan +Date: Fri, 18 Dec 2020 09:49:13 +0800 +Subject: [PATCH] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13=E3=80=91JDK11?= + =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87=E6=A8=A1=E7=B3=8A?= + =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.2:=E6=8F=90=E4=BA=A4U?= + =?UTF-8?q?pdateAction?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + .../com/fr/design/actions/UpdateAction.java | 41 ++++++++++++++++++- + 1 file changed, 40 insertions(+), 1 deletion(-) + +diff --git a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java +index 4fd7e6c42..c284b9d56 100644 +--- a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java ++++ b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java +@@ -78,6 +78,16 @@ public abstract class UpdateAction extends ShortCut implements Action { + + private String searchText = StringUtils.EMPTY; + ++ /** ++ * 按钮在按压状态的图标key ++ */ ++ public static final String PRESSED_ICON = "pressedIcon"; ++ ++ /** ++ * 按钮在灰化状态的图标key ++ */ ++ public static final String DISABLED_ICON = "disabledIcon"; ++ + + + /** +@@ -251,6 +261,14 @@ public abstract class UpdateAction extends ShortCut implements Action { + + } + ++ public void setPressedIcon(Icon pressedIcon) { ++ this.putValue(UpdateAction.PRESSED_ICON, pressedIcon); ++ } ++ ++ public void setDisabledIcon(Icon disabledIcon) { ++ this.putValue(UpdateAction.DISABLED_ICON, disabledIcon); ++ } ++ + @Override + public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { + +@@ -271,6 +289,8 @@ public abstract class UpdateAction extends ShortCut implements Action { + UIMenuItem menuItem = new UIMenuItem(this); + // 设置名字用作单元测 + menuItem.setName(getName()); ++ setPressedIcon4Button(menuItem); ++ setDisabledIcon4Button(menuItem); + object = menuItem; + + this.putValue(UIMenuItem.class.getName(), object); +@@ -282,6 +302,8 @@ public abstract class UpdateAction extends ShortCut implements Action { + UIMenuEastAttrItem menuItem = new UIMenuEastAttrItem(this); + // 设置名字用作单元测 + menuItem.setName(getName()); ++ setPressedIcon4Button(menuItem); ++ setDisabledIcon4Button(menuItem); + this.putValue(UIMenuItem.class.getName(), menuItem); + return menuItem; + } +@@ -307,6 +329,8 @@ public abstract class UpdateAction extends ShortCut implements Action { + } + + button.setIcon((Icon) this.getValue(Action.SMALL_ICON)); ++ setPressedIcon4Button(button); ++ setDisabledIcon4Button(button); + button.addActionListener(this); + + button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); +@@ -454,6 +478,8 @@ public abstract class UpdateAction extends ShortCut implements Action { + object = new UseMenuItem(this); + this.putValue(UseMenuItem.class.getName(), object); + } ++ setPressedIcon4Button((UseMenuItem) object); ++ setDisabledIcon4Button((UseMenuItem) object); + return (UseMenuItem) object; + } + +@@ -594,4 +620,17 @@ public abstract class UpdateAction extends ShortCut implements Action { + shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator); + } + +-} +\ No newline at end of file ++ private void setPressedIcon4Button(AbstractButton button) { ++ Icon pressedIcon = (Icon) this.getValue(UpdateAction.PRESSED_ICON); ++ if (pressedIcon != null) { ++ button.setPressedIcon(pressedIcon); ++ } ++ } ++ ++ private void setDisabledIcon4Button(AbstractButton button) { ++ Icon disabledIcon = (Icon) this.getValue(UpdateAction.DISABLED_ICON); ++ if (disabledIcon != null) { ++ button.setDisabledIcon(disabledIcon); ++ } ++ } ++} +-- +2.24.1 + diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java index e5300a821..cae4b5958 100644 --- a/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java +++ b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java @@ -2,6 +2,7 @@ package com.fr.base.svg; import javax.swing.Icon; import java.awt.Component; +import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.image.BufferedImage; @@ -49,11 +50,22 @@ public class SVGIcon implements Icon { } /** - * 外界读取高清图标 + * 外界读取高清图标,默认尺寸为16*16 * @param url * @return */ public static Icon readSVGIcon(String url) { return new SVGIcon((BufferedImage) SVGLoader.load(url)); } + + /** + * 读取指定尺寸的图标 + * @param url 资源路径 + * @param width 宽度 + * @param height 高度 + * @return + */ + public static Icon readSVGIcon(String url, float width, float height) { + return new SVGIcon((BufferedImage) SVGLoader.load(url, width, height)); + } } diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java b/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java index 1649454a1..53d105aef 100644 --- a/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java +++ b/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java @@ -62,13 +62,24 @@ public class SVGLoader { @Nullable - public static Image load(@NotNull URL url, double scale, double width, double height) throws IOException { + public static Image load(@NotNull URL url, double scale, double overriddenWidth, double overriddenHeight) throws IOException { try { String svgUri = url.toString(); TranscoderInput input = new TranscoderInput(svgUri); - return SVGTranscoder.createImage(scale, input, (float) (width * scale), (float) (height * scale)).getImage(); + return SVGTranscoder.createImage(scale, input, (float) (overriddenWidth * scale), (float) (overriddenHeight * scale)).getImage(); } catch (TranscoderException e) { throw new IOException(e); } } + + @Nullable + public static Image load(@NotNull String url, float width, float height) { + try { + String svgUri = url.toString(); + TranscoderInput input = new TranscoderInput(svgUri); + return SVGTranscoder.createImage(SVGIcon.SYSTEM_SCALE, input, -1, -1, width, height).getImage(); + } catch (TranscoderException ignore) { + return null; + } + } } diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java b/designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java index 2f547fe07..dd47bc575 100644 --- a/designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java +++ b/designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java @@ -67,6 +67,12 @@ public class SVGTranscoder extends ImageTranscoder { this.height = ICON_DEFAULT_SIZE; } + public SVGTranscoder(double scale, float width, float height) { + this.scale = scale; + this.width = width; + this.height = height; + } + public final float getOrigDocWidth() { return this.origDocWidth; } @@ -99,7 +105,12 @@ public class SVGTranscoder extends ImageTranscoder { @NotNull public static SVGTranscoder createImage(double scale, @NotNull TranscoderInput input, float overriddenWidth, float overriddenHeight) throws TranscoderException { - SVGTranscoder transcoder = new SVGTranscoder(scale); + return createImage(scale, input, overriddenWidth, overriddenHeight, ICON_DEFAULT_SIZE, ICON_DEFAULT_SIZE); + } + + @NotNull + public static SVGTranscoder createImage(double scale, @NotNull TranscoderInput input, float overriddenWidth, float overriddenHeight, float width, float height) throws TranscoderException { + SVGTranscoder transcoder = new SVGTranscoder(scale, width, height); if (!AssistUtils.equals(overriddenWidth, DEFAULT_VALUE)) { transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, overriddenWidth); } diff --git a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java index 10f994494..689560e95 100644 --- a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java @@ -1,6 +1,7 @@ package com.fr.design.menu; import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.*; import com.fr.design.gui.iscrollbar.UIScrollBar; @@ -40,6 +41,7 @@ public class MenuDef extends ShortCut { protected JPopupMenu popupMenu; protected boolean hasScrollSubMenu; protected boolean isHeadMenu; + private boolean isSVGIcon = false; private String anchor; @@ -99,6 +101,11 @@ public class MenuDef extends ShortCut { this.iconPath = iconPath; } + public void setIconPath(String iconPath, boolean isSVGIcon) { + this.iconPath = iconPath; + this.isSVGIcon = isSVGIcon; + } + public int getShortCutCount() { return this.shortcutList.size(); } @@ -141,7 +148,7 @@ public class MenuDef extends ShortCut { addShortCut(i); } } - + public void addShortCut(ShortCut shortCut) { this.shortcutList.add(shortCut); } @@ -166,7 +173,7 @@ public class MenuDef extends ShortCut { public UIButton createUIButton() { if (createdButton == null) { if (iconPath != null) { - createdButton = new UIButton(BaseUtils.readIcon(iconPath)); + createdButton = new UIButton(isSVGIcon ? SVGIcon.readSVGIcon(iconPath) : BaseUtils.readIcon(iconPath)); createdButton.set4ToolbarButton(); } else { createdButton = new UIButton(name); @@ -206,9 +213,9 @@ public class MenuDef extends ShortCut { return createdJMenu; } - + protected UIMenu createJMenu0() { - + UIMenu createdJMenu; if (hasScrollSubMenu) { createdJMenu = new UIScrollMenu(this.getName()); @@ -219,7 +226,7 @@ public class MenuDef extends ShortCut { } return createdJMenu; } - + protected ContainerListener getContainerListener() { return null; } @@ -389,9 +396,9 @@ public class MenuDef extends ShortCut { public void intoJToolBar(JToolBar toolBar) { toolBar.add(this.createUIButton()); } - + protected MenuListener createMenuListener() { - + return menuDefListener; } @@ -456,4 +463,4 @@ public class MenuDef extends ShortCut { } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java b/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java index 9066b4a90..24328ef41 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java +++ b/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java @@ -3,7 +3,7 @@ */ package com.fr.design.style.color; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; @@ -34,7 +34,7 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi private UIObserverListener uiObserverListener; public UIToolbarColorButton(Icon icon) { - super(new UIColorButton(icon), new UIButton(BaseUtils.readIcon("/com/fr/design/images/gui/popup.gif"))); + super(new UIColorButton(icon), new UIButton(SVGIcon.readSVGIcon("/com/fr/design/images/gui/popup_normal.svg"))); getLeftButton().setEventBanned(true); getRightButton().addFocusListener(new FocusListener() { @@ -244,4 +244,4 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi public boolean shouldResponseChangeListener() { return true; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg b/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg new file mode 100644 index 000000000..112cfef2a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg @@ -0,0 +1,8 @@ + + + icon_文本背景色_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/gui/color/foreground_normal.svg b/designer-base/src/main/resources/com/fr/design/images/gui/color/foreground_normal.svg new file mode 100644 index 000000000..0eaa40e93 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/gui/color/foreground_normal.svg @@ -0,0 +1,7 @@ + + + icon_文本前景色_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/gui/popup_normal.svg b/designer-base/src/main/resources/com/fr/design/images/gui/popup_normal.svg new file mode 100644 index 000000000..81e81b0a1 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/gui/popup_normal.svg @@ -0,0 +1,7 @@ + + + icon_组件分隔_箭头下_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/merge_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/merge_disabled.svg new file mode 100644 index 000000000..a2b0f3ddf --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/merge_disabled.svg @@ -0,0 +1,11 @@ + + + icon_合并单元格_disabled + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/merge_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/merge_normal.svg new file mode 100644 index 000000000..4a79d5a64 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/merge_normal.svg @@ -0,0 +1,11 @@ + + + icon_合并单元格_normal + + + + a + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_disabled.svg new file mode 100644 index 000000000..7ab193216 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_disabled.svg @@ -0,0 +1,10 @@ + + + icon_拆分单元格_disabled + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_normal.svg new file mode 100644 index 000000000..faad95c00 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_normal.svg @@ -0,0 +1,8 @@ + + + icon_拆分单元格_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_normal.svg new file mode 100644 index 000000000..173782b1d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_normal.svg @@ -0,0 +1,7 @@ + + + icon_文本工具_加粗_nomal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_selected.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_selected.svg new file mode 100644 index 000000000..16c56767a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_selected.svg @@ -0,0 +1,7 @@ + + + icon_文本工具_加粗_selected + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_normal.svg new file mode 100644 index 000000000..c7ca8f889 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_normal.svg @@ -0,0 +1,7 @@ + + + icon_对齐 居中对齐_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_selected.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_selected.svg new file mode 100644 index 000000000..84625ef78 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_selected.svg @@ -0,0 +1,7 @@ + + + icon_对齐 居中对齐_selected + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_normal.svg new file mode 100644 index 000000000..6adf58034 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_normal.svg @@ -0,0 +1,7 @@ + + + icon_对齐 左对齐_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_selected.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_selected.svg new file mode 100644 index 000000000..36d615ae4 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_selected.svg @@ -0,0 +1,7 @@ + + + icon_对齐 左对齐_selected + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_normal.svg new file mode 100644 index 000000000..39d4a3336 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_normal.svg @@ -0,0 +1,7 @@ + + + icon_对齐 右对齐_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_selected.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_selected.svg new file mode 100644 index 000000000..7ec881db6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_selected.svg @@ -0,0 +1,7 @@ + + + icon_对齐 右对齐_selected + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_normal.svg new file mode 100644 index 000000000..7873d4d1a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_normal.svg @@ -0,0 +1,9 @@ + + + icon_文本工具_斜体_normal + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_selected.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_selected.svg new file mode 100644 index 000000000..c942c51ec --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_selected.svg @@ -0,0 +1,9 @@ + + + icon_文本工具_斜体_selected + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_normal.svg new file mode 100644 index 000000000..377791ff1 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_normal.svg @@ -0,0 +1,7 @@ + + + icon_文本工具_下划线_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_selected.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_selected.svg new file mode 100644 index 000000000..35df2737d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_selected.svg @@ -0,0 +1,7 @@ + + + icon_文本工具_下划线_selected + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/noborder_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/noborder_normal.svg new file mode 100644 index 000000000..f91b02e10 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/noborder_normal.svg @@ -0,0 +1,7 @@ + + + icon_边框_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/bias_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/bias_disabled.svg new file mode 100644 index 000000000..68d174f00 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/bias_disabled.svg @@ -0,0 +1,7 @@ + + + icon_斜线_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/bias_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/bias_normal.svg new file mode 100644 index 000000000..d7cfbd261 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/bias_normal.svg @@ -0,0 +1,7 @@ + + + icon_斜线_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_disabled.svg new file mode 100644 index 000000000..9e883967b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_disabled.svg @@ -0,0 +1,7 @@ + + + icon_插入数据列_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_normal.svg new file mode 100644 index 000000000..2f6c20966 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_normal.svg @@ -0,0 +1,7 @@ + + + icon_插入数据列_nomal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/chart_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/chart_disabled.svg new file mode 100644 index 000000000..9e178473a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/chart_disabled.svg @@ -0,0 +1,7 @@ + + + icon_图表_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/chart_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/chart_normal.svg new file mode 100644 index 000000000..434600201 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/chart_normal.svg @@ -0,0 +1,7 @@ + + + icon_图表_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/floatPop_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/floatPop_normal.svg new file mode 100644 index 000000000..6098d54ff --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/floatPop_normal.svg @@ -0,0 +1,9 @@ + + + icon_悬浮元素&三角_normal + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/formula_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/formula_disabled.svg new file mode 100644 index 000000000..f7070f3d0 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/formula_disabled.svg @@ -0,0 +1,7 @@ + + + icon_公式_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/formula_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/formula_normal.svg new file mode 100644 index 000000000..de9f4effd --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/formula_normal.svg @@ -0,0 +1,7 @@ + + + icon_公式_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/image_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/image_disabled.svg new file mode 100644 index 000000000..d1e0811d3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/image_disabled.svg @@ -0,0 +1,12 @@ + + + icon_图片__disabled + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/image_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/image_normal.svg new file mode 100644 index 000000000..510537126 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/image_normal.svg @@ -0,0 +1,10 @@ + + + icon_图片_normal + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_disabled.svg new file mode 100644 index 000000000..5951896bb --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_disabled.svg @@ -0,0 +1,7 @@ + + + icon_富文本_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_normal.svg new file mode 100644 index 000000000..fa017a755 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_normal.svg @@ -0,0 +1,7 @@ + + + icon_富文本_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_disabled.svg new file mode 100644 index 000000000..02889deb4 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_disabled.svg @@ -0,0 +1,12 @@ + + + icon_子报表_disabled + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_normal.svg new file mode 100644 index 000000000..37ba3195d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_normal.svg @@ -0,0 +1,10 @@ + + + icon_子报表_normal + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/text_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/text_disabled.svg new file mode 100644 index 000000000..9f66f8834 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/text_disabled.svg @@ -0,0 +1,7 @@ + + + icon_普通文本_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/text_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/text_normal.svg new file mode 100644 index 000000000..4673b661d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/text_normal.svg @@ -0,0 +1,7 @@ + + + icon_普通文本_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/delete_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/delete_disabled.svg index 93b0f0302..bc72176ba 100644 --- a/designer-base/src/main/resources/com/fr/design/images/m_report/delete_disabled.svg +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/delete_disabled.svg @@ -1,7 +1,7 @@ - icon_关闭_normal - + icon_关闭_disabled + \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java b/designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java index 8a93bb227..22b17f012 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java @@ -1,7 +1,7 @@ package com.fr.design.actions.cell; -import com.fr.base.BaseUtils; import com.fr.base.CellBorderStyle; +import com.fr.base.svg.SVGIcon; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; @@ -35,9 +35,9 @@ import java.awt.event.MouseEvent; /** * 这个Pane用来显示常用边框和设置自定义边框 - * + * * @author richer - * + * */ public class UIToolbarBorderButton extends UICombinationButton implements PopupHider { private EventListenerList styleChangeListenerList = new EventListenerList(); @@ -46,7 +46,7 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH private JPopupMenu popupWin; public UIToolbarBorderButton(Icon icon, ElementCasePane reportPane) { - super(new UIButton(icon), new UIButton(BaseUtils.readIcon("/com/fr/design/images/gui/popup.gif"))); + super(new UIButton(icon), new UIButton(SVGIcon.readSVGIcon("/com/fr/design/images/gui/popup_normal.svg"))); this.reportPane = reportPane; } @@ -80,7 +80,7 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH rightButton.setToolTipText(tooltipText); } - + private void showPopupMenu() { if (popupWin != null && popupWin.isVisible()) { hidePopupMenu(); @@ -102,12 +102,12 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH return popupWin; } - + protected void leftButtonClickEvent() { UIToolbarBorderButton.this.cellBorderStyle = ((BorderIcon)getLeftButton().getIcon()).cellBorderStyle; UIToolbarBorderButton.this.fireStyleStateChanged(); } - + @Override protected void rightButtonClickEvent() { showPopupMenu(); @@ -223,7 +223,7 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"); } } - + /** * Adds a new StyleChangeListener */ @@ -237,9 +237,9 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH public void removeColorChangeListener(ChangeListener changeListener) { styleChangeListenerList.remove(ChangeListener.class, changeListener); } - + /** - * + * */ public void fireStyleStateChanged() { Object[] listeners = styleChangeListenerList.getListenerList(); @@ -254,7 +254,7 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH } } } - + public boolean isCanBeNull() { return this.isCanBeNull; } diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java index 8dab29a0d..baa7db840 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java @@ -3,6 +3,7 @@ package com.fr.design.actions.cell.style; import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.chart.BaseChartCollection; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.ButtonGroupAction; import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.constants.UIConstants; @@ -21,9 +22,9 @@ import javax.swing.*; public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface { private static final Icon[][] ICONS = new Icon[][]{ - {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png")}, - {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png")}, - {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png")}}; + {SVGIcon.readSVGIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.svg"), SVGIcon.readSVGIcon("/com/fr/design/images/m_format/cellstyle/h_left_selected.svg")}, + {SVGIcon.readSVGIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.svg"), SVGIcon.readSVGIcon("/com/fr/design/images/m_format/cellstyle/h_center_selected.svg")}, + {SVGIcon.readSVGIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.svg"), SVGIcon.readSVGIcon("/com/fr/design/images/m_format/cellstyle/h_right_selected.svg")}}; private static final Integer[] valueArray = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontBoldAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontBoldAction.java index e819eb6fc..2aa9450bf 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontBoldAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontBoldAction.java @@ -3,9 +3,9 @@ */ package com.fr.design.actions.cell.style; -import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.core.StyleUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.ToggleButtonUpdateAction; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.mainframe.ElementCasePane; @@ -21,7 +21,7 @@ import javax.swing.*; public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction { private UIToggleButton button; protected Style style; - private final static Icon[] ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_white.png")}; + private final static Icon[] ICONS = {SVGIcon.readSVGIcon("/com/fr/design/images/m_format/cellstyle/bold_normal.svg"), SVGIcon.readSVGIcon("/com/fr/design/images/m_format/cellstyle/bold_selected.svg")}; public ReportFontBoldAction(ElementCasePane t) { super(t); @@ -92,4 +92,4 @@ public class ReportFontBoldAction extends AbstractStyleAction implements ToggleB } return button; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontForegroundAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontForegroundAction.java index 1a50b3f53..ab055eb15 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontForegroundAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontForegroundAction.java @@ -6,6 +6,7 @@ package com.fr.design.actions.cell.style; import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.core.StyleUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.core.ActionFactory; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.style.color.UIToolbarColorButton; @@ -50,7 +51,7 @@ public class ReportFontForegroundAction extends AbstractStyleAction implements C public JComponent createToolBarComponent() { Object object = this.getValue(UIToolbarColorButton.class.getName()); if (object == null || !(object instanceof UIToolbarColorButton)) { - UIToolbarColorButton tbButton = new UIToolbarColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); + UIToolbarColorButton tbButton = new UIToolbarColorButton(SVGIcon.readSVGIcon("/com/fr/design/images/gui/color/foreground_normal.svg")); this.putValue(UIToolbarColorButton.class.getName(), tbButton); tbButton.set4Toolbar(); tbButton.setEnabled(this.isEnabled()); @@ -63,4 +64,4 @@ public class ReportFontForegroundAction extends AbstractStyleAction implements C return (JComponent) object; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontItalicAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontItalicAction.java index 765e6d319..b86ef0fa2 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontItalicAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontItalicAction.java @@ -3,9 +3,9 @@ */ package com.fr.design.actions.cell.style; -import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.core.StyleUtils; +import com.fr.base.svg.SVGIcon; import com.fr.general.FRFont; import com.fr.design.mainframe.ElementCasePane; @@ -17,7 +17,7 @@ import javax.swing.*; */ public class ReportFontItalicAction extends ReportFontBoldAction { - private final static Icon[] ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_white.png")}; + private final static Icon[] ICONS = {SVGIcon.readSVGIcon("/com/fr/design/images/m_format/cellstyle/italic_normal.svg"), SVGIcon.readSVGIcon("/com/fr/design/images/m_format/cellstyle/italic_selected.svg")}; public ReportFontItalicAction(ElementCasePane t) { super(t); diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java index d96d22b88..fc7eaf708 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java @@ -3,9 +3,9 @@ */ package com.fr.design.actions.cell.style; -import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.core.StyleUtils; +import com.fr.base.svg.SVGIcon; import com.fr.general.FRFont; import com.fr.design.mainframe.ElementCasePane; @@ -18,7 +18,7 @@ import javax.swing.*; */ public class ReportFontUnderlineAction extends ReportFontBoldAction { - private final static Icon[] ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline_white.png")}; + private final static Icon[] ICONS = {SVGIcon.readSVGIcon("/com/fr/design/images/m_format/cellstyle/underline_normal.svg"), SVGIcon.readSVGIcon("/com/fr/design/images/m_format/cellstyle/underline_selected.svg")}; public ReportFontUnderlineAction(ElementCasePane t) { super(t); @@ -40,4 +40,4 @@ public class ReportFontUnderlineAction extends ReportFontBoldAction { return frFont.getUnderline() != Constants.LINE_NONE; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/StyleBackgroundAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/StyleBackgroundAction.java index 4ce5d2f70..63be52280 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/StyleBackgroundAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/StyleBackgroundAction.java @@ -12,6 +12,7 @@ import javax.swing.event.ChangeListener; import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.background.ColorBackground; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.core.ActionFactory; import com.fr.general.ComparatorUtils; @@ -24,7 +25,7 @@ import com.fr.design.style.color.UIToolbarColorButton; public class StyleBackgroundAction extends AbstractStyleAction implements ChangeListener { public StyleBackgroundAction(ElementCasePane t) { super(t); - + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background")); } @@ -49,7 +50,7 @@ public class StyleBackgroundAction extends AbstractStyleAction implements Change return style; } - + @Override public boolean isFontStye() { return false; @@ -59,7 +60,7 @@ public class StyleBackgroundAction extends AbstractStyleAction implements Change public JComponent createToolBarComponent() { Object object = this.getValue(UIToolbarColorButton.class.getName()); if (object == null || !(object instanceof UIToolbarColorButton)) { - UIToolbarColorButton tbButton = new UIToolbarColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png")); + UIToolbarColorButton tbButton = new UIToolbarColorButton(SVGIcon.readSVGIcon("/com/fr/design/images/gui/color/background_normal.svg")); tbButton.set4Toolbar(); this.putValue(UIToolbarColorButton.class.getName(), tbButton); @@ -74,4 +75,4 @@ public class StyleBackgroundAction extends AbstractStyleAction implements Change return (JComponent) object; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/edit/merge/MergeCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/edit/merge/MergeCellAction.java index a0fc125dc..3f4520651 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/edit/merge/MergeCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/edit/merge/MergeCellAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.edit.merge; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.ElementCaseAction; import com.fr.design.menu.KeySetUtils; import com.fr.design.mainframe.ElementCasePane; @@ -21,7 +21,8 @@ public class MergeCellAction extends ElementCaseAction { this.setMenuKeySet(KeySetUtils.MERGE_CELL); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/merge.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/merge_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/merge_disabled.svg")); } /** @@ -43,4 +44,4 @@ public class MergeCellAction extends ElementCaseAction { this.setEnabled(reportPane.canMergeCell()); } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/edit/merge/UnmergeCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/edit/merge/UnmergeCellAction.java index 42e6a9f4c..c0afc1827 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/edit/merge/UnmergeCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/edit/merge/UnmergeCellAction.java @@ -4,6 +4,7 @@ package com.fr.design.actions.edit.merge; import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.ElementCaseAction; import com.fr.design.menu.KeySetUtils; import com.fr.design.mainframe.ElementCasePane; @@ -20,7 +21,8 @@ public class UnmergeCellAction extends ElementCaseAction { this.setMenuKeySet(KeySetUtils.UNMERGE_CELL); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/unmerge.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/unmerge_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/unmerge_disabled.svg")); } @Override @@ -42,4 +44,4 @@ public class UnmergeCellAction extends ElementCaseAction { return reportPane.unMergeCell(); } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/BiasCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/BiasCellAction.java index a709be937..647608450 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/BiasCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/BiasCellAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.insert.cell; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -30,7 +30,8 @@ public class BiasCellAction extends AbstractCellAction implements WorkBookSuppor this.setMenuKeySet(INSERT_SLOPE_LINE); this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/bias_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/bias_disabled.svg")); } public static final MenuKeySet INSERT_SLOPE_LINE = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ChartCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ChartCellAction.java index 59e2c3e3c..9ab6641c9 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ChartCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ChartCellAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.insert.cell; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; @@ -29,7 +29,8 @@ public class ChartCellAction extends AbstractCellAction implements WorkBookSuppo this.setMenuKeySet(INSERT_CHART); this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/chart_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/chart_disabled.svg")); } public static final MenuKeySet INSERT_CHART = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/DSColumnCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/DSColumnCellAction.java index af0fd6bab..ab53299db 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/DSColumnCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/DSColumnCellAction.java @@ -1,10 +1,10 @@ package com.fr.design.actions.insert.cell; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.dscolumn.DSColumnPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.KeySetUtils; -import com.fr.general.IOUtils; import com.fr.report.cell.cellattr.core.group.DSColumn; public class DSColumnCellAction extends AbstractCellAction implements WorkBookSupportable { @@ -22,11 +22,12 @@ public class DSColumnCellAction extends AbstractCellAction implements WorkBookSu this.setMenuKeySet(KeySetUtils.INSERT_DATA_COLUMN); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/bindColumn_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/bindColumn_disabled.svg")); } @Override public Class getCellValueClass() { return DSColumn.class; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/FormulaCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/FormulaCellAction.java index 733045b20..4d554fc34 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/FormulaCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/FormulaCellAction.java @@ -4,7 +4,7 @@ package com.fr.design.actions.insert.cell; import com.fr.base.BaseFormula; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -26,7 +26,8 @@ public class FormulaCellAction extends AbstractCellAction implements WorkBookSup this.setMenuKeySet(INSERT_FORMULA); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/formula_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/formula_disabled.svg")); } public static final MenuKeySet INSERT_FORMULA = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/GeneralCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/GeneralCellAction.java index 402c7ead1..3a096c285 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/GeneralCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/GeneralCellAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.insert.cell; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -28,7 +28,8 @@ public class GeneralCellAction extends AbstractCellAction implements WorkBookSup this.setMenuKeySet(INSERT_TEXT); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/text.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/text_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/text_disabled.svg")); } public static final MenuKeySet INSERT_TEXT = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ImageCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ImageCellAction.java index 68b64f293..99639ae29 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ImageCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ImageCellAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.insert.cell; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -29,7 +29,8 @@ public class ImageCellAction extends AbstractCellAction implements WorkBookSuppo this.setMenuKeySet(INSERT_IMAGE); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/image_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/image_disabled.svg")); } public static final MenuKeySet INSERT_IMAGE = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/RichTextCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/RichTextCellAction.java index cf266f82a..afbfe85ad 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/RichTextCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/RichTextCellAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.insert.cell; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -25,8 +25,8 @@ public class RichTextCellAction extends AbstractCellAction implements WorkBookSu this.setMenuKeySet(INSERT_RICHTEXT); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon( - "/com/fr/design/images/m_insert/richtext.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/richtext_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/richtext_disabled.svg")); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/SubReportCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/SubReportCellAction.java index 0d572fe84..5959eb5e5 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/SubReportCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/SubReportCellAction.java @@ -1,6 +1,7 @@ package com.fr.design.actions.insert.cell; import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; import com.fr.general.ComparatorUtils; @@ -24,8 +25,8 @@ public class SubReportCellAction extends AbstractCellAction { this.setMenuKeySet(INSERT_SUB_REPORT); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon( - "/com/fr/design/images/m_insert/subReport.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/subReport_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/subReport_disabled.svg")); } public static final MenuKeySet INSERT_SUB_REPORT = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java index 1d1e07c62..7d6654d3e 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java @@ -3,10 +3,10 @@ */ package com.fr.design.actions.insert.flot; -import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; import com.fr.base.Style; import com.fr.base.chart.BaseChartCollection; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.ElementCaseAction; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.file.HistoryTemplateListPane; @@ -48,7 +48,7 @@ public class ChartFloatAction extends ElementCaseAction { this.setMenuKeySet(FLOAT_INSERT_CHART); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/chart_normal.svg")); } public static final MenuKeySet FLOAT_INSERT_CHART = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java index 0c97ee61b..9f0852718 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java @@ -4,8 +4,8 @@ package com.fr.design.actions.insert.flot; import com.fr.base.BaseFormula; -import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.ElementCaseAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -37,7 +37,7 @@ public class FormulaFloatAction extends ElementCaseAction { this.setMenuKeySet(FLOAT_INSERT_FORMULA); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/formula_normal.svg")); } public static final MenuKeySet FLOAT_INSERT_FORMULA = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java index d7f98a212..c21e2a11e 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java @@ -5,6 +5,7 @@ package com.fr.design.actions.insert.flot; import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.ElementCaseAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -39,7 +40,7 @@ public class ImageFloatAction extends ElementCaseAction { this.setMenuKeySet(FLOAT_INSERT_IMAGE); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/image_normal.svg")); } public static final MenuKeySet FLOAT_INSERT_IMAGE = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java index 0803092ba..cd23ad8e5 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java @@ -3,8 +3,8 @@ */ package com.fr.design.actions.insert.flot; -import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; +import com.fr.base.svg.SVGIcon; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -28,7 +28,7 @@ public class TextBoxFloatAction extends AbstractShapeAction { this.setMenuKeySet(FLOAT_INSERT_TEXT); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/text.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_insert/text_normal.svg")); } public static final MenuKeySet FLOAT_INSERT_TEXT = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index 9fc0b7b52..cdbdd6ca7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -8,6 +8,7 @@ import com.fr.base.DynamicUnitList; import com.fr.base.Formula; import com.fr.base.ScreenResolution; import com.fr.base.Style; +import com.fr.base.svg.SVGIcon; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; @@ -655,7 +656,7 @@ public abstract class ElementCasePane extends Tar return false; } Object clipObject = getClipObject(); - //如果是悬浮元素,则不允许粘贴到表单 + //如果是悬浮元素,则不允许粘贴到表单 if (!DesignerContext.getDesignerFrame().getSelectedJTemplate().accept(clipObject)) { return false; } @@ -1330,7 +1331,7 @@ public abstract class ElementCasePane extends Tar MenuDef insertFloatMenu = new MenuDef(); insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName()); insertFloatMenu.setTooltip(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_T_Insert_Float")); - insertFloatMenu.setIconPath("/com/fr/design/images/m_insert/floatPop.png"); + insertFloatMenu.setIconPath("/com/fr/design/images/m_insert/floatPop_normal.svg", true); UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, this); for (int i = 0; i < actions.length; i++) { diff --git a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java index 3fddca218..8a33bbad1 100644 --- a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java +++ b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java @@ -81,6 +81,7 @@ public class ImagePreLoader { "com/fr/design/images/buttonicon/anas.png", "com/fr/design/images/buttonicon/refresh.png", "com/fr/design/images/gui/color/foreground.png", + "com/fr/design/images/gui/color/foreground_normal.svg", "com/fr/design/images/buttonicon/history.png", "com/fr/design/images/m_file/close.png", "com/fr/design/images/m_file/edit.png", @@ -182,6 +183,8 @@ public class ImagePreLoader { "com/fr/design/images/control/down.png", "com/fr/design/images/control/sortAsc.png", "com/fr/design/images/m_insert/formula.png", + "com/fr/design/images/m_insert/formula_normal.svg", + "com/fr/design/images/m_insert/formula_disabled.svg", "com/fr/design/images/calender/year_reduce.png", "com/fr/design/images/calender/year_reduce_hover.png", "com/fr/design/images/calender/year_reduce_click.png", @@ -273,8 +276,14 @@ public class ImagePreLoader { "com/fr/design/images/expand/asc_selected.png", "com/fr/design/images/expand/des_selected.png", "com/fr/design/images/m_format/cellstyle/bold.png", + "com/fr/design/images/m_format/cellstyle/bold_normal.svg", + "com/fr/design/images/m_format/cellstyle/bold_selected.svg", "com/fr/design/images/m_format/cellstyle/italic.png", + "com/fr/design/images/m_format/cellstyle/italic_normal.svg", + "com/fr/design/images/m_format/cellstyle/italic_selected.svg", "com/fr/design/images/m_format/cellstyle/underline.png", + "com/fr/design/images/m_format/cellstyle/underline_normal.svg", + "com/fr/design/images/m_format/cellstyle/underline_selected.svg", "com/fr/design/images/m_format/cellstyle/strikethrough.png", "com/fr/design/images/m_format/cellstyle/shadow.png", "com/fr/design/images/m_format/cellstyle/sup.png", @@ -297,10 +306,16 @@ public class ImagePreLoader { "com/fr/design/images/m_format/cellstyle/in_white.png", "com/fr/design/images/m_format/cellstyle/h_left_normal.png", "com/fr/design/images/m_format/cellstyle/h_left_normal_white.png", + "com/fr/design/images/m_format/cellstyle/h_left_normal.svg", + "com/fr/design/images/m_format/cellstyle/h_left_selected.svg", "com/fr/design/images/m_format/cellstyle/h_center_normal.png", "com/fr/design/images/m_format/cellstyle/h_center_normal_white.png", + "com/fr/design/images/m_format/cellstyle/h_center_normal.svg", + "com/fr/design/images/m_format/cellstyle/h_center_selected.svg", "com/fr/design/images/m_format/cellstyle/h_right_normal.png", "com/fr/design/images/m_format/cellstyle/h_right_normal_white.png", + "com/fr/design/images/m_format/cellstyle/h_right_normal.svg", + "com/fr/design/images/m_format/cellstyle/h_right_selected.svg", "com/fr/design/images/m_format/cellstyle/h_s_normal.png", "com/fr/design/images/m_format/cellstyle/h_s_normal_white.png", "com/fr/design/images/m_format/cellstyle/defaultAlignment.png", @@ -340,13 +355,27 @@ public class ImagePreLoader { "com/fr/design/images/m_report/reportEngineAttr.png", "com/fr/design/images/m_report/allow_authority_edit.png", "com/fr/design/images/m_insert/bindColumn.png", + "com/fr/design/images/m_insert/bindColumn_normal.svg", + "com/fr/design/images/m_insert/bindColumn_disabled.svg", "com/fr/design/images/m_insert/text.png", + "com/fr/design/images/m_insert/text_normal.svg", + "com/fr/design/images/m_insert/text_disabled.svg", "com/fr/design/images/m_insert/richtext.png", + "com/fr/design/images/m_insert/richtext_normal.svg", + "com/fr/design/images/m_insert/richtext_disabled.svg", "com/fr/design/images/m_insert/chart.png", + "com/fr/design/images/m_insert/chart_normal.svg", + "com/fr/design/images/m_insert/chart_disabled.svg", "com/fr/design/images/m_insert/image.png", + "com/fr/design/images/m_insert/image_normal.svg", + "com/fr/design/images/m_insert/image_disabled.svg", "com/fr/design/images/m_insert/bias.png", + "/com/fr/design/images/m_insert/bias_normal.svg", + "/com/fr/design/images/m_insert/bias_disabled.svg", "com/fr/design/images/arrow/arrow_up.png", "com/fr/design/images/m_insert/subReport.png", + "com/fr/design/images/m_insert/subReport_normal.svg", + "com/fr/design/images/m_insert/subReport_disabled.svg", "com/fr/design/images/arrow/arrow_down.png", "com/fr/design/images/toolbarbtn/toolbarbtnsetting.png", "com/fr/design/images/control/addPopup.png", @@ -360,8 +389,12 @@ public class ImagePreLoader { "com/fr/design/images/m_insert/hyperLink.png", "com/fr/web/images/flashPrint.png", "com/fr/design/images/m_edit/merge.png", + "com/fr/design/images/m_edit/merge_normal.svg", + "com/fr/design/images/m_edit/merge_disabled.svg", "com/fr/web/images/appletPrint.png", "com/fr/design/images/m_edit/unmerge.png", + "com/fr/design/images/m_edit/unmerge_normal.svg", + "com/fr/design/images/m_edit/unmerge_disabled.svg", "com/fr/web/images/pdf.png", "com/fr/design/images/m_format/cellAttr.png", "com/fr/web/images/pdfPrint.png", @@ -397,14 +430,18 @@ public class ImagePreLoader { "com/fr/design/images/m_insert/cell.png", "com/fr/design/images/m_insert/float.png", "com/fr/design/images/gui/color/background.png", + "com/fr/design/images/gui/color/background_normal.svg", "com/fr/design/images/m_format/cell.png", "com/fr/design/images/data/source/dataDictionary.png", "com/fr/design/images/m_format/cellstyle/bold_white.png", "com/fr/design/images/m_format/cellstyle/italic_white.png", "com/fr/design/images/m_format/cellstyle/underline_white.png", "com/fr/design/images/m_format/noboder.png", + "com/fr/design/images/m_format/noborder_normal.svg", "com/fr/design/images/gui/popup.gif", + "com/fr/design/images/gui/popup_normal.svg", "com/fr/design/images/m_insert/floatPop.png", + "com/fr/design/images/m_insert/floatPop_normal.svg", "com/fr/web/images/platform/demo.png", "com/fr/base/images/dialog/pagesetup/down.png", "com/fr/base/images/dialog/pagesetup/over.png", From 5f31ca615f89f2157988169761a7bb1eb13b8f32 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 18 Dec 2020 19:26:48 +0800 Subject: [PATCH 018/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.5:?= =?UTF-8?q?=20=E8=AF=AF=E4=BC=A0patch=EF=BC=8C=E5=88=A0=E9=99=A4=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0001-REPORT-42238-10.0.13-JDK11.patch | 110 -------------------------- 1 file changed, 110 deletions(-) delete mode 100644 0001-REPORT-42238-10.0.13-JDK11.patch diff --git a/0001-REPORT-42238-10.0.13-JDK11.patch b/0001-REPORT-42238-10.0.13-JDK11.patch deleted file mode 100644 index f17452d9d..000000000 --- a/0001-REPORT-42238-10.0.13-JDK11.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 1df5af6bc3c3b9f6223b569479b3ca520a746561 Mon Sep 17 00:00:00 2001 -From: Yvan -Date: Fri, 18 Dec 2020 09:49:13 +0800 -Subject: [PATCH] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13=E3=80=91JDK11?= - =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87=E6=A8=A1=E7=B3=8A?= - =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.2:=E6=8F=90=E4=BA=A4U?= - =?UTF-8?q?pdateAction?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- - .../com/fr/design/actions/UpdateAction.java | 41 ++++++++++++++++++- - 1 file changed, 40 insertions(+), 1 deletion(-) - -diff --git a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java -index 4fd7e6c42..c284b9d56 100644 ---- a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java -+++ b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java -@@ -78,6 +78,16 @@ public abstract class UpdateAction extends ShortCut implements Action { - - private String searchText = StringUtils.EMPTY; - -+ /** -+ * 按钮在按压状态的图标key -+ */ -+ public static final String PRESSED_ICON = "pressedIcon"; -+ -+ /** -+ * 按钮在灰化状态的图标key -+ */ -+ public static final String DISABLED_ICON = "disabledIcon"; -+ - - - /** -@@ -251,6 +261,14 @@ public abstract class UpdateAction extends ShortCut implements Action { - - } - -+ public void setPressedIcon(Icon pressedIcon) { -+ this.putValue(UpdateAction.PRESSED_ICON, pressedIcon); -+ } -+ -+ public void setDisabledIcon(Icon disabledIcon) { -+ this.putValue(UpdateAction.DISABLED_ICON, disabledIcon); -+ } -+ - @Override - public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { - -@@ -271,6 +289,8 @@ public abstract class UpdateAction extends ShortCut implements Action { - UIMenuItem menuItem = new UIMenuItem(this); - // 设置名字用作单元测 - menuItem.setName(getName()); -+ setPressedIcon4Button(menuItem); -+ setDisabledIcon4Button(menuItem); - object = menuItem; - - this.putValue(UIMenuItem.class.getName(), object); -@@ -282,6 +302,8 @@ public abstract class UpdateAction extends ShortCut implements Action { - UIMenuEastAttrItem menuItem = new UIMenuEastAttrItem(this); - // 设置名字用作单元测 - menuItem.setName(getName()); -+ setPressedIcon4Button(menuItem); -+ setDisabledIcon4Button(menuItem); - this.putValue(UIMenuItem.class.getName(), menuItem); - return menuItem; - } -@@ -307,6 +329,8 @@ public abstract class UpdateAction extends ShortCut implements Action { - } - - button.setIcon((Icon) this.getValue(Action.SMALL_ICON)); -+ setPressedIcon4Button(button); -+ setDisabledIcon4Button(button); - button.addActionListener(this); - - button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); -@@ -454,6 +478,8 @@ public abstract class UpdateAction extends ShortCut implements Action { - object = new UseMenuItem(this); - this.putValue(UseMenuItem.class.getName(), object); - } -+ setPressedIcon4Button((UseMenuItem) object); -+ setDisabledIcon4Button((UseMenuItem) object); - return (UseMenuItem) object; - } - -@@ -594,4 +620,17 @@ public abstract class UpdateAction extends ShortCut implements Action { - shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator); - } - --} -\ No newline at end of file -+ private void setPressedIcon4Button(AbstractButton button) { -+ Icon pressedIcon = (Icon) this.getValue(UpdateAction.PRESSED_ICON); -+ if (pressedIcon != null) { -+ button.setPressedIcon(pressedIcon); -+ } -+ } -+ -+ private void setDisabledIcon4Button(AbstractButton button) { -+ Icon disabledIcon = (Icon) this.getValue(UpdateAction.DISABLED_ICON); -+ if (disabledIcon != null) { -+ button.setDisabledIcon(disabledIcon); -+ } -+ } -+} --- -2.24.1 - From 21333e56125c07dfaed4d0464e79163bd202db86 Mon Sep 17 00:00:00 2001 From: Yvan Date: Sun, 20 Dec 2020 22:13:41 +0800 Subject: [PATCH 019/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.6?= =?UTF-8?q?=20:=E6=9B=BF=E6=8D=A2=E4=BA=86=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8-=E5=B7=A5=E5=85=B7=E6=A0=8F=EF=BC=8C=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=99=AE=E9=80=9A=E6=8A=A5=E8=A1=A8=20&&=20=E8=81=9A?= =?UTF-8?q?=E5=90=88=E6=8A=A5=E8=A1=A8=EF=BC=8C=E7=BC=96=E8=BE=91=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=9D=A2=E6=9D=BF=E6=97=B6=E7=9A=84=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=A0=8F=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/core/WidgetOption.java | 29 ++++++++++--------- .../buttonicon/absolute_layout_normal.svg | 7 +++++ .../buttonicon/card_layout_16_normal.svg | 7 +++++ .../images/buttonicon/report_16_normal.svg | 10 +++++++ .../buttonicon/widget/button_16_normal.svg | 7 +++++ .../widget/button_group_16_normal.svg | 7 +++++ .../buttonicon/widget/check_box_16_normal.svg | 7 +++++ .../widget/checkbox_group_16_normal.svg | 7 +++++ .../buttonicon/widget/combo_box_16_normal.svg | 7 +++++ .../widget/combo_box_tree_16_normal.svg | 7 +++++ .../widget/combo_check_16_normal.svg | 7 +++++ .../buttonicon/widget/date_16_normal.svg | 7 +++++ .../buttonicon/widget/label_16_normal.svg | 7 +++++ .../widget/number_field_16_normal.svg | 7 +++++ .../widget/password_field_16_normal.svg | 8 +++++ .../buttonicon/widget/text_area_16_normal.svg | 7 +++++ .../widget/text_field_16_normal.svg | 7 +++++ .../buttonicon/widget/tree_16_normal.svg | 7 +++++ .../form/parameter/FormParaTargetMode.java | 6 ++-- .../fr/design/gui/core/FormWidgetOption.java | 15 +++++----- .../design/mainframe/FormParaWidgetPane.java | 3 +- .../fr/design/mainframe/FormTargetMode.java | 8 ++--- .../com/fr/start/preload/ImagePreLoader.java | 15 ++++++++++ 23 files changed, 170 insertions(+), 29 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/absolute_layout_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/card_layout_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/report_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_group_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/check_box_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_box_tree_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/date_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/label_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/number_field_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/password_field_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_area_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_field_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/tree_16_normal.svg diff --git a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java index e3bf61e9d..a6eedfc20 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java @@ -1,6 +1,7 @@ package com.fr.design.gui.core; import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.form.ui.*; import com.fr.general.ComparatorUtils; @@ -127,27 +128,27 @@ public abstract class WidgetOption implements Serializable { } public static final WidgetOption DATEEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Date"), - BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/date_16.png"), + SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/date_16_normal.svg"), DateEditor.class); public static final WidgetOption TREE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_View_Tree"), - BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/tree_16.png"), TreeEditor.class); + SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/tree_16_normal.svg"), TreeEditor.class); - public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_ComboBox"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/comboboxtree.png"), + public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_ComboBox"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/combo_box_tree_16_normal.svg"), TreeComboBoxEditor.class); public static final WidgetOption CHECKBOXGROUP = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox_Group"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/checkbox_group_16.png"), CheckBoxGroup.class); + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox_Group"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg"), CheckBoxGroup.class); public static final WidgetOption RADIOGROUP = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Radio_Group"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_group_16.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Radio_Group"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/button_group_16_normal.svg"), RadioGroup.class); public static final WidgetOption NUMBEREDITOR = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Number"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/number_field_16.png"), NumberEditor.class); + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Number"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/number_field_16_normal.svg"), NumberEditor.class); public static final WidgetOption LABEL = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Label"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/label_16.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Label"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/label_16_normal.svg"), Label.class); public static final WidgetOption BUTTON = WidgetOptionFactory.createByWidgetClass( @@ -155,7 +156,7 @@ public abstract class WidgetOption implements Serializable { Button.class); public static final WidgetOption FREEBUTTON = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Button"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_16.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Button"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/button_16_normal.svg"), FreeButton.class); public static final WidgetOption MULTI_FILEEDITOR = WidgetOptionFactory.createByWidgetClass( @@ -163,15 +164,15 @@ public abstract class WidgetOption implements Serializable { MultiFileEditor.class); public static final WidgetOption COMBOBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Box"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_box_16.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Box"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg"), ComboBox.class); public static final WidgetOption COMBOCHECKBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Checkbox"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_check_16.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Checkbox"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg"), ComboCheckBox.class); public static final WidgetOption CHECKBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/check_box_16.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/check_box_16_normal.svg"), CheckBox.class); public static final WidgetOption LIST = WidgetOptionFactory.createByWidgetClass( @@ -181,16 +182,16 @@ public abstract class WidgetOption implements Serializable { public static final WidgetOption TEXTEDITOR = WidgetOptionFactory.createByWidgetClass( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Text") - , BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_field_16.png"), + , SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/text_field_16_normal.svg"), TextEditor.class); public static final WidgetOption TEXTAREA = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Textarea"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_area_16.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Textarea"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/text_area_16_normal.svg"), TextArea.class); public static final WidgetOption PASSWORD = WidgetOptionFactory.createByWidgetClass( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Password"), - BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/password_field_16.png"), Password.class); + SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/password_field_16_normal.svg"), Password.class); public static final WidgetOption IFRAMEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Form_Iframe"), BaseUtils.readIcon("/com/fr/web/images/form/resources/iframe_16.png"), IframeEditor.class); diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/absolute_layout_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/absolute_layout_normal.svg new file mode 100644 index 000000000..f7cbf331c --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/absolute_layout_normal.svg @@ -0,0 +1,7 @@ + + + icon_绝对画薄块_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/card_layout_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/card_layout_16_normal.svg new file mode 100644 index 000000000..df9499aa0 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/card_layout_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_tab块_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/report_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/report_16_normal.svg new file mode 100644 index 000000000..ba2772495 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/report_16_normal.svg @@ -0,0 +1,10 @@ + + + icon_报表块_normal + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_16_normal.svg new file mode 100644 index 000000000..55601500d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_按钮_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_group_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_group_16_normal.svg new file mode 100644 index 000000000..97d0a7ae8 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_group_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_单选框组_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/check_box_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/check_box_16_normal.svg new file mode 100644 index 000000000..89f848654 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/check_box_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_复选框_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg new file mode 100644 index 000000000..67c95d63e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_复选框组_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg new file mode 100644 index 000000000..f90c2e496 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_下拉框_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_box_tree_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_box_tree_16_normal.svg new file mode 100644 index 000000000..dda6ba788 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_box_tree_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_下拉树_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg new file mode 100644 index 000000000..b491ff55f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_下拉复选框_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/date_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/date_16_normal.svg new file mode 100644 index 000000000..4f8d4437b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/date_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_日期_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/label_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/label_16_normal.svg new file mode 100644 index 000000000..270db542f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/label_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_标签_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/number_field_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/number_field_16_normal.svg new file mode 100644 index 000000000..8384ab70b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/number_field_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_数字_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/password_field_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/password_field_16_normal.svg new file mode 100644 index 000000000..25884c095 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/password_field_16_normal.svg @@ -0,0 +1,8 @@ + + + icon_控件_密码_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_area_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_area_16_normal.svg new file mode 100644 index 000000000..6f57cb809 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_area_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_文本域_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_field_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_field_16_normal.svg new file mode 100644 index 000000000..97089c513 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_field_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_文本框_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/tree_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/tree_16_normal.svg new file mode 100644 index 000000000..bd685702d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/tree_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_目录树_normal + + + + \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java index d39e5620e..ad58ccf35 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java @@ -1,6 +1,6 @@ package com.fr.design.form.parameter; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.properties.WidgetPropertyTable; import com.fr.design.gui.core.WidgetOption; @@ -27,7 +27,7 @@ public class FormParaTargetMode extends FormDesignerModeForSpecial { public WidgetOption[] getPredefinedWidgetOptions() { return new WidgetOption[]{ WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Query_Button"), - BaseUtils.readIcon("/com/fr/web/images/form/resources/preview_16.png"), FormSubmitButton.class)}; + SVGIcon.readSVGIcon("/com/fr/web/images/form/resources/preview_16_normal.svg"), FormSubmitButton.class)}; } public ArrayList createRootDesignerPropertyGroup() { @@ -38,9 +38,9 @@ public class FormTargetMode extends FormDesignerModeForSpecial { public int getMinDesignHeight() { return getTarget().getTarget().getContainer().getMinDesignSize().height; } - + @Override public int getMinDesignWidth() { return getTarget().getTarget().getContainer().getMinDesignSize().width; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java index 8a33bbad1..7e3c0fd61 100644 --- a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java +++ b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java @@ -205,22 +205,36 @@ public class ImagePreLoader { "com/fr/design/images/expand/des.png", "com/fr/design/images/form/toolbar/pie.png", "com/fr/design/images/buttonicon/widget/date_16.png", + "com/fr/design/images/buttonicon/widget/date_16_normal.svg", "com/fr/design/images/buttonicon/widget/tree_16.png", + "com/fr/design/images/buttonicon/widget/tree_16_normal.svg", "com/fr/design/images/buttonicon/widget/comboboxtree.png", + "com/fr/design/images/buttonicon/widget/combo_box_tree_16_normal.svg", "com/fr/design/images/buttonicon/widget/checkbox_group_16.png", + "com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg", "com/fr/design/images/buttonicon/widget/button_group_16.png", + "com/fr/design/images/buttonicon/widget/button_group_16_normal.svg", "com/fr/design/images/buttonicon/widget/number_field_16.png", + "com/fr/design/images/buttonicon/widget/number_field_16_normal.svg", "com/fr/design/images/buttonicon/widget/label_16.png", + "com/fr/design/images/buttonicon/widget/label_16_normal.svg", "com/fr/web/images/form/resources/button_16.png", "com/fr/design/images/buttonicon/widget/button_16.png", + "com/fr/design/images/buttonicon/widget/button_16_normal.svg", "com/fr/design/images/buttonicon/widget/files_up.png", "com/fr/design/images/buttonicon/widget/combo_box_16.png", + "com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg", "com/fr/design/images/buttonicon/widget/combo_check_16.png", + "com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg", "com/fr/design/images/buttonicon/widget/check_box_16.png", + "com/fr/design/images/buttonicon/widget/check_box_16_normal.svg", "com/fr/web/images/form/resources/list_16.png", "com/fr/design/images/buttonicon/widget/text_field_16.png", + "com/fr/design/images/buttonicon/widget/text_field_16_normal.svg", "com/fr/design/images/buttonicon/widget/text_area_16.png", + "com/fr/design/images/buttonicon/widget/text_area_16_normal.svg", "com/fr/design/images/buttonicon/widget/password_field_16.png", + "com/fr/design/images/buttonicon/widget/password_field_16_normal.svg", "com/fr/web/images/form/resources/iframe_16.png", "com/fr/design/images/form/toolbar/column.png", "com/fr/design/images/form/toolbar/bar.png", @@ -385,6 +399,7 @@ public class ImagePreLoader { "com/fr/design/images/m_format/modified.png", "com/fr/design/images/m_format/highlight.png", "com/fr/web/images/form/resources/preview_16.png", + "com/fr/web/images/form/resources/preview_16_normal.svg", "com/fr/web/images/save.png", "com/fr/design/images/m_insert/hyperLink.png", "com/fr/web/images/flashPrint.png", From 553c1c827d044f884b55b67db78cfb025793b649 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 21 Dec 2020 09:56:30 +0800 Subject: [PATCH 020/147] =?UTF-8?q?=E5=BC=80=E5=8F=91=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=AD=97=E6=AE=B5=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 44 +++++- .../richText/VanChartFieldAddPane.java | 124 +++++++++++++++ .../richText/VanChartFieldGroupPane.java | 115 ++++++++++++++ .../richText/VanChartFieldListener.java | 15 ++ .../VanChartRichEditorPane.java | 2 +- .../VanChartRichTextDialog.java} | 8 +- .../richText/VanChartRichTextPane.java | 144 ++++++++++++++++++ 7 files changed, 441 insertions(+), 11 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAddPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java rename designer-chart/src/main/java/com/fr/van/chart/designer/component/{ => richText}/VanChartRichEditorPane.java (99%) rename designer-chart/src/main/java/com/fr/van/chart/designer/component/{VanChartRichEditorDialog.java => richText/VanChartRichTextDialog.java} (73%) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index b5f03a728..b6e768e34 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -2,6 +2,7 @@ package com.fr.van.chart.designer.component; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -32,7 +33,11 @@ import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; +import com.fr.van.chart.designer.component.richText.VanChartRichTextDialog; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; +import org.nfunk.jep.function.Str; import javax.swing.JComponent; import javax.swing.JPanel; @@ -45,6 +50,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; /** * 数据点提示内容界面,含有通用设置、富文本编辑器、自定义JS界面 @@ -437,24 +444,27 @@ public class VanChartTooltipContentPane extends BasicBeanPane pane = VanChartRichEditorPane.createRichEditorPane(richText); - BasicDialog dialog = new VanChartRichEditorDialog(DesignerContext.getDesignerFrame(), pane); + final ModernUIPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - pane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); + BasicPane panel = new VanChartRichTextPane(parent, getDefaultFieldNames(), getTableFieldNames(), richEditorPane); + + BasicDialog dialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), panel); + + richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); dialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { - VanChartRichEditorPane.RichEditorModel model = pane.update(); + VanChartRichEditorPane.RichEditorModel model = richEditorPane.update(); String content = model.getContent(); updateLocalRichText(content, model.isAuto()); - SwingUtilities.getWindowAncestor(pane).setVisible(false); + SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false); } public void doCancel() { - SwingUtilities.getWindowAncestor(pane).setVisible(false); + SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false); } }); @@ -465,6 +475,28 @@ public class VanChartTooltipContentPane extends BasicBeanPane getDefaultFieldNames() { + List fieldNames = new ArrayList<>(); + + fieldNames.add("分类"); + fieldNames.add("系列"); + fieldNames.add("值"); + fieldNames.add("百分比"); + + return fieldNames; + } + + private List getTableFieldNames() { + List fieldNames = new ArrayList<>(); + + fieldNames.add("字段A"); + fieldNames.add("字段B"); + fieldNames.add("字段C"); + fieldNames.add("字段D"); + + return fieldNames; + } + private JPanel createHtmlPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAddPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAddPane.java new file mode 100644 index 000000000..dd34a2a7f --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAddPane.java @@ -0,0 +1,124 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.base.BaseUtils; +import com.fr.data.util.function.DataFunction; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.Icon; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.text.Format; + +public class VanChartFieldAddPane extends JPanel { + + private static final Icon ADD_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"); + + private static final int W = 200; + private static final int H = 28; + + private UIToggleButton fieldButton; + private UIButton addButton; + + private Format format; + private DataFunction dataFunction; + + private String fieldName; + private boolean showSummary; + + public VanChartFieldAddPane(String fieldName, VanChartFieldListener listener) { + this(fieldName, false, listener); + } + + public VanChartFieldAddPane(String fieldName, boolean showSummary, VanChartFieldListener listener) { + this.fieldName = fieldName; + this.showSummary = showSummary; + + initComponents(fieldName, listener); + + this.setLayout(new BorderLayout()); + this.add(getContentPane(), BorderLayout.CENTER); + } + + public String getFieldName() { + return fieldName; + } + + public Format getFormat() { + return format; + } + + public void setFormat(Format format) { + this.format = format; + } + + public DataFunction getDataFunction() { + return dataFunction; + } + + public void setDataFunction(DataFunction dataFunction) { + this.dataFunction = dataFunction; + } + + public boolean isShowSummary() { + return showSummary; + } + + private void initComponents(String fieldName, VanChartFieldListener listener) { + fieldButton = new UIToggleButton(fieldName) { + + protected MouseListener getMouseListener() { + + return new MouseAdapter() { + public void mousePressed(MouseEvent e) { + setSelected(true); + + listener.refreshSelectedField(fieldName); + listener.setGlobalName(fieldName); + } + }; + } + }; + + addButton = new UIButton(ADD_ICON); + + addButton.addMouseListener(new MouseAdapter() { + + public void mousePressed(MouseEvent e) { + super.mousePressed(e); + + listener.addSelectedField(fieldName); + } + }); + } + + private JPanel getContentPane() { + Component[][] components = new Component[][]{ + new Component[]{fieldButton, addButton} + }; + + double p = TableLayout.PREFERRED; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; + + double[] rowSize = {p}; + double[] columnSize = {e, d}; + + JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 5, 0); + content.setPreferredSize(new Dimension(W, H)); + + return content; + } + + public void setSelectedState(boolean selected) { + fieldButton.setSelected(selected); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java new file mode 100644 index 000000000..5e80aa78c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java @@ -0,0 +1,115 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.general.ComparatorUtils; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.util.ArrayList; +import java.util.List; + +public class VanChartFieldGroupPane extends JPanel { + + private static final int FIELD_ADD_W = 400; + private static final int FIELD_ADD_H = 28; + + private List defaultFieldNameList; + private List tableFieldNameList; + + private List defaultFieldPaneList = new ArrayList<>(); + private List tableFieldPaneList = new ArrayList<>(); + + private VanChartFieldListener fieldListener; + + public VanChartFieldGroupPane(List defaultFieldNameList, List tableFieldNameList) { + this.defaultFieldNameList = defaultFieldNameList; + this.tableFieldNameList = tableFieldNameList; + + initFieldListener(); + + this.setLayout(new BorderLayout()); + + this.add(createDefaultFieldPane(), BorderLayout.CENTER); + this.add(createTableFieldPane(), BorderLayout.SOUTH); + } + + private JPanel createDefaultFieldPane() { + JPanel defaultField = new JPanel(); + + defaultField.setLayout(new GridLayout(0, 1, 1, 0)); + + for (String title : defaultFieldNameList) { + VanChartFieldAddPane fieldAddPane = new VanChartFieldAddPane(title, fieldListener); + + defaultField.add(fieldAddPane); + defaultFieldPaneList.add(fieldAddPane); + } + + defaultField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldNameList.size() * FIELD_ADD_H)); + defaultField.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); + + return defaultField; + } + + private JPanel createTableFieldPane() { + JPanel tableField = new JPanel(); + + tableField.setLayout(new GridLayout(0, 1, 1, 0)); + + for (String title : tableFieldNameList) { + VanChartFieldAddPane fieldAddPane = new VanChartFieldAddPane(title, fieldListener); + + tableField.add(fieldAddPane); + tableFieldPaneList.add(fieldAddPane); + } + + tableField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldNameList.size() * FIELD_ADD_H)); + + return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); + } + + private void initFieldListener() { + + fieldListener = new VanChartFieldListener() { + + private String fieldName; + + public void setGlobalName(String fieldName) { + this.fieldName = fieldName; + } + + public String getGlobalName() { + return this.fieldName; + } + + public void refreshSelectedField(String fieldName) { + if (ComparatorUtils.equals(fieldName, this.fieldName)) { + return; + } + + for (VanChartFieldAddPane fieldAddPane : defaultFieldPaneList) { + fieldAddPane.setSelectedState(ComparatorUtils.equals(fieldAddPane.getFieldName(), fieldName)); + } + + for (VanChartFieldAddPane fieldAddPane : tableFieldPaneList) { + fieldAddPane.setSelectedState(ComparatorUtils.equals(fieldAddPane.getFieldName(), fieldName)); + } + } + + public void addSelectedField(String fieldName) { + System.out.println(fieldName); + } + + public void populateFieldFormatPane() { + + } + + public void updateFieldFormatPane() { + + } + }; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java new file mode 100644 index 000000000..738492d67 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java @@ -0,0 +1,15 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.design.event.GlobalNameListener; + +public interface VanChartFieldListener extends GlobalNameListener { + + public void refreshSelectedField(String fieldName); + + public void addSelectedField(String fieldName); + + public void populateFieldFormatPane(); + + public void updateFieldFormatPane(); + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java similarity index 99% rename from designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java rename to designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java index 6f308ad43..66453a157 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java @@ -1,4 +1,4 @@ -package com.fr.van.chart.designer.component; +package com.fr.van.chart.designer.component.richText; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java similarity index 73% rename from designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java rename to designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java index a13208df5..2cf7050dc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java @@ -1,4 +1,4 @@ -package com.fr.van.chart.designer.component; +package com.fr.van.chart.designer.component.richText; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; @@ -8,17 +8,17 @@ import com.fr.design.utils.gui.GUICoreUtils; import java.awt.Dimension; import java.awt.Frame; -public class VanChartRichEditorDialog extends BasicDialog { +public class VanChartRichTextDialog extends BasicDialog { public static final Dimension DEFAULT = new Dimension(960, 600); - public VanChartRichEditorDialog(Frame parent, BasicPane pane) { + public VanChartRichTextDialog(Frame parent, BasicPane pane) { super(parent, pane); this.setTitle(Toolkit.i18nText("Fine-Design_Report_RichTextEditor")); this.setBasicDialogSize(DEFAULT); GUICoreUtils.centerWindow(this); - this.setResizable(true); + this.setResizable(false); this.setModal(true); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java new file mode 100644 index 000000000..927fbdaae --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -0,0 +1,144 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.style.FormatPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.stable.StringUtils; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.util.List; + +// 标签提示中的富文本面板,包含字段设置和富文本编辑器 +public class VanChartRichTextPane extends BasicBeanPane { + + private static final int FIELD_PANE_W = 470; + private static final int FIELD_PANE_H = 270; + + private static final int RICH_EDITOR_W = 940; + private static final int RICH_EDITOR_H = 260; + + private static final double P = TableLayout.PREFERRED; + private static final double D = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; + private static final double E = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + + private JScrollPane fieldContentPane; + private JScrollPane fieldPropsPane; + + private FormatPane fieldFormatPane; + private JPanel fieldSummaryPane; + + private UIComboBox fieldSummaryBox; + + private VanChartStylePane parent; + + private List defaultFieldsFormat; + private List tableFieldsFormat; + + public VanChartRichTextPane(VanChartStylePane parent, List defaultFieldsFormat, List tableFieldsFormat, JPanel richEditor) { + this.parent = parent; + + this.defaultFieldsFormat = defaultFieldsFormat; + this.tableFieldsFormat = tableFieldsFormat; + + initFieldContentPane(); + initFieldPropsPane(); + + this.setLayout(new BorderLayout()); + this.add(createFieldDetailPane(), BorderLayout.CENTER); + this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH); + } + + private void initFieldContentPane() { + JPanel content = new JPanel(); + content.setLayout(new BorderLayout()); + content.add(createDefaultContentPane(), BorderLayout.NORTH); + content.add(createTableFieldsPane(), BorderLayout.CENTER); + + fieldContentPane = new JScrollPane(content); + fieldContentPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); + fieldContentPane.setHorizontalScrollBar(null); + fieldContentPane.setBorder(BorderFactory.createTitledBorder("添加字段")); + } + + private void initFieldPropsPane() { + fieldFormatPane = new FormatPaneWithOutFont() { + protected JPanel createContentPane(Component[][] components) { + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{P, P, P}, new double[]{D, E}); + } + }; + + fieldSummaryBox = new CalculateComboBox(); + + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), fieldSummaryBox} + }; + + fieldSummaryPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{P, P}, new double[]{D, E}); + + JPanel props = new JPanel(); + props.setLayout(new BorderLayout()); + props.add(fieldFormatPane, BorderLayout.NORTH); + props.add(fieldSummaryPane, BorderLayout.CENTER); + props.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); + + fieldPropsPane = new JScrollPane(props); + fieldPropsPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); + fieldPropsPane.setBorder(BorderFactory.createTitledBorder("字段设置")); + } + + private JPanel createDefaultContentPane() { + + return new VanChartFieldGroupPane(defaultFieldsFormat, tableFieldsFormat); + } + + private JPanel createTableFieldsPane() { + return new JPanel(); + } + + private JPanel createFieldDetailPane() { + JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + + fieldPane.add(fieldContentPane); + fieldPane.add(fieldPropsPane); + + return fieldPane; + } + + private JPanel createRichEditorPane(JPanel richEditor) { + JPanel richEditorPane = new JPanel(); + + richEditorPane.setLayout(new BorderLayout()); + richEditorPane.setPreferredSize(new Dimension(RICH_EDITOR_W, RICH_EDITOR_H)); + richEditorPane.add(richEditor, BorderLayout.CENTER); + + return richEditorPane; + } + + public void populateBean(AttrTooltipContent ob) { + + } + + public AttrTooltipContent updateBean() { + return null; + } + + protected String title4PopupWindow() { + return StringUtils.EMPTY; + } +} From 6a92562cbc1dd99b08ccf8bd1d9c335e627eb65a Mon Sep 17 00:00:00 2001 From: Yvan Date: Mon, 21 Dec 2020 15:43:46 +0800 Subject: [PATCH 021/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.7:?= =?UTF-8?q?=20=E2=91=A0=E5=9C=A8SVGIcon=E4=B8=AD=E5=AF=B9url=E5=81=9A?= =?UTF-8?q?=E4=BA=86=E5=89=8D=E7=BC=80=E5=A4=84=E7=90=86=EF=BC=8C=E6=9C=89?= =?UTF-8?q?=E4=BA=9Burl=E4=B8=8D=E6=98=AF"/"=E5=BC=80=E5=A4=B4=E7=9A=84?= =?UTF-8?q?=E4=BC=9A=E6=8A=A5npe=EF=BC=9B=E2=91=A1=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E4=BA=86=E5=B7=A6=E4=BE=A7=E9=9D=A2=E6=9D=BF-=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=AE=A1=E7=90=86=E9=9D=A2=E6=9D=BF=E4=B8=8E=E5=B7=A6?= =?UTF-8?q?=E4=BE=A7=E9=9D=A2=E6=9D=BF-=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=9D=A2=E6=9D=BF=E4=B8=AD=E7=9A=84=E5=9B=BE?= =?UTF-8?q?=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/base/svg/SVGIcon.java | 8 ++++++++ .../design/data/BasicTableDataTreePane.java | 6 ++++-- .../data/datapane/TableDataTreePane.java | 8 +++++--- .../com/fr/design/gui/core/WidgetOption.java | 2 +- .../com/fr/design/icon/IconPathConstants.java | 9 +++++++++ .../DesignerFrameFileDealerPane.java | 20 +++++++++++-------- .../mainframe/vcs/common/VcsHelper.java | 3 +++ .../new_folder_disabled.svg | 8 ++++++++ .../FileDealerPaneIcon/new_folder_normal.svg | 8 ++++++++ .../FileDealerPaneIcon/refresh_normal.svg | 7 +++++++ .../FileDealerPaneIcon/remove_disabled.svg | 7 +++++++ .../FileDealerPaneIcon/remove_normal.svg | 7 +++++++ .../FileDealerPaneIcon/rename_disabled.svg | 7 +++++++ .../FileDealerPaneIcon/rename_normal.svg | 7 +++++++ .../FileDealerPaneIcon/vcs_list_disabled.svg | 7 +++++++ .../FileDealerPaneIcon/vcs_list_normal.svg | 7 +++++++ .../view_folder_disabled.svg | 7 +++++++ .../FileDealerPaneIcon/view_folder_normal.svg | 7 +++++++ .../images/buttonicon/prewidget_normal.svg | 8 ++++++++ .../buttonicon/widget/files_up_normal.svg | 7 +++++++ .../images/control/addPopup_disabled.svg | 16 +++++++++++++++ .../design/images/control/addPopup_normal.svg | 14 +++++++++++++ .../design/images/control/edit_disabled.svg | 8 ++++++++ .../fr/design/images/control/edit_normal.svg | 8 ++++++++ .../design/images/control/remove_disabled.svg | 11 ++++++++++ .../design/images/control/remove_normal.svg | 9 +++++++++ .../design/images/m_file/preview_disabled.svg | 11 ++++++++++ .../design/images/m_file/preview_normal.svg | 9 +++++++++ .../design/images/m_web/connection_normal.svg | 11 ++++++++++ .../com/fr/start/preload/ImagePreLoader.java | 13 +++++++++++- 30 files changed, 245 insertions(+), 15 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/prewidget_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/files_up_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/addPopup_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/addPopup_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/edit_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/edit_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/remove_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/preview_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_web/connection_normal.svg diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java index cae4b5958..07583f3d7 100644 --- a/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java +++ b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java @@ -21,6 +21,8 @@ public class SVGIcon implements Icon { public static final float SYSTEM_SCALE = SystemScaleUtils.sysScale(); + private static final String ICON_PREFIX = "/"; + public SVGIcon(BufferedImage image) { this.image = image; } @@ -55,6 +57,9 @@ public class SVGIcon implements Icon { * @return */ public static Icon readSVGIcon(String url) { + if (!url.startsWith(ICON_PREFIX)) { + url = ICON_PREFIX + url; + } return new SVGIcon((BufferedImage) SVGLoader.load(url)); } @@ -66,6 +71,9 @@ public class SVGIcon implements Icon { * @return */ public static Icon readSVGIcon(String url, float width, float height) { + if (!url.startsWith(ICON_PREFIX)) { + url = ICON_PREFIX + url; + } return new SVGIcon((BufferedImage) SVGLoader.load(url, width, height)); } } diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index 5ba801ca8..ecaac5f41 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -2,6 +2,7 @@ package com.fr.design.data; import com.fr.base.BaseUtils; import com.fr.base.TableData; +import com.fr.base.svg.SVGIcon; import com.fr.data.TableDataSource; import com.fr.data.api.StoreProcedureAssist; import com.fr.data.impl.storeproc.StoreProcedure; @@ -398,7 +399,8 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp public PreviewTableDataAction(TableDataTree dataTree) { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); this.setMnemonic('p'); - this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.PREVIEW_ICON_PATH)); + this.setSmallIcon(SVGIcon.readSVGIcon(IconPathConstants.PREVIEW_NORMAL_ICON_PATH)); + this.setDisabledIcon(SVGIcon.readSVGIcon(IconPathConstants.PREVIEW_DISABLED_ICON_PATH)); this.dataTree = dataTree; } @@ -437,7 +439,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp public ConnectionTableAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Define_Data_Connection")); this.setMnemonic('D'); - this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.TD_CONNECTION_ICON_PATH)); + this.setSmallIcon(SVGIcon.readSVGIcon(IconPathConstants.TD_CONNECTION_NORMAL_ICON_PATH)); } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index a2cc5b7d2..50cb5f1c8 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -1,7 +1,7 @@ package com.fr.design.data.datapane; -import com.fr.base.BaseUtils; import com.fr.base.TableData; +import com.fr.base.svg.SVGIcon; import com.fr.data.TableDataSource; import com.fr.data.impl.TableDataSourceDependent; import com.fr.design.DesignModelAdapter; @@ -279,7 +279,8 @@ public class TableDataTreePane extends BasicTableDataTreePane { public EditAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); this.setMnemonic('E'); - this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)); + this.setSmallIcon(SVGIcon.readSVGIcon(IconPathConstants.TD_EDIT_NORMAL_ICON_PATH)); + this.setDisabledIcon(SVGIcon.readSVGIcon(IconPathConstants.TD_EDIT_DISABLED_ICON_PATH)); } public void actionPerformed(ActionEvent e) { @@ -297,7 +298,8 @@ public class TableDataTreePane extends BasicTableDataTreePane { public RemoveAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); this.setMnemonic('R'); - this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.TD_REMOVE_ICON_PATH)); + this.setSmallIcon(SVGIcon.readSVGIcon(IconPathConstants.TD_REMOVE_NORMAL_ICON_PATH)); + this.setDisabledIcon(SVGIcon.readSVGIcon(IconPathConstants.TD_REMOVE_DISABLED_ICON_PATH)); } @Override diff --git a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java index a6eedfc20..13b441239 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java @@ -160,7 +160,7 @@ public abstract class WidgetOption implements Serializable { FreeButton.class); public static final WidgetOption MULTI_FILEEDITOR = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_File"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/files_up.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_File"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/files_up_normal.svg"), MultiFileEditor.class); public static final WidgetOption COMBOBOX = WidgetOptionFactory.createByWidgetClass( diff --git a/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java b/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java index e01aa5251..c4a3250e7 100644 --- a/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java +++ b/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java @@ -14,6 +14,8 @@ public class IconPathConstants { } public static final String ADD_POPMENU_ICON_PATH = "/com/fr/design/images/control/addPopup.png"; + public static final String ADD_POPMENU_NORMAL_ICON_PATH = "/com/fr/design/images/control/addPopup_normal.svg"; + public static final String ADD_POPMENU_DISABLED_ICON_PATH = "/com/fr/design/images/control/addPopup_disabled.svg"; public static final String DS_ICON_PATH = "/com/fr/design/images/data/datasource.png"; public static final String CLASS_TD_ICON_PATH = "/com/fr/design/images/data/source/classTableData.png"; @@ -23,11 +25,18 @@ public class IconPathConstants { public static final String DS_TREE_TD_ICON_PATH = "/com/fr/design/images/data/tree.png"; public static final String DS_QUERY_ICON_PATH = "/com/fr/design/images/data/database.png"; public static final String PREVIEW_ICON_PATH = "/com/fr/design/images/m_file/preview.png"; + public static final String PREVIEW_NORMAL_ICON_PATH = "/com/fr/design/images/m_file/preview_normal.svg"; + public static final String PREVIEW_DISABLED_ICON_PATH = "/com/fr/design/images/m_file/preview_disabled.svg"; public static final String TD_EDIT_ICON_PATH = "/com/fr/design/images/control/edit.png"; + public static final String TD_EDIT_NORMAL_ICON_PATH = "/com/fr/design/images/control/edit_normal.svg"; + public static final String TD_EDIT_DISABLED_ICON_PATH = "/com/fr/design/images/control/edit_disabled.svg"; public static final String TD_EL_SHARE_HELP_ICON_PATH = "/com/fr/design/images/control/help_open.png"; public static final String TD_EL_SHARE_CLOSE_ICON_PATH = "/com/fr/design/images/control/help_close.png"; public static final String TD_REMOVE_ICON_PATH = "/com/fr/design/images/control/tab/remove.png"; + public static final String TD_REMOVE_NORMAL_ICON_PATH = "/com/fr/design/images/control/remove_normal.svg"; + public static final String TD_REMOVE_DISABLED_ICON_PATH = "/com/fr/design/images/control/remove_disabled.svg"; public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png"; + public static final String TD_CONNECTION_NORMAL_ICON_PATH = "/com/fr/design/images/m_web/connection_normal.svg"; public static final String SP_SHOW_ICON_PATH = "/com/fr/design/images/data/store_procedure.png"; public static final String STD_SHOW_ICON_PATH = "/com/fr/design/images/data/dock/serverdatabase.png"; public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png"; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index a9d9281e9..5624ae9f6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.base.svg.SVGIcon; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; @@ -17,7 +18,6 @@ import com.fr.design.file.FileToolbarStateChangeListener; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; -import com.fr.design.file.SaveSomeTemplatePane; import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -58,7 +58,6 @@ import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.SwingConstants; -import javax.swing.UIManager; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.BorderLayout; @@ -318,7 +317,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public NewFolderAction() { this.setName(KeySetUtils.NEW_FOLDER.getMenuKeySetName()); - this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/icon_NewFolderIcon_normal.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg")); } @Override @@ -344,7 +344,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt private class VcsAction extends UpdateAction { public VcsAction() { - this.setSmallIcon(VcsHelper.VCS_LIST_PNG); + this.setSmallIcon(VcsHelper.VCS_LIST_NORMAL_SVG); + this.setDisabledIcon(VcsHelper.VCS_LIST_DISABLED_SVG); } @Override @@ -426,7 +427,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public ShowInExplorerAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_In_Containing_Folder")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/view_folder.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg")); } @Override @@ -443,7 +445,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public RefreshTreeAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Refresh")); - this.setSmallIcon(UIConstants.REFRESH_ICON); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg")); } @Override @@ -461,7 +463,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public RenameAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Rename")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/source/rename.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/rename_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg")); } @Override @@ -500,7 +503,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public DelFileAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Remove")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/source/delete.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/remove_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 8229c9f8d..22e2c798f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.vcs.common; +import com.fr.base.svg.SVGIcon; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; import com.fr.design.file.HistoryTemplateListCache; @@ -39,6 +40,8 @@ public class VcsHelper implements JTemplateActionListener { public final static EmptyBorder EMPTY_BORDER_MEDIUM = new EmptyBorder(5, 10, 0, 10); public final static EmptyBorder EMPTY_BORDER_BOTTOM = new EmptyBorder(10, 10, 10, 10); public final static Icon VCS_LIST_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/vcs_list.png"); + public final static Icon VCS_LIST_NORMAL_SVG = SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg"); + public final static Icon VCS_LIST_DISABLED_SVG = SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg"); public final static Icon VCS_BACK_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/vcs_back.png"); public final static Icon VCS_FILTER_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_filter@1x.png"); public final static Icon VCS_EDIT_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_edit.png"); diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg new file mode 100644 index 000000000..f3936e153 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg @@ -0,0 +1,8 @@ + + + icon_NewFolderIcon_disable + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg new file mode 100644 index 000000000..85f41e26a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg @@ -0,0 +1,8 @@ + + + icon_NewFolderIcon_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg new file mode 100644 index 000000000..4e3fd9c14 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg @@ -0,0 +1,7 @@ + + + icon_刷新_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg new file mode 100644 index 000000000..1245fbd4e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg @@ -0,0 +1,7 @@ + + + icon_删除_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_normal.svg new file mode 100644 index 000000000..69a3011fa --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_normal.svg @@ -0,0 +1,7 @@ + + + icon_删除_normal copy + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg new file mode 100644 index 000000000..953e12eaa --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg @@ -0,0 +1,7 @@ + + + icon_重命名_disable + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_normal.svg new file mode 100644 index 000000000..a2c287789 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_normal.svg @@ -0,0 +1,7 @@ + + + icon_重命名_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg new file mode 100644 index 000000000..b88ee0998 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg @@ -0,0 +1,7 @@ + + + icon_版本管理_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg new file mode 100644 index 000000000..ebfca4389 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg @@ -0,0 +1,7 @@ + + + icon_版本管理_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg new file mode 100644 index 000000000..376d372d4 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg @@ -0,0 +1,7 @@ + + + icon_打开文件_disable + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg new file mode 100644 index 000000000..42ae6cbd3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg @@ -0,0 +1,7 @@ + + + icon_所在文件夹_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/prewidget_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/prewidget_normal.svg new file mode 100644 index 000000000..542c02c26 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/prewidget_normal.svg @@ -0,0 +1,8 @@ + + + icon_控件管理 有小箭头_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/files_up_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/files_up_normal.svg new file mode 100644 index 000000000..34cd6083a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/files_up_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_文件控件_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/control/addPopup_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/control/addPopup_disabled.svg new file mode 100644 index 000000000..d48e1a27b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/control/addPopup_disabled.svg @@ -0,0 +1,16 @@ + + + 编组 + + + + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/control/addPopup_normal.svg b/designer-base/src/main/resources/com/fr/design/images/control/addPopup_normal.svg new file mode 100644 index 000000000..8cec802fe --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/control/addPopup_normal.svg @@ -0,0 +1,14 @@ + + + 编组备份 + + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/control/edit_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/control/edit_disabled.svg new file mode 100644 index 000000000..9b001cfc5 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/control/edit_disabled.svg @@ -0,0 +1,8 @@ + + + icon_编辑_disable + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/control/edit_normal.svg b/designer-base/src/main/resources/com/fr/design/images/control/edit_normal.svg new file mode 100644 index 000000000..291719452 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/control/edit_normal.svg @@ -0,0 +1,8 @@ + + + icon_编辑_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg new file mode 100644 index 000000000..b57f9a853 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg @@ -0,0 +1,11 @@ + + + icon_删除_normal + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/control/remove_normal.svg b/designer-base/src/main/resources/com/fr/design/images/control/remove_normal.svg new file mode 100644 index 000000000..b09268f45 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/control/remove_normal.svg @@ -0,0 +1,9 @@ + + + icon_删除_normal备份 + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg new file mode 100644 index 000000000..3edcffdc6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg @@ -0,0 +1,11 @@ + + + icon_报表web属性_打印预览_normal + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/preview_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/preview_normal.svg new file mode 100644 index 000000000..a29073712 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/preview_normal.svg @@ -0,0 +1,9 @@ + + + icon_报表web属性_打印预览_normal备份 + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/connection_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/connection_normal.svg new file mode 100644 index 000000000..7c865b45e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/connection_normal.svg @@ -0,0 +1,11 @@ + + + icon_定义数据连接_normal备份 + + + + + + + + \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java index 7e3c0fd61..ad3770faf 100644 --- a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java +++ b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java @@ -472,6 +472,17 @@ public class ImagePreLoader { "com/fr/design/images/condition/unBracket.png", "com/fr/design/images/buttonicon/user_search_normal.png", "com/fr/design/remote/images/icon_Member_normal@1x.png", - "/com/fr/design/images/buttonicon/add.png" + "/com/fr/design/images/buttonicon/add.png", + "com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg", + "com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg", + "com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg", + "com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg", + "com/fr/design/images/FileDealerPaneIcon/remove_normal.svg", + "com/fr/design/images/FileDealerPaneIcon/rename_normal.svg", + "com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg", + "com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg", + "com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg", + "com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg", + "com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg" }; } From 1418ae05fa383e2d1e3bf2d6cffc51c9c7e5a28c Mon Sep 17 00:00:00 2001 From: Yvan Date: Mon, 21 Dec 2020 18:54:10 +0800 Subject: [PATCH 022/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.8:?= =?UTF-8?q?=20=E6=9B=BF=E6=8D=A2=E4=BA=86=E5=BA=95=E9=83=A8sheet=E6=A0=8F?= =?UTF-8?q?=E4=B8=8E=E5=8F=B3=E4=BE=A7=E9=9D=A2=E6=9D=BF=E7=9A=84tab?= =?UTF-8?q?=E6=A0=8F=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/base/svg/SVGLoader.java | 2 +- .../com/fr/design/constants/UIConstants.java | 2 ++ .../mainframe/EastRegionContainerPane.java | 17 ++++++---- .../propertiestab/authorityedit_disabled.svg | 8 +++++ .../propertiestab/authorityedit_normal.svg | 7 ++++ .../propertiestab/authorityedit_selected.svg | 7 ++++ .../propertiestab/cellattr_disabled.svg | 7 ++++ .../propertiestab/cellattr_normal.svg | 7 ++++ .../propertiestab/cellattr_selected.svg | 7 ++++ .../propertiestab/cellelement_disabled.svg | 7 ++++ .../propertiestab/cellelement_normal.svg | 7 ++++ .../propertiestab/cellelement_selected.svg | 7 ++++ .../propertiestab/conditionattr_disabled.svg | 7 ++++ .../propertiestab/conditionattr_normal.svg | 7 ++++ .../propertiestab/conditionattr_selected.svg | 7 ++++ .../configuredroles_disabled.svg | 7 ++++ .../propertiestab/configuredroles_normal.svg | 7 ++++ .../configuredroles_selected.svg | 7 ++++ .../propertiestab/floatelement_disabled.svg | 7 ++++ .../propertiestab/floatelement_normal.svg | 7 ++++ .../propertiestab/floatelement_selected.svg | 8 +++++ .../propertiestab/hyperlink_disabled.svg | 7 ++++ .../propertiestab/hyperlink_normal.svg | 7 ++++ .../propertiestab/hyperlink_selected.svg | 7 ++++ .../propertiestab/widgetlib_disabled.svg | 7 ++++ .../propertiestab/widgetlib_normal.svg | 7 ++++ .../propertiestab/widgetlib_selected.svg | 7 ++++ .../propertiestab/widgetsettings_disabled.svg | 7 ++++ .../propertiestab/widgetsettings_normal.svg | 7 ++++ .../propertiestab/widgetsettings_selected.svg | 7 ++++ .../images/sheet/add_polysheet_normal.svg | 16 +++++++++ .../images/sheet/next_page_disabled.svg | 7 ++++ .../design/images/sheet/next_page_normal.svg | 7 ++++ .../design/images/sheet/polysheet_normal.svg | 9 +++++ .../design/images/sheet/pre_page_disabled.svg | 7 ++++ .../design/images/sheet/pre_page_normal.svg | 7 ++++ .../com/fr/design/mainframe/FormParaPane.java | 16 ++++----- .../fr/design/mainframe/SheetNameTabPane.java | 33 ++++++++++--------- 38 files changed, 282 insertions(+), 32 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_selected.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/sheet/add_polysheet_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/sheet/next_page_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/sheet/next_page_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/sheet/polysheet_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_normal.svg diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java b/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java index 53d105aef..5f4f9e5dc 100644 --- a/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java +++ b/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java @@ -75,7 +75,7 @@ public class SVGLoader { @Nullable public static Image load(@NotNull String url, float width, float height) { try { - String svgUri = url.toString(); + String svgUri = IOUtils.getResource(url, SVGLoader.class).toString(); TranscoderInput input = new TranscoderInput(svgUri); return SVGTranscoder.createImage(SVGIcon.SYSTEM_SCALE, input, -1, -1, width, height).getImage(); } catch (TranscoderException ignore) { diff --git a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java index 15a7c87c0..5bd0fa222 100644 --- a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java +++ b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java @@ -3,6 +3,7 @@ */ package com.fr.design.constants; +import com.fr.base.svg.SVGIcon; import com.fr.general.IOUtils; import com.fr.stable.Constants; @@ -179,6 +180,7 @@ public interface UIConstants { public static final Icon YES_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/yes.png"); public static final Icon CHOOSEN_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/select_item.png"); public static final Icon PRE_WIDGET_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/prewidget.png"); + public static final Icon PRE_WIDGET_NORMAL_ICON = SVGIcon.readSVGIcon("com/fr/design/images/buttonicon/prewidget_normal.svg", 30, 20); public static final Icon EDIT_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editn.png"); public static final Icon EDIT_PRESSED_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editp.png"); public static final Icon HIDE_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/hiden.png"); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index a273828d8..0e035bcc0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe; -import com.fr.base.BaseUtils; import com.fr.base.FRContext; +import com.fr.base.svg.SVGIcon; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -673,9 +673,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 完整icon路径为 ICON_BASE_DIR + btnIconName + iconSuffix private static final String ICON_BASE_DIR = "/com/fr/design/images/buttonicon/propertiestab/"; - private static final String ICON_SUFFIX_NORMAL = "_normal.png"; - private static final String ICON_SUFFIX_DISABLED = "_disabled.png"; - private static final String ICON_SUFFIX_SELECTED = "_selected.png"; + private static final String ICON_SUFFIX_NORMAL = "_normal.svg"; + private static final String ICON_SUFFIX_DISABLED = "_disabled.svg"; + private static final String ICON_SUFFIX_SELECTED = "_selected.svg"; + private static final int ICON_WIDTH = 18; + private static final int ICON_HEIGHT = 18; private String btnIconName; private String iconBaseDir; private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一 @@ -845,7 +847,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void resetButtonIcon() { if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) { iconSuffix = ICON_SUFFIX_NORMAL; - button.setIcon(BaseUtils.readIcon(getBtnIconUrl())); + button.setIcon(SVGIcon.readSVGIcon(getBtnIconUrl(), ICON_WIDTH, ICON_HEIGHT)); button.setBackground(originBtnBackground); button.setOpaque(false); } @@ -854,7 +856,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void setTabButtonSelected() { resetPropertyIcons(); iconSuffix = ICON_SUFFIX_SELECTED; - button.setIcon(BaseUtils.readIcon(getBtnIconUrl())); + button.setIcon(SVGIcon.readSVGIcon(getBtnIconUrl(), ICON_WIDTH, ICON_HEIGHT)); button.setBackground(selectedBtnBackground); button.setOpaque(true); selectedItem = this; @@ -865,7 +867,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private void initButton() { - button = new UIButton(BaseUtils.readIcon(getBtnIconUrl())) { + button = new UIButton(SVGIcon.readSVGIcon(getBtnIconUrl(), ICON_WIDTH, ICON_HEIGHT)) { public Dimension getPreferredSize() { return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT); } @@ -874,6 +876,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { super.paintComponent(g); } }; + button.setDisabledIcon(SVGIcon.readSVGIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED, ICON_WIDTH, ICON_HEIGHT)); button.set4LargeToolbarButton(); button.setUI(new UIButtonUI() { @Override diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_disabled.svg new file mode 100644 index 000000000..cd22a33fc --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_disabled.svg @@ -0,0 +1,8 @@ + + + icon_属性_权限编辑_disabled + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_normal.svg new file mode 100644 index 000000000..6326e5dc5 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_权限编辑_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_selected.svg new file mode 100644 index 000000000..aee04091e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_权限编辑_selected + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_disabled.svg new file mode 100644 index 000000000..676e2123f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格属性_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_normal.svg new file mode 100644 index 000000000..17c1c3ad7 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格属性_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_selected.svg new file mode 100644 index 000000000..20ec3d345 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格属性_selected + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_disabled.svg new file mode 100644 index 000000000..2996337a6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格元素_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_normal.svg new file mode 100644 index 000000000..486824f88 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格元素_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_selected.svg new file mode 100644 index 000000000..8fd7efb32 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格元素_selected + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_disabled.svg new file mode 100644 index 000000000..30c6ee777 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_条件属性_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_normal.svg new file mode 100644 index 000000000..7d05f4183 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_条件属性_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_selected.svg new file mode 100644 index 000000000..0a2896f52 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_条件属性_selected + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_disabled.svg new file mode 100644 index 000000000..238d5cb3b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_配置角色_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_normal.svg new file mode 100644 index 000000000..b10014568 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_配置角色_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_selected.svg new file mode 100644 index 000000000..af3a5e3a6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_配置角色_selected + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_disabled.svg new file mode 100644 index 000000000..78d8cfb9b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_悬浮元素_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_normal.svg new file mode 100644 index 000000000..d80ac6497 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_悬浮元素_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_selected.svg new file mode 100644 index 000000000..c4f2503c5 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_selected.svg @@ -0,0 +1,8 @@ + + + icon_属性_悬浮元素_selected + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_disabled.svg new file mode 100644 index 000000000..fbb24140c --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_超级链接_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_normal.svg new file mode 100644 index 000000000..85b0fd1d4 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_超级链接_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_selected.svg new file mode 100644 index 000000000..96105ce35 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_超级链接_selected + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_disabled.svg new file mode 100644 index 000000000..813523a35 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_组件库_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_normal.svg new file mode 100644 index 000000000..e4e76fda3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_组件库_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_selected.svg new file mode 100644 index 000000000..8e66ad8b1 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_组件库_selected + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_disabled.svg new file mode 100644 index 000000000..eded04289 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_控件设置_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_normal.svg new file mode 100644 index 000000000..cc63ec865 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_控件设置_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_selected.svg new file mode 100644 index 000000000..a5dd18b3e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_控件设置_selected + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/sheet/add_polysheet_normal.svg b/designer-base/src/main/resources/com/fr/design/images/sheet/add_polysheet_normal.svg new file mode 100644 index 000000000..581db9cfb --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sheet/add_polysheet_normal.svg @@ -0,0 +1,16 @@ + + + icon_sheet_添加数据集_normal + + + + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/sheet/next_page_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/sheet/next_page_disabled.svg new file mode 100644 index 000000000..4bbe1ebb4 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sheet/next_page_disabled.svg @@ -0,0 +1,7 @@ + + + icon_sheet_下一页_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/sheet/next_page_normal.svg b/designer-base/src/main/resources/com/fr/design/images/sheet/next_page_normal.svg new file mode 100644 index 000000000..5526b5488 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sheet/next_page_normal.svg @@ -0,0 +1,7 @@ + + + icon_sheet_下一页_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/sheet/polysheet_normal.svg b/designer-base/src/main/resources/com/fr/design/images/sheet/polysheet_normal.svg new file mode 100644 index 000000000..508a3eedb --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sheet/polysheet_normal.svg @@ -0,0 +1,9 @@ + + + icon_sheet_normal + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_disabled.svg new file mode 100644 index 000000000..9f8493271 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_disabled.svg @@ -0,0 +1,7 @@ + + + icon_sheet_上一页_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_normal.svg b/designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_normal.svg new file mode 100644 index 000000000..58c1fb016 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_normal.svg @@ -0,0 +1,7 @@ + + + icon_sheet_上一页_normal + + + + \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java index 647a0dd8a..784a8ecf5 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java @@ -40,7 +40,7 @@ public class FormParaPane extends JPanel { private static final int TOOLTIP_X = 5; private static final int TOOLTIP_Y = 10; private static Dimension originalSize; - + private static volatile FormParaPane THIS; private java.util.List predifinedwidgeList = new ArrayList(); private UIButton predefineButton; @@ -48,25 +48,25 @@ public class FormParaPane extends JPanel { private FormDesigner designer; - + static { GeneralContext.listenPluginRunningChanged(new PluginEventListener() { - + @Override public void on(PluginEvent event) { - + THIS = null; } }, new PluginFilter() { - + @Override public boolean accept(PluginContext context) { - + return context.contain(PluginModule.ExtraDesign); } }); } - + public static final FormParaPane getInstance(FormDesigner designer) { if(THIS == null) { THIS = new FormParaPane(); @@ -82,7 +82,7 @@ public class FormParaPane extends JPanel { public FormParaPane() { - predefineButton = new UIButton(UIConstants.PRE_WIDGET_ICON) { + predefineButton = new UIButton(UIConstants.PRE_WIDGET_NORMAL_ICON) { @Override public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java index 52f1fe1f0..30d46767f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java @@ -24,6 +24,7 @@ import javax.swing.UIManager; import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; +import com.fr.base.svg.SVGIcon; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; @@ -57,14 +58,14 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse private static final Color LINE_COLOR = new Color(0xababab); - private static final Icon ADD_WORK_SHEET = IOUtils.readIcon("com/fr/base/images/oem/addworksheet.png"); - protected static final Icon ADD_POLY_SHEET = IOUtils.readIcon("com/fr/design/images/sheet/addpolysheet.png"); - private static final Icon WORK_SHEET_ICON = IOUtils.readIcon("com/fr/base/images/oem/worksheet.png"); - private static final Icon POLY_SHEET_ICON = IOUtils.readIcon("com/fr/design/images/sheet/polysheet.png"); - private static final Icon LEFT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/left_normal@1x.png"); - private static final Icon RIGHT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/right_normal@1x.png"); - private static final Icon DISABLED_LEFT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/left_hover@1x.png"); - private static final Icon DISABLED_RIGHT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/right_hover@1x.png"); + private static final Icon ADD_WORK_SHEET = SVGIcon.readSVGIcon("com/fr/base/images/oem/add_worksheet_normal.svg", 22, 12); + protected static final Icon ADD_POLY_SHEET = SVGIcon.readSVGIcon("com/fr/design/images/sheet/add_polysheet_normal.svg", 22, 12); + private static final Icon WORK_SHEET_ICON = SVGIcon.readSVGIcon("com/fr/base/images/oem/worksheet_normal.svg", 12, 12); + private static final Icon POLY_SHEET_ICON = SVGIcon.readSVGIcon("com/fr/design/images/sheet/polysheet_normal.svg", 12, 12); + private static final Icon LEFT_ICON = SVGIcon.readSVGIcon("com/fr/design/images/sheet/pre_page_normal.svg"); + private static final Icon RIGHT_ICON = SVGIcon.readSVGIcon("com/fr/design/images/sheet/next_page_normal.svg"); + private static final Icon DISABLED_LEFT_ICON = SVGIcon.readSVGIcon("com/fr/design/images/sheet/pre_page_disabled.svg"); + private static final Icon DISABLED_RIGHT_ICON = SVGIcon.readSVGIcon("com/fr/design/images/sheet/next_page_disabled.svg"); private static final int NUM = 10; private static final int ICON_SEP_DISTANCE = 8; @@ -134,7 +135,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse * 编辑的对象实例 */ private ReportComponentComposite reportComposite; - + private int selectedIndex = -1; private JPanel buttonPane; @@ -332,7 +333,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse leftButton.setEnabled(buttonEnabled); rightButton.setEnabled(buttonEnabled); } - + /** * 抽出来方便OEM * @return @@ -417,10 +418,10 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse // 画两个添加sheet图标 iconLocation = isOvertakeWidth ? (int) (maxWidth) : addIconlocation + GRAP; - + paintAddButton(g2d); } - + protected void paintAddButton(Graphics2D g2d){ getAddWorkSheet().paintIcon(this, g2d, iconLocation, 3); ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation + getAddWorkSheet().getIconWidth() + ICON_SEP_DISTANCE, 3); @@ -626,7 +627,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse processRightMouseButton(evtX, evtY); } } - + private void processRightMouseButton(int evtX, int evtY){ MenuDef def = new MenuDef(); addInsertGridShortCut(def); @@ -636,14 +637,14 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse def.updateMenu(); GUICoreUtils.showPopupMenu(tabPop, this, evtX - 1, evtY - 1); } - + private void processLeftMouseButton(int evtX){ if (evtX > iconLocation && evtX < iconLocation + GRID_TOSHEET_RIGHT) { firstInsertActionPerformed(); } else if (evtX > iconLocation + POLY_TOSHEET_LEFT && evtX < iconLocation + POLY_TOSHEET_RIGHT) { new PolyReportInsertAction().actionPerformed(null); } - + } protected void addInsertGridShortCut(MenuDef def){ @@ -847,7 +848,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse } protected class GridReportInsertAction extends SheetInsertAction { - + @Override protected TemplateReport newTemplateReport() { return new WorkSheet(); From 3a86570dd312044f2944e82e7ded99d2ff9215cc Mon Sep 17 00:00:00 2001 From: Yvan Date: Mon, 21 Dec 2020 20:12:55 +0800 Subject: [PATCH 023/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.9:?= =?UTF-8?q?=20=E6=9B=BF=E6=8D=A2=E4=BA=86=20=E8=8F=9C=E5=8D=95=E6=A0=8F-?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20=E4=B8=8B=E7=9A=84=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=AD=90=E8=8F=9C=E5=8D=95=E7=9A=84=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/actions/edit/RedoAction.java | 7 ++++--- .../java/com/fr/design/actions/edit/UndoAction.java | 9 +++++---- .../fr/design/actions/file/OpenTemplateAction.java | 8 ++++---- .../fr/design/actions/file/SaveAsTemplateAction.java | 6 +++--- .../com/fr/design/actions/file/SwitchExistEnv.java | 10 +++++----- .../src/main/java/com/fr/design/menu/MenuDef.java | 2 +- .../images/buttonicon/new_form_for_dock_normal.svg | 8 ++++++++ .../fr/design/images/buttonicon/newcpts_normal.svg | 11 +++++++++++ .../com/fr/design/images/buttonicon/open_normal.svg | 7 +++++++ .../images/data/bind/distance_connect_normal.svg | 10 ++++++++++ .../design/images/data/bind/local_connect_normal.svg | 8 ++++++++ .../com/fr/design/images/m_file/export_normal.svg | 8 ++++++++ .../com/fr/design/images/m_file/formExport_normal.svg | 11 +++++++++++ .../com/fr/design/images/m_file/saveAs_normal.svg | 7 +++++++ .../com/fr/design/images/m_file/switch_normal.svg | 7 +++++++ .../java/com/fr/design/actions/NewFormAction.java | 4 ++-- .../src/main/java/com/fr/design/mainframe/JForm.java | 2 +- .../actions/file/newReport/NewPolyReportAction.java | 10 +++++----- .../actions/file/newReport/NewWorkBookAction.java | 4 ++-- .../main/java/com/fr/design/mainframe/JWorkBook.java | 2 +- .../java/com/fr/start/preload/ImagePreLoader.java | 7 ++++++- 21 files changed, 116 insertions(+), 32 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/new_form_for_dock_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/newcpts_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/open_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/data/bind/distance_connect_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/data/bind/local_connect_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/export_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/formExport_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/saveAs_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/switch_normal.svg diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/RedoAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/RedoAction.java index 2d4c99d29..4ed649dc2 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/RedoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/edit/RedoAction.java @@ -5,7 +5,7 @@ package com.fr.design.actions.edit; import java.awt.event.ActionEvent; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.TemplateComponentActionInterface; import com.fr.design.actions.UpdateAction; @@ -23,7 +23,8 @@ public class RedoAction extends UpdateAction implements TemplateComponentActionI this.setMenuKeySet(KeySetUtils.REDO); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/redo.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("com/fr/design/images/buttonicon/redo_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("com/fr/design/images/buttonicon/redo_disabled.svg")); this.setAccelerator(getMenuKeySet().getKeyStroke()); } @@ -56,4 +57,4 @@ public class RedoAction extends UpdateAction implements TemplateComponentActionI } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/UndoAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/UndoAction.java index d775ff955..4faedd6ac 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/UndoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/edit/UndoAction.java @@ -5,7 +5,7 @@ package com.fr.design.actions.edit; import java.awt.event.ActionEvent; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.TemplateComponentActionInterface; import com.fr.design.actions.UpdateAction; @@ -23,10 +23,11 @@ public class UndoAction extends UpdateAction implements TemplateComponentActionI this.setMenuKeySet(KeySetUtils.UNDO); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/undo.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("com/fr/design/images/buttonicon/undo_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("com/fr/design/images/buttonicon/undo_disabled.svg")); this.setAccelerator(getMenuKeySet().getKeyStroke()); } - + @Override public JTemplate getEditingComponent() { return t; @@ -57,4 +58,4 @@ public class UndoAction extends UpdateAction implements TemplateComponentActionI } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/file/OpenTemplateAction.java b/designer-base/src/main/java/com/fr/design/actions/file/OpenTemplateAction.java index 091fb112a..c6e4addf1 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/OpenTemplateAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/OpenTemplateAction.java @@ -5,7 +5,7 @@ package com.fr.design.actions.file; import java.awt.event.ActionEvent; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.KeySetUtils; @@ -17,12 +17,12 @@ import com.fr.file.FILEChooserPane; * Open Template. */ public class OpenTemplateAction extends UpdateAction { - + public OpenTemplateAction() { this.setMenuKeySet(KeySetUtils.OPEN_TEMPLATE); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/open.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/open_normal.svg")); this.setAccelerator(getMenuKeySet().getKeyStroke()); } @@ -42,4 +42,4 @@ public class OpenTemplateAction extends UpdateAction { DesignerContext.getDesignerFrame().openTemplate(file); } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SaveAsTemplateAction.java b/designer-base/src/main/java/com/fr/design/actions/file/SaveAsTemplateAction.java index 5d2ab1570..cba0607b0 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SaveAsTemplateAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SaveAsTemplateAction.java @@ -5,7 +5,7 @@ package com.fr.design.actions.file; import java.awt.event.ActionEvent; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.JTemplateAction; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.KeySetUtils; @@ -20,7 +20,7 @@ public class SaveAsTemplateAction extends JTemplateAction> { this.setMenuKeySet(KeySetUtils.SAVE_AS_TEMPLATE); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/saveAs.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_file/saveAs_normal.svg")); } /** @@ -45,4 +45,4 @@ public class SaveAsTemplateAction extends JTemplateAction> { // 另存为按钮应该一直可用使用 this.setEnabled(true); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index 1e222dd26..944e8493d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -1,6 +1,6 @@ package com.fr.design.actions.file; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.DesignerEnvManager; import com.fr.design.EnvChangeEntrance; import com.fr.design.actions.UpdateAction; @@ -21,11 +21,11 @@ public class SwitchExistEnv extends MenuDef { initMenuDef(); } - private void initMenuDef() { + private void initMenuDef() { Iterator nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator(); while (nameIt.hasNext()) { String name = nameIt.next(); - this.setIconPath("com/fr/design/images/m_file/switch.png"); + this.setIconPath("com/fr/design/images/m_file/switch_normal.svg", true); this.addShortCut(new GetExistEnvAction(name)); } this.addShortCut(SeparatorDef.DEFAULT); @@ -42,11 +42,11 @@ public class SwitchExistEnv extends MenuDef { DesignerWorkspaceInfo env = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); switch (env.getType()) { case Local: { - this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/localconnect.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("com/fr/design/images/data/bind/local_connect_normal.svg")); break; } case Remote: { - this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/distanceconnect.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("com/fr/design/images/data/bind/distance_connect_normal.svg")); break; } } diff --git a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java index 689560e95..fb657f475 100644 --- a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java @@ -201,7 +201,7 @@ public class MenuDef extends ShortCut { createdJMenu = createJMenu0(); createdJMenu.setMnemonic(this.getMnemonic()); if (this.iconPath != null) { - createdJMenu.setIcon(BaseUtils.readIcon(this.iconPath)); + createdJMenu.setIcon(isSVGIcon ? SVGIcon.readSVGIcon(iconPath) : BaseUtils.readIcon(iconPath)); } MenuListener menuListener = createMenuListener(); createdJMenu.addMenuListener(menuListener); diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/new_form_for_dock_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/new_form_for_dock_normal.svg new file mode 100644 index 000000000..82797df98 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/new_form_for_dock_normal.svg @@ -0,0 +1,8 @@ + + + icon_新建表单_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/newcpts_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/newcpts_normal.svg new file mode 100644 index 000000000..22e258dc2 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/newcpts_normal.svg @@ -0,0 +1,11 @@ + + + icon_标签栏_工作簿_normal + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/open_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/open_normal.svg new file mode 100644 index 000000000..e39847cf2 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/open_normal.svg @@ -0,0 +1,7 @@ + + + icon_导入文件_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/data/bind/distance_connect_normal.svg b/designer-base/src/main/resources/com/fr/design/images/data/bind/distance_connect_normal.svg new file mode 100644 index 000000000..ff87b3e47 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/data/bind/distance_connect_normal.svg @@ -0,0 +1,10 @@ + + + icon_distanceconnect_normal + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/data/bind/local_connect_normal.svg b/designer-base/src/main/resources/com/fr/design/images/data/bind/local_connect_normal.svg new file mode 100644 index 000000000..dad50a605 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/data/bind/local_connect_normal.svg @@ -0,0 +1,8 @@ + + + icon_HomeFolderIcon_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/export_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/export_normal.svg new file mode 100644 index 000000000..693fba938 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/export_normal.svg @@ -0,0 +1,8 @@ + + + icon_服务器工具栏_输出_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/formExport_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/formExport_normal.svg new file mode 100644 index 000000000..cf751fc18 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/formExport_normal.svg @@ -0,0 +1,11 @@ + + + icon_新建聚合报表_normal + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/saveAs_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/saveAs_normal.svg new file mode 100644 index 000000000..a94f78754 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/saveAs_normal.svg @@ -0,0 +1,7 @@ + + + icon_另存为_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/switch_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/switch_normal.svg new file mode 100644 index 000000000..2bde0dd52 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/switch_normal.svg @@ -0,0 +1,7 @@ + + + icon_切换工作目录_normal + + + + \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java index 8004b739f..d56e1ef2d 100644 --- a/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.DesignerContext; @@ -21,7 +21,7 @@ public class NewFormAction extends UpdateAction { this.setMenuKeySet(NEW_FORM); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/new_form3.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/new_form_for_dock_normal.svg")); this.setAccelerator(getMenuKeySet().getKeyStroke()); } 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 7cdd7fd60..95d846836 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 @@ -247,7 +247,7 @@ public class JForm extends JTemplate implements BaseJForm { .addShortCut(new PageExcelExportAction(this), new ExcelExportAction(this), new PageToSheetExcelExportAction(this)); // Export - MenuDef MenuDef exportMenuDef = new MenuDef(KeySetUtils.EXPORT.getMenuName()); - exportMenuDef.setIconPath("/com/fr/design/images/m_file/export.png"); + exportMenuDef.setIconPath("/com/fr/design/images/m_file/export_normal.svg", true); addShortCut(exportMenuDef, excelExportMenuDef); return exportMenuDef; } diff --git a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java index ad3770faf..76b693f9d 100644 --- a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java +++ b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java @@ -46,7 +46,8 @@ public class ImagePreLoader { private String[] preLoadImages = { "com/fr/design/images/m_file/formExport.png", - "com/fr/base/images/oem/cpt.png", + "com/fr/design/images/m_file/formExport_normal.svg", + "com/fr/base/images/oem/cpt.xpng", "com/fr/design/images/data/store_procedure.png", "/com/fr/design/images/m_file/preview.png", "com/fr/base/images/cell/blank.gif", @@ -111,6 +112,7 @@ public class ImagePreLoader { "com/fr/design/images/buttonicon/mouseoverclose icon.png", "com/fr/design/images/buttonicon/pressclose icon.png", "com/fr/design/images/buttonicon/open.png", + "com/fr/design/images/buttonicon/open_normal.svg", "com/fr/design/images/m_file/view_folder.png", "com/fr/design/images/data/source/rename.png", "com/fr/design/images/buttonicon/minus.png", @@ -144,6 +146,7 @@ public class ImagePreLoader { "com/fr/design/images/log/selectedall.png", "com/fr/design/images/log/setting.png", "com/fr/design/images/buttonicon/newcpts.png", + "com/fr/design/images/buttonicon/newcpts_normal.svg", "com/fr/base/images/oem/logo.png", "com/fr/design/images/data/bind/localconnect.png", "com/fr/design/images/gui/tab_add_normal.png", @@ -343,8 +346,10 @@ public class ImagePreLoader { "com/fr/design/images/control/refresh.png", "com/fr/design/images/toolbarbtn/close.png", "com/fr/design/images/buttonicon/new_form3.png", + "com/fr/design/images/buttonicon/new_form_for_dock_normal.svg", "com/fr/design/images/m_file/save.png", "com/fr/design/images/m_file/saveAs.png", + "com/fr/design/images/m_file/saveAs_normal.svg", "com/fr/design/images/m_edit/undo.png", "com/fr/design/images/m_edit/redo.png", "com/fr/design/images/m_file/excel.png", From 764e83f4c95a539e8743d82a677a400a07c3b48f Mon Sep 17 00:00:00 2001 From: Yvan Date: Tue, 22 Dec 2020 11:29:55 +0800 Subject: [PATCH 024/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.10:?= =?UTF-8?q?=20=E6=9B=BF=E6=8D=A2=E4=BA=86=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=A0=8F-=E6=A8=A1=E6=9D=BF=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=AD=90=E8=8F=9C=E5=8D=95=E9=A1=B9=E7=9A=84=E5=9B=BE?= =?UTF-8?q?=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/AllowAuthorityEditAction.java | 6 +++--- .../fr/design/actions/TableDataSourceAction.java | 7 +++---- .../com/fr/design/actions/edit/RedoAction.java | 2 +- .../com/fr/design/actions/edit/UndoAction.java | 2 +- .../fr/design/actions/file/SaveTemplateAction.java | 7 ++++--- .../com/fr/design/images/edit/redo_normal.svg | 7 +++++++ .../com/fr/design/images/edit/undo_normal.svg | 7 +++++++ .../fr/design/images/m_file/pageSetup_normal.svg | 7 +++++++ .../com/fr/design/images/m_file/save_disabled.svg | 11 +++++++++++ .../com/fr/design/images/m_file/save_normal.svg | 11 +++++++++++ .../m_report/allow_authority_edit_normal.svg | 8 ++++++++ .../design/images/m_report/background_normal.svg | 10 ++++++++++ .../images/m_report/exit_authority_edit_normal.svg | 8 ++++++++ .../fr/design/images/m_report/footer_normal.svg | 7 +++++++ .../fr/design/images/m_report/header_normal.svg | 7 +++++++ .../design/images/m_report/linear_attr_normal.svg | 7 +++++++ .../images/m_report/parameter_report_normal.svg | 7 +++++++ .../images/m_report/report_engine_attr_normal.svg | 14 ++++++++++++++ .../images/m_report/report_write_attr_normal.svg | 11 +++++++++++ .../fr/design/images/m_report/watermark_normal.svg | 7 +++++++ .../m_report/web_report_attribute_normal.svg | 8 ++++++++ .../fr/design/images/m_web/datasource_normal.svg | 9 +++++++++ .../actions/report/ReportBackgroundAction.java | 7 +++---- .../design/actions/report/ReportColumnsAction.java | 6 +++--- .../actions/report/ReportEngineAttrAction.java | 6 +++--- .../actions/report/ReportExportAttrAction.java | 8 ++++---- .../design/actions/report/ReportFooterAction.java | 6 +++--- .../design/actions/report/ReportHeaderAction.java | 6 +++--- .../actions/report/ReportPageSetupAction.java | 7 ++++--- .../actions/report/ReportParameterAction.java | 6 +++--- .../actions/report/ReportPrintSettingAction.java | 5 ++--- .../actions/report/ReportWatermarkAction.java | 4 ++-- .../design/actions/report/ReportWebAttrAction.java | 8 ++++---- .../actions/report/ReportWriteAttrAction.java | 5 +++-- .../java/com/fr/start/preload/ImagePreLoader.java | 14 ++++++++++++++ 35 files changed, 209 insertions(+), 49 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/edit/redo_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/edit/undo_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/pageSetup_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/save_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/save_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/allow_authority_edit_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/background_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/exit_authority_edit_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/footer_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/header_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/linear_attr_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/parameter_report_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/report_engine_attr_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/report_write_attr_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/watermark_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/web_report_attribute_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_web/datasource_normal.svg diff --git a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java index 507632c72..49e8670bd 100644 --- a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; @@ -22,7 +22,7 @@ public class AllowAuthorityEditAction extends TemplateComponentAction { this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/allow_authority_edit_normal.svg")); } /** @@ -78,4 +78,4 @@ public class AllowAuthorityEditAction extends TemplateComponentAction { } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java index a0ca4d955..74c4f1e76 100644 --- a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java @@ -1,8 +1,7 @@ package com.fr.design.actions; import javax.swing.SwingUtilities; - -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.data.DesignTableDataManager; import com.fr.data.TableDataSource; import com.fr.design.data.datapane.ReportTableDataPane; @@ -27,7 +26,7 @@ public class TableDataSourceAction extends TemplateComponentAction map) { DesignTableDataManager.fireDSChanged(map); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/RedoAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/RedoAction.java index 4ed649dc2..dca023a4e 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/RedoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/edit/RedoAction.java @@ -23,7 +23,7 @@ public class RedoAction extends UpdateAction implements TemplateComponentActionI this.setMenuKeySet(KeySetUtils.REDO); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIcon.readSVGIcon("com/fr/design/images/buttonicon/redo_normal.svg")); + this.setSmallIcon(SVGIcon.readSVGIcon("com/fr/design/images/edit/redo_normal.svg")); this.setDisabledIcon(SVGIcon.readSVGIcon("com/fr/design/images/buttonicon/redo_disabled.svg")); this.setAccelerator(getMenuKeySet().getKeyStroke()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/UndoAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/UndoAction.java index 4faedd6ac..200bc8ae4 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/UndoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/edit/UndoAction.java @@ -23,7 +23,7 @@ public class UndoAction extends UpdateAction implements TemplateComponentActionI this.setMenuKeySet(KeySetUtils.UNDO); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIcon.readSVGIcon("com/fr/design/images/buttonicon/undo_normal.svg")); + this.setSmallIcon(SVGIcon.readSVGIcon("com/fr/design/images/edit/undo_normal.svg")); this.setDisabledIcon(SVGIcon.readSVGIcon("com/fr/design/images/buttonicon/undo_disabled.svg")); this.setAccelerator(getMenuKeySet().getKeyStroke()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java b/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java index de2cf1e42..d6be9b618 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java @@ -5,7 +5,7 @@ package com.fr.design.actions.file; import java.awt.event.ActionEvent; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.JTemplateAction; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.KeySetUtils; @@ -21,7 +21,8 @@ public class SaveTemplateAction extends JTemplateAction> { this.setMenuKeySet(KeySetUtils.SAVE_TEMPLATE); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/save.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_file/save_normal.svg")); + this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_file/save_disabled.svg")); this.setAccelerator(getMenuKeySet().getKeyStroke()); } @@ -42,4 +43,4 @@ public class SaveTemplateAction extends JTemplateAction> { this.setEnabled(!this.getEditingComponent().isSaved()); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/resources/com/fr/design/images/edit/redo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/edit/redo_normal.svg new file mode 100644 index 000000000..6723f533a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/edit/redo_normal.svg @@ -0,0 +1,7 @@ + + + icon_重做_下拉列表用 + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/edit/undo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/edit/undo_normal.svg new file mode 100644 index 000000000..f66553747 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/edit/undo_normal.svg @@ -0,0 +1,7 @@ + + + icon_撤销_下拉列表用 + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/pageSetup_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/pageSetup_normal.svg new file mode 100644 index 000000000..565fc0aee --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/pageSetup_normal.svg @@ -0,0 +1,7 @@ + + + icon_页面设置_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/save_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/save_disabled.svg new file mode 100644 index 000000000..7158a2c9f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/save_disabled.svg @@ -0,0 +1,11 @@ + + + icon_save_disable + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/save_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/save_normal.svg new file mode 100644 index 000000000..6da2e13e8 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/save_normal.svg @@ -0,0 +1,11 @@ + + + icon_save_normal + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/allow_authority_edit_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/allow_authority_edit_normal.svg new file mode 100644 index 000000000..9d8bff279 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/allow_authority_edit_normal.svg @@ -0,0 +1,8 @@ + + + icon_进入权限编辑_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/background_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/background_normal.svg new file mode 100644 index 000000000..4cacc0f6d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/background_normal.svg @@ -0,0 +1,10 @@ + + + icon_纸张背景_normal + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/exit_authority_edit_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/exit_authority_edit_normal.svg new file mode 100644 index 000000000..1897f7488 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/exit_authority_edit_normal.svg @@ -0,0 +1,8 @@ + + + icon_关闭_权限编辑_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/footer_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/footer_normal.svg new file mode 100644 index 000000000..a9ebb2515 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/footer_normal.svg @@ -0,0 +1,7 @@ + + + icon_页脚_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/header_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/header_normal.svg new file mode 100644 index 000000000..5a4073df1 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/header_normal.svg @@ -0,0 +1,7 @@ + + + icon_页眉_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/linear_attr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/linear_attr_normal.svg new file mode 100644 index 000000000..35c6a92e3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/linear_attr_normal.svg @@ -0,0 +1,7 @@ + + + icon_报表分栏_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/parameter_report_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/parameter_report_normal.svg new file mode 100644 index 000000000..326b33cf3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/parameter_report_normal.svg @@ -0,0 +1,7 @@ + + + icon_参数 模板参数_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/report_engine_attr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/report_engine_attr_normal.svg new file mode 100644 index 000000000..b9d5b48bd --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/report_engine_attr_normal.svg @@ -0,0 +1,14 @@ + + + icon_报表引擎属性_normal + + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/report_write_attr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/report_write_attr_normal.svg new file mode 100644 index 000000000..d70ac6e2c --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/report_write_attr_normal.svg @@ -0,0 +1,11 @@ + + + icon_报表填报属性_normal + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/watermark_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/watermark_normal.svg new file mode 100644 index 000000000..52b0581e8 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/watermark_normal.svg @@ -0,0 +1,7 @@ + + + icon_水印_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/web_report_attribute_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/web_report_attribute_normal.svg new file mode 100644 index 000000000..f1929fd4f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/web_report_attribute_normal.svg @@ -0,0 +1,8 @@ + + + icon_模板web属性_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/datasource_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/datasource_normal.svg new file mode 100644 index 000000000..626af16f0 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/datasource_normal.svg @@ -0,0 +1,9 @@ + + + icon_模板数据集_normal + + + + + + \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java index 1a07b2a2d..706cf905d 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java @@ -3,9 +3,8 @@ */ package com.fr.design.actions.report; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.ReportComponentAction; -import com.fr.design.dialog.BasicDialog; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ReportComponent; import com.fr.design.menu.KeySetUtils; @@ -23,7 +22,7 @@ public class ReportBackgroundAction extends ReportComponentAction { @@ -17,7 +17,7 @@ public class ReportEngineAttrAction extends ReportComponentAction { this.setMenuKeySet(KeySetUtils.REPORT_FOOTER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/footer.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/footer_normal.svg")); } /** @@ -88,4 +88,4 @@ public class ReportFooterAction extends ReportComponentAction { } } } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java index 5ee5c9792..eccee9e26 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.report; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIcon; import com.fr.design.actions.ReportComponentAction; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.headerfooter.EditHeaderPane; @@ -32,7 +32,7 @@ public class ReportHeaderAction extends ReportComponentAction { this.setMenuKeySet(KeySetUtils.REPORT_HEADER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/header.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/header_normal.svg")); } /** @@ -90,4 +90,4 @@ public class ReportHeaderAction extends ReportComponentAction { } } } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageSetupAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageSetupAction.java index b6d831cf6..39d8faf74 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageSetupAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageSetupAction.java @@ -3,6 +3,7 @@ */ package com.fr.design.actions.report; +import com.fr.base.svg.SVGIcon; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.ReportComponentAction; import com.fr.design.dialog.BasicDialog; @@ -27,10 +28,10 @@ public class ReportPageSetupAction extends ReportComponentAction Date: Wed, 23 Dec 2020 21:24:34 +0800 Subject: [PATCH 025/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.10:?= =?UTF-8?q?=20=E2=91=A0=E6=A0=B9=E6=8D=AE=E5=BC=80=E5=8F=91=E8=AF=84?= =?UTF-8?q?=E5=AE=A1=E6=84=8F=E8=A7=81=EF=BC=8C=E6=96=B0=E5=A2=9ESVGIconUt?= =?UTF-8?q?ils=E5=B7=A5=E5=85=B7=E7=B1=BB=EF=BC=8C=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E5=9B=BE=E6=A0=87=E9=83=BD=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E7=94=A8=E5=B7=A5=E5=85=B7=E7=B1=BB=E4=B8=AD=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=9B=E2=91=A1=E4=BF=AE=E6=94=B9UpdateAction?= =?UTF-8?q?=E3=80=81MenuDef=E3=80=81UIButton=E9=80=82=E9=85=8D=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E7=B1=BB=E6=96=B9=E6=B3=95=EF=BC=9B=E2=91=A2=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B9=8B=E5=89=8D=E4=B8=8A=E4=BC=A0=E7=9A=84=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E8=AF=BB=E5=8F=96=E6=96=B9=E5=BC=8F=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=88=9D=E5=A7=8B=E5=8C=96=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=EF=BC=9B=E2=91=A3=E6=9B=BF=E6=8D=A2=E4=BA=86=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=A0=8F-=E5=8D=95=E5=85=83=E6=A0=BC=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E6=89=80=E6=9C=89=E5=AD=90=E9=A1=B9=E7=9A=84=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/base/svg/IconType.java | 62 +++++++++++ .../main/java/com/fr/base/svg/SVGIcon.java | 11 +- .../java/com/fr/base/svg/SVGIconUtils.java | 104 ++++++++++++++++++ .../main/java/com/fr/base/svg/SVGLoader.java | 25 +++-- .../actions/AllowAuthorityEditAction.java | 4 +- .../actions/ExitAuthorityEditAction.java | 3 +- .../design/actions/TableDataSourceAction.java | 4 +- .../com/fr/design/actions/UpdateAction.java | 31 +++++- .../fr/design/actions/edit/CopyAction.java | 4 +- .../com/fr/design/actions/edit/CutAction.java | 5 +- .../fr/design/actions/edit/PasteAction.java | 4 +- .../fr/design/actions/edit/RedoAction.java | 4 +- .../fr/design/actions/edit/UndoAction.java | 4 +- .../actions/file/OpenTemplateAction.java | 4 +- .../actions/file/SaveAsTemplateAction.java | 4 +- .../actions/file/SaveTemplateAction.java | 4 +- .../design/actions/file/SwitchExistEnv.java | 8 +- .../actions/server/ConnectionListAction.java | 6 +- .../com/fr/design/constants/UIConstants.java | 4 +- .../design/data/BasicTableDataTreePane.java | 6 +- .../data/datapane/TableDataTreePane.java | 7 +- .../data/datapane/sqlpane/SQLEditPane.java | 2 +- .../com/fr/design/gui/core/WidgetOption.java | 32 +++--- .../com/fr/design/gui/ibutton/UIButton.java | 11 +- .../com/fr/design/icon/IconPathConstants.java | 2 +- .../DesignerFrameFileDealerPane.java | 18 +-- .../mainframe/EastRegionContainerPane.java | 11 +- .../mainframe/vcs/common/VcsHelper.java | 4 +- .../main/java/com/fr/design/menu/MenuDef.java | 13 +-- .../fit/menupane/ReportFitAttrAction.java | 3 +- .../style/color/UIToolbarColorButton.java | 5 +- .../images/FileDealerPaneIcon/new_folder.png | Bin 0 -> 288 bytes .../images/FileDealerPaneIcon/refresh.png | Bin 0 -> 530 bytes .../images/FileDealerPaneIcon/remove.png | Bin 0 -> 167 bytes .../images/FileDealerPaneIcon/rename.png | Bin 0 -> 433 bytes .../images/FileDealerPaneIcon/vcs_list.png | Bin 0 -> 286 bytes .../images/FileDealerPaneIcon/view_folder.png | Bin 0 -> 208 bytes ...6_normal.svg => comboboxtree16_normal.svg} | 0 ..._normal.svg => distanceconnect_normal.svg} | 0 ...ect_normal.svg => localconnect_normal.svg} | 0 .../data/source/dataDictionary_normal.svg | 7 ++ .../fr/design/images/edit/redo_disabled.svg | 7 ++ .../fr/design/images/edit/undo_disabled.svg | 7 ++ .../design/images/expand/cellAttr_normal.svg | 7 ++ .../fr/design/images/m_edit/redo_disabled.svg | 7 ++ .../fr/design/images/m_edit/redo_normal.svg | 7 ++ .../fr/design/images/m_edit/undo_disabled.svg | 7 ++ .../fr/design/images/m_edit/undo_normal.svg | 7 ++ .../images/m_file/repeatAndFrozen_normal.svg | 7 ++ .../images/m_format/cellAttr_normal.svg | 7 ++ .../images/m_format/highlight_normal.svg | 7 ++ .../images/m_format/modified_normal.svg | 7 ++ .../fr/design/images/m_insert/cell_normal.svg | 7 ++ .../design/images/m_insert/float_normal.svg | 7 ++ .../images/m_insert/hyperLink_normal.svg | 7 ++ .../images/m_insert/insertColumn_normal.svg | 13 +++ .../images/m_insert/insertRow_normal.svg | 14 +++ .../m_report/exit_authority_edit_normal.svg | 9 +- ..._attr_normal.svg => linearAttr_normal.svg} | 0 .../design/images/m_report/mobile_normal.svg | 7 ++ ...rameter_report_normal.svg => p_normal.svg} | 0 ...normal.svg => reportEngineAttr_normal.svg} | 0 ..._normal.svg => reportWriteAttr_normal.svg} | 0 ...rmal.svg => webreportattribute_normal.svg} | 0 .../fr/design/images/m_web/style_normal.svg | 7 ++ .../fr/design/images/reportfit/fit_normal.svg | 7 ++ .../com/fr/design/actions/NewFormAction.java | 6 +- .../designer/beans/actions/CopyAction.java | 5 +- .../designer/beans/actions/CutAction.java | 5 +- .../beans/actions/FormDeleteAction.java | 5 +- .../designer/beans/actions/PasteAction.java | 4 +- .../form/parameter/FormParaTargetMode.java | 5 +- .../fr/design/gui/core/FormWidgetOption.java | 10 +- .../design/mainframe/FormParaWidgetPane.java | 4 +- .../fr/design/mainframe/FormTargetMode.java | 5 +- .../java/com/fr/design/mainframe/JForm.java | 2 +- .../actions/cell/CellAttributeAction.java | 6 +- .../actions/cell/CellExpandAttrAction.java | 6 +- .../actions/cell/CellWidgetAttrAction.java | 5 +- .../cell/ConditionAttributesAction.java | 6 +- .../design/actions/cell/EditCellAction.java | 9 +- .../actions/cell/GlobalStyleMenuDef.java | 2 +- .../actions/cell/UIToolbarBorderButton.java | 5 +- .../actions/cell/style/AlignmentAction.java | 9 +- .../cell/style/ReportFontBoldAction.java | 4 +- .../style/ReportFontForegroundAction.java | 6 +- .../cell/style/ReportFontItalicAction.java | 4 +- .../cell/style/ReportFontUnderlineAction.java | 4 +- .../cell/style/StyleBackgroundAction.java | 6 +- .../actions/columnrow/InsertColumnAction.java | 5 +- .../actions/columnrow/InsertRowAction.java | 6 +- .../fr/design/actions/edit/DeleteAction.java | 4 +- .../design/actions/edit/HyperlinkAction.java | 6 +- .../actions/edit/merge/MergeCellAction.java | 5 +- .../actions/edit/merge/UnmergeCellAction.java | 6 +- .../file/newReport/NewPolyReportAction.java | 5 +- .../file/newReport/NewWorkBookAction.java | 5 +- .../actions/insert/cell/BiasCellAction.java | 5 +- .../actions/insert/cell/ChartCellAction.java | 5 +- .../insert/cell/DSColumnCellAction.java | 5 +- .../insert/cell/FormulaCellAction.java | 5 +- .../insert/cell/GeneralCellAction.java | 5 +- .../actions/insert/cell/ImageCellAction.java | 5 +- .../insert/cell/RichTextCellAction.java | 5 +- .../insert/cell/SubReportCellAction.java | 6 +- .../actions/insert/flot/ChartFloatAction.java | 4 +- .../insert/flot/FormulaFloatAction.java | 4 +- .../actions/insert/flot/ImageFloatAction.java | 5 +- .../insert/flot/TextBoxFloatAction.java | 3 +- .../report/ReportBackgroundAction.java | 5 +- .../actions/report/ReportColumnsAction.java | 5 +- .../report/ReportEngineAttrAction.java | 5 +- .../report/ReportExportAttrAction.java | 5 +- .../actions/report/ReportFooterAction.java | 5 +- .../actions/report/ReportHeaderAction.java | 5 +- .../report/ReportMobileAttrAction.java | 3 +- .../actions/report/ReportPageAttrAction.java | 5 +- .../actions/report/ReportPageSetupAction.java | 6 +- .../actions/report/ReportParameterAction.java | 4 +- .../report/ReportPrintSettingAction.java | 5 +- .../actions/report/ReportWatermarkAction.java | 5 +- .../actions/report/ReportWebAttrAction.java | 5 +- .../actions/report/ReportWriteAttrAction.java | 6 +- .../utils/DeprecatedActionManager.java | 4 +- .../fr/design/mainframe/ElementCasePane.java | 3 +- .../mainframe/ElementCasePaneDelegate.java | 2 +- .../design/mainframe/FormatBrushAction.java | 5 +- .../com/fr/design/mainframe/JWorkBook.java | 2 +- .../fr/design/mainframe/SheetNameTabPane.java | 19 ++-- .../fr/poly/actions/DeleteBlockAction.java | 5 +- .../cellquick/CellDSColumnEditor.java | 3 +- .../cellquick/CellRichTextEditor.java | 3 +- .../cellquick/CellSubReportEditor.java | 3 +- .../main/java/com/fr/start/MainDesigner.java | 11 +- .../com/fr/start/preload/ImagePreLoader.java | 25 ++++- 135 files changed, 648 insertions(+), 299 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/base/svg/IconType.java create mode 100644 designer-base/src/main/java/com/fr/base/svg/SVGIconUtils.java create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder.png rename designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/{combo_box_tree_16_normal.svg => comboboxtree16_normal.svg} (100%) rename designer-base/src/main/resources/com/fr/design/images/data/bind/{distance_connect_normal.svg => distanceconnect_normal.svg} (100%) rename designer-base/src/main/resources/com/fr/design/images/data/bind/{local_connect_normal.svg => localconnect_normal.svg} (100%) create mode 100644 designer-base/src/main/resources/com/fr/design/images/data/source/dataDictionary_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/edit/redo_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/edit/undo_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/expand/cellAttr_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/redo_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/redo_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/undo_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_edit/undo_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/repeatAndFrozen_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/cellAttr_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/highlight_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_format/modified_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/cell_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/float_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/hyperLink_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/insertColumn_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_insert/insertRow_normal.svg rename designer-base/src/main/resources/com/fr/design/images/m_report/{linear_attr_normal.svg => linearAttr_normal.svg} (100%) create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_report/mobile_normal.svg rename designer-base/src/main/resources/com/fr/design/images/m_report/{parameter_report_normal.svg => p_normal.svg} (100%) rename designer-base/src/main/resources/com/fr/design/images/m_report/{report_engine_attr_normal.svg => reportEngineAttr_normal.svg} (100%) rename designer-base/src/main/resources/com/fr/design/images/m_report/{report_write_attr_normal.svg => reportWriteAttr_normal.svg} (100%) rename designer-base/src/main/resources/com/fr/design/images/m_report/{web_report_attribute_normal.svg => webreportattribute_normal.svg} (100%) create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_web/style_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/reportfit/fit_normal.svg diff --git a/designer-base/src/main/java/com/fr/base/svg/IconType.java b/designer-base/src/main/java/com/fr/base/svg/IconType.java new file mode 100644 index 000000000..7df9a0954 --- /dev/null +++ b/designer-base/src/main/java/com/fr/base/svg/IconType.java @@ -0,0 +1,62 @@ +package com.fr.base.svg; + +import com.fr.stable.StringUtils; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2020/12/22 + */ +public enum IconType { + + /** + * png图片转化的Icon + */ + PNG(".png", 0), + /** + * svg图片转化的normalIcon + */ + NORMAL_SVG("_normal", 1), + /** + * SVG图片转化的disabledIcon + */ + DISABLED_SVG("_disabled", 2), + /** + * SVG图片转化的selectedIcon + */ + SELECTED_SVG("_selected", 3); + + private String iconType; + private int iconCode; + + IconType(String iconType, int iconCode) { + this.iconType = iconType; + this.iconCode = iconCode; + } + + public String getIconType() { + return iconType; + } + + public void setIconType(String iconType) { + this.iconType = iconType; + } + + public int getIconCode() { + return iconCode; + } + + public void setIconCode(int iconCode) { + this.iconCode = iconCode; + } + + public static String getIconType(int iconCode) { + for (IconType iconType : IconType.values()) { + if (iconType.getIconCode() == iconCode) { + return iconType.getIconType(); + } + } + return StringUtils.EMPTY; + } + +} diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java index 07583f3d7..aebb22ae1 100644 --- a/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java +++ b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java @@ -1,8 +1,9 @@ package com.fr.base.svg; +import com.fr.general.IOUtils; + import javax.swing.Icon; import java.awt.Component; -import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.image.BufferedImage; @@ -52,7 +53,7 @@ public class SVGIcon implements Icon { } /** - * 外界读取高清图标,默认尺寸为16*16 + * 读取高清图标 * @param url * @return */ @@ -60,7 +61,8 @@ public class SVGIcon implements Icon { if (!url.startsWith(ICON_PREFIX)) { url = ICON_PREFIX + url; } - return new SVGIcon((BufferedImage) SVGLoader.load(url)); + BufferedImage image = (BufferedImage) SVGLoader.load(url); + return image == null ? IOUtils.readIcon(url) : new SVGIcon(image); } /** @@ -74,6 +76,7 @@ public class SVGIcon implements Icon { if (!url.startsWith(ICON_PREFIX)) { url = ICON_PREFIX + url; } - return new SVGIcon((BufferedImage) SVGLoader.load(url, width, height)); + BufferedImage image = (BufferedImage) SVGLoader.load(url, width, height); + return image == null ? IOUtils.readIcon(url) : new SVGIcon(image); } } diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGIconUtils.java b/designer-base/src/main/java/com/fr/base/svg/SVGIconUtils.java new file mode 100644 index 000000000..ba4aaa40f --- /dev/null +++ b/designer-base/src/main/java/com/fr/base/svg/SVGIconUtils.java @@ -0,0 +1,104 @@ +package com.fr.base.svg; + +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; + +import javax.swing.Icon; +import javax.swing.ImageIcon; + +/** + * 主要是用来读取svgIcon的工具类 + * @author Yvan + * @version 10.0 + * Created by Yvan on 2020/12/23 + */ +public class SVGIconUtils { + + private static final String ICON_SUFFIX_SVG = ".svg"; + private static final String ICON_SUFFIX_PNG = ".png"; + private static final String ICON_SUFFIX_GIF = ".gif"; + private static final String SUFFIX_SEPARATOR = "."; + + public static final String ICON_TYPE_NORMAL= "_normal.svg"; + public static final String ICON_TYPE_DISABLED= "_disabled.svg"; + public static final String ICON_TYPE_PRESSED= "_pressed.svg"; + + + /** + * 可以读取SVG图标或者普通图标,并且可以读取不带扩展名的文件 + * @param resource 图片路径 + * @return 图标 + */ + public static Icon readIcon(String resource) { + // 判断是否有.XXX文件后缀 + if (resource.contains(SUFFIX_SEPARATOR)) { + // 判断是否以.svg结尾 + if (resource.endsWith(ICON_SUFFIX_SVG)) { + return SVGIcon.readSVGIcon(resource); + } + return IOUtils.readIcon(resource); + } + // 文件无后缀时 + return readNoSuffixResource(resource, ICON_TYPE_NORMAL); + } + + /** + * 尝试读取不带扩展名的图标,svg优先,其次png,最后gif,都没读到就打印错误日志,返回空白Icon + * @param resource 图片路径 + * @param svgIconType 针对svg来说的图标类型 + * 取值为:ICON_TYPE_NORMAL、ICON_TYPE_DISABLED、ICON_TYPE_PRESSED + * @return 图标 + */ + private static Icon readNoSuffixResource(String resource, String svgIconType) { + String svgPath = resource + svgIconType; + if (IOUtils.readResource(svgPath) != null) { + return SVGIcon.readSVGIcon(svgPath); + } + String pngPath = resource + ICON_SUFFIX_PNG; + if (IOUtils.readResource(pngPath) != null) { + return IOUtils.readIcon(pngPath); + } + String gifPath = resource + ICON_SUFFIX_GIF; + if (IOUtils.readResource(gifPath) != null) { + return IOUtils.readIcon(gifPath); + } + FineLoggerFactory.getLogger().error(resource + "对应文件不存在"); + return new ImageIcon(); + } + + /** + * 读取指定类型的svgIcon + * @param resource + * @param svgIconType + * @return + */ + public static Icon readSVGIcon(String resource, String svgIconType) { + // 判断下是否有后缀 + if (!resource.contains(SUFFIX_SEPARATOR)) { + return readNoSuffixResource(resource, svgIconType); + } + // 如果是".png"后缀,就替换为传入的svgIconType,然后读取图标 + if (resource.endsWith(ICON_SUFFIX_PNG)) { + return readSpecifiedTypeIcon(resource, ICON_SUFFIX_PNG, svgIconType); + } + // 如果是"_XXXXXX.svg"后缀 + if (resource.endsWith(ICON_TYPE_NORMAL)) { + return readSpecifiedTypeIcon(resource, ICON_TYPE_NORMAL, svgIconType); + } + if (resource.endsWith(ICON_TYPE_DISABLED)) { + return readSpecifiedTypeIcon(resource, ICON_TYPE_DISABLED, svgIconType); + } + if (resource.endsWith(ICON_TYPE_PRESSED)) { + return readSpecifiedTypeIcon(resource, ICON_TYPE_PRESSED, svgIconType); + } + return readIcon(resource); + } + + private static Icon readSpecifiedTypeIcon(String resource, String oldSuffix, String newSuffix) { + String iconPath = resource.replace(oldSuffix, newSuffix); + if (IOUtils.readResource(iconPath) != null) { + return SVGIcon.readSVGIcon(iconPath); + } + return readIcon(resource); + } +} diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java b/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java index 5f4f9e5dc..3c0b7a036 100644 --- a/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java +++ b/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java @@ -26,7 +26,11 @@ public class SVGLoader { @Nullable public static Image load(@NotNull String url) { try { - return load(IOUtils.getResource(url, SVGLoader.class), SVGIcon.SYSTEM_SCALE); + URL resource = IOUtils.getResource(url, SVGLoader.class); + if (resource == null) { + return null; + } + return load(resource, SVGIcon.SYSTEM_SCALE); } catch (IOException ignore) { return null; } @@ -43,8 +47,8 @@ public class SVGLoader { String svgUri = url.toString(); TranscoderInput input = new TranscoderInput(svgUri); return SVGTranscoder.createImage(scale, input).getImage(); - } catch (TranscoderException e) { - throw new IOException(e); + } catch (TranscoderException ignore) { + return null; } } @@ -55,8 +59,8 @@ public class SVGLoader { TranscoderInput input = new TranscoderInput(svgUri); return SVGTranscoder.createImage(scale, input, (float) (dimension.getWidth() * scale), (float) (dimension.getHeight() * scale)).getImage(); - } catch (TranscoderException e) { - throw new IOException(e); + } catch (TranscoderException ignore) { + return null; } } @@ -67,16 +71,19 @@ public class SVGLoader { String svgUri = url.toString(); TranscoderInput input = new TranscoderInput(svgUri); return SVGTranscoder.createImage(scale, input, (float) (overriddenWidth * scale), (float) (overriddenHeight * scale)).getImage(); - } catch (TranscoderException e) { - throw new IOException(e); + } catch (TranscoderException ignore) { + return null; } } @Nullable public static Image load(@NotNull String url, float width, float height) { try { - String svgUri = IOUtils.getResource(url, SVGLoader.class).toString(); - TranscoderInput input = new TranscoderInput(svgUri); + URL resource = IOUtils.getResource(url, SVGLoader.class); + if (resource == null) { + return null; + } + TranscoderInput input = new TranscoderInput(resource.toString()); return SVGTranscoder.createImage(SVGIcon.SYSTEM_SCALE, input, -1, -1, width, height).getImage(); } catch (TranscoderException ignore) { return null; diff --git a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java index 49e8670bd..048a8e193 100644 --- a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions; -import com.fr.base.svg.SVGIcon; +import com.fr.base.svg.SVGIconUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; @@ -22,7 +22,7 @@ public class AllowAuthorityEditAction extends TemplateComponentAction { this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/allow_authority_edit_normal.svg")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit_normal.svg")); } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java index 44bd365a2..aca5f3f54 100644 --- a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java @@ -1,6 +1,7 @@ package com.fr.design.actions; import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.DesignModelAdapter; @@ -19,7 +20,7 @@ public class ExitAuthorityEditAction extends TemplateComponentAction { public ExitAuthorityEditAction(TargetComponent t) { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Authority_Edit_Status_Exit")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/exit_authority_edit.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_report/exit_authority_edit_normal.svg")); } diff --git a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java index 74c4f1e76..4420feb8f 100644 --- a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java @@ -1,7 +1,7 @@ package com.fr.design.actions; import javax.swing.SwingUtilities; -import com.fr.base.svg.SVGIcon; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.data.DesignTableDataManager; import com.fr.data.TableDataSource; import com.fr.design.data.datapane.ReportTableDataPane; @@ -26,7 +26,7 @@ public class TableDataSourceAction extends TemplateComponentAction> { this.setMenuKeySet(KeySetUtils.SAVE_AS_TEMPLATE); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_file/saveAs_normal.svg")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_file/saveAs_normal.svg")); } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java b/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java index d6be9b618..3557eb307 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java @@ -5,7 +5,6 @@ package com.fr.design.actions.file; import java.awt.event.ActionEvent; -import com.fr.base.svg.SVGIcon; import com.fr.design.actions.JTemplateAction; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.KeySetUtils; @@ -21,8 +20,7 @@ public class SaveTemplateAction extends JTemplateAction> { this.setMenuKeySet(KeySetUtils.SAVE_TEMPLATE); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_file/save_normal.svg")); - this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_file/save_disabled.svg")); + this.setSmallIcon("/com/fr/design/images/m_file/save.png"); this.setAccelerator(getMenuKeySet().getKeyStroke()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index 944e8493d..d8cf3eff1 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -1,6 +1,6 @@ package com.fr.design.actions.file; -import com.fr.base.svg.SVGIcon; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.EnvChangeEntrance; import com.fr.design.actions.UpdateAction; @@ -25,7 +25,7 @@ public class SwitchExistEnv extends MenuDef { Iterator nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator(); while (nameIt.hasNext()) { String name = nameIt.next(); - this.setIconPath("com/fr/design/images/m_file/switch_normal.svg", true); + this.setIconPath("com/fr/design/images/m_file/switch_normal.svg"); this.addShortCut(new GetExistEnvAction(name)); } this.addShortCut(SeparatorDef.DEFAULT); @@ -42,11 +42,11 @@ public class SwitchExistEnv extends MenuDef { DesignerWorkspaceInfo env = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); switch (env.getType()) { case Local: { - this.setSmallIcon(SVGIcon.readSVGIcon("com/fr/design/images/data/bind/local_connect_normal.svg")); + this.setSmallIcon(SVGIconUtils.readIcon("com/fr/design/images/data/bind/localconnect_normal.svg")); break; } case Remote: { - this.setSmallIcon(SVGIcon.readSVGIcon("com/fr/design/images/data/bind/distance_connect_normal.svg")); + this.setSmallIcon(SVGIconUtils.readIcon("com/fr/design/images/data/bind/distanceconnect_normal.svg")); break; } } diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 50ecd0ea6..ca7bf90f7 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -1,5 +1,6 @@ package com.fr.design.actions.server; +import com.fr.base.svg.SVGIconUtils; import com.fr.data.impl.Connection; import com.fr.design.actions.UpdateAction; import com.fr.design.data.datapane.connect.ConnectionShowPane; @@ -11,7 +12,6 @@ import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; import com.fr.design.os.impl.DatabaseDialogAction; import com.fr.file.ConnectionConfig; -import com.fr.general.IOUtils; import javax.swing.*; import java.awt.event.ActionEvent; @@ -26,7 +26,7 @@ public class ConnectionListAction extends UpdateAction { this.setMenuKeySet(DEFINE_DATA_CONNECTION); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/connection.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_web/connection_normal.svg")); this.generateAndSetSearchText(DatabaseConnectionPane.JDBC.class.getName()); } @@ -96,4 +96,4 @@ public class ConnectionListAction extends UpdateAction { public void update() { this.setEnabled(true); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java index 5bd0fa222..a1eee5b9a 100644 --- a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java +++ b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java @@ -3,7 +3,7 @@ */ package com.fr.design.constants; -import com.fr.base.svg.SVGIcon; +import com.fr.base.svg.SVGIconUtils; import com.fr.general.IOUtils; import com.fr.stable.Constants; @@ -180,7 +180,7 @@ public interface UIConstants { public static final Icon YES_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/yes.png"); public static final Icon CHOOSEN_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/select_item.png"); public static final Icon PRE_WIDGET_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/prewidget.png"); - public static final Icon PRE_WIDGET_NORMAL_ICON = SVGIcon.readSVGIcon("com/fr/design/images/buttonicon/prewidget_normal.svg", 30, 20); + public static final Icon PRE_WIDGET_NORMAL_ICON = SVGIconUtils.readIcon("com/fr/design/images/buttonicon/prewidget_normal.svg"); public static final Icon EDIT_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editn.png"); public static final Icon EDIT_PRESSED_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editp.png"); public static final Icon HIDE_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/hiden.png"); diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index ecaac5f41..486315058 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -2,7 +2,6 @@ package com.fr.design.data; import com.fr.base.BaseUtils; import com.fr.base.TableData; -import com.fr.base.svg.SVGIcon; import com.fr.data.TableDataSource; import com.fr.data.api.StoreProcedureAssist; import com.fr.data.impl.storeproc.StoreProcedure; @@ -399,8 +398,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp public PreviewTableDataAction(TableDataTree dataTree) { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); this.setMnemonic('p'); - this.setSmallIcon(SVGIcon.readSVGIcon(IconPathConstants.PREVIEW_NORMAL_ICON_PATH)); - this.setDisabledIcon(SVGIcon.readSVGIcon(IconPathConstants.PREVIEW_DISABLED_ICON_PATH)); + this.setSmallIcon(IconPathConstants.PREVIEW_ICON_PATH); this.dataTree = dataTree; } @@ -439,7 +437,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp public ConnectionTableAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Define_Data_Connection")); this.setMnemonic('D'); - this.setSmallIcon(SVGIcon.readSVGIcon(IconPathConstants.TD_CONNECTION_NORMAL_ICON_PATH)); + this.setSmallIcon(IconPathConstants.TD_CONNECTION_ICON_PATH); } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 50cb5f1c8..76fd78edd 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -1,7 +1,6 @@ package com.fr.design.data.datapane; import com.fr.base.TableData; -import com.fr.base.svg.SVGIcon; import com.fr.data.TableDataSource; import com.fr.data.impl.TableDataSourceDependent; import com.fr.design.DesignModelAdapter; @@ -279,8 +278,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { public EditAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); this.setMnemonic('E'); - this.setSmallIcon(SVGIcon.readSVGIcon(IconPathConstants.TD_EDIT_NORMAL_ICON_PATH)); - this.setDisabledIcon(SVGIcon.readSVGIcon(IconPathConstants.TD_EDIT_DISABLED_ICON_PATH)); + this.setSmallIcon(IconPathConstants.TD_EDIT_ICON_PATH); } public void actionPerformed(ActionEvent e) { @@ -298,8 +296,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { public RemoveAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); this.setMnemonic('R'); - this.setSmallIcon(SVGIcon.readSVGIcon(IconPathConstants.TD_REMOVE_NORMAL_ICON_PATH)); - this.setDisabledIcon(SVGIcon.readSVGIcon(IconPathConstants.TD_REMOVE_DISABLED_ICON_PATH)); + this.setSmallIcon(IconPathConstants.TD_REMOVE_ICON_PATH); } @Override diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java index 3241e0588..1cba4df96 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java @@ -1 +1 @@ -package com.fr.design.data.datapane.sqlpane; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; import com.fr.design.actions.UpdateAction; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import javax.swing.JPopupMenu; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import java.awt.Point; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetAdapter; import java.awt.dnd.DropTargetContext; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.event.ActionEvent; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-5-2 * Time: 上午11:09 */ public class SQLEditPane extends RSyntaxTextArea { public static final boolean REQUEST_DROPTARGET = true; public static final boolean UNREQUEST_DROPTARGET = false; public SQLEditPane() { this(REQUEST_DROPTARGET); } public SQLEditPane(boolean requestDroptarget) { super(); setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); setAnimateBracketMatching(true); setAntiAliasingEnabled(true); setAutoIndentEnabled(true); setCodeFoldingEnabled(true); setUseSelectedTextColor(true); setCloseCurlyBraces(true); setBracketMatchingEnabled(true); setAntiAliasingEnabled(true); setCloseMarkupTags(true); setLineWrap(true); if (requestDroptarget) { new SQLPaneDropTarget(this); } } private static class SQLPaneDropTarget extends DropTargetAdapter { private TableProcedure sqlTable; public SQLPaneDropTarget(SQLEditPane sqlTextPane) { new DropTarget(sqlTextPane, this); } public void dragEnter(DropTargetDragEvent dtde) { dtde.acceptDrag(dtde.getDropAction()); } public void dragOver(DropTargetDragEvent dtde) { dtde.acceptDrag(dtde.getDropAction()); } public void drop(DropTargetDropEvent dtde) { Point p = dtde.getLocation(); DropTargetContext dtc = dtde.getDropTargetContext(); SQLEditPane jTextPane = (SQLEditPane) dtc.getComponent(); try { Transferable tr = dtde.getTransferable(); DataFlavor[] flavors = tr.getTransferDataFlavors(); for (int i = 0; i < flavors.length; i++) { if (!tr.isDataFlavorSupported(flavors[i])) { continue; } dtde.acceptDrop(dtde.getDropAction()); Object userObj = tr.getTransferData(flavors[i]); if (userObj instanceof TableProcedure) { this.sqlTable = (TableProcedure) userObj; JPopupMenu popupMenu = new JPopupMenu(); popupMenu.add(new NameAction(jTextPane, sqlTable).createMenuItem()); if (ComparatorUtils.equals(sqlTable.getType(), TableProcedure.PROCEDURE)) { popupMenu.add(new CallAction(jTextPane, sqlTable).createMenuItem()); } else { popupMenu.add(new SelectAction(jTextPane, sqlTable).createMenuItem()); } GUICoreUtils.showPopupMenu(popupMenu, jTextPane, (int) p.getX() + 1, (int) p.getY() + 1); } dtde.dropComplete(true); } dtde.rejectDrop(); } catch (Exception e) { dtde.rejectDrop(); } } class NameAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public NameAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name")); this.setMnemonic('N'); this.setSmallIcon(null); } public void actionPerformed(ActionEvent evt) { if (sqlTable != null) { insertStringTo(sqlTextPane, sqlTable.toString()); } } } class SelectAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public SelectAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName("SELECT *"); this.setMnemonic('s'); this.setSmallIcon(null); } public void actionPerformed(ActionEvent evt) { //daniel: 添加参数 insertStringTo(sqlTextPane, DataCoreUtils.createSelectSQL(sqlTable.getSchema(), sqlTable.getName(), sqlTable.getDialect())); } } class CallAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public CallAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName("CALL PROCEDURE "); this.setMnemonic('s'); this.setSmallIcon(null); } public void actionPerformed(ActionEvent evt) { StringBuffer sBuf = new StringBuffer(); sBuf.append("{call "); if (sqlTable != null) { sBuf.append(sqlTable.toString()).append("()"); } sBuf.append('}'); insertStringTo(sqlTextPane, sBuf.toString()); } } private void insertStringTo(SQLEditPane sqlTextPane, String str) { Document document = sqlTextPane.getDocument(); try { document.insertString(sqlTextPane.getCaretPosition(), str, null); } catch (BadLocationException badLocationException) { FineLoggerFactory.getLogger().error(badLocationException.getMessage(), badLocationException); } sqlTextPane.requestFocus(); } } } \ No newline at end of file +package com.fr.design.data.datapane.sqlpane; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import javax.swing.JPopupMenu; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import java.awt.Point; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetAdapter; import java.awt.dnd.DropTargetContext; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.event.ActionEvent; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-5-2 * Time: 上午11:09 */ public class SQLEditPane extends RSyntaxTextArea { public static final boolean REQUEST_DROPTARGET = true; public static final boolean UNREQUEST_DROPTARGET = false; public SQLEditPane() { this(REQUEST_DROPTARGET); } public SQLEditPane(boolean requestDroptarget) { super(); setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); setAnimateBracketMatching(true); setAntiAliasingEnabled(true); setAutoIndentEnabled(true); setCodeFoldingEnabled(true); setUseSelectedTextColor(true); setCloseCurlyBraces(true); setBracketMatchingEnabled(true); setAntiAliasingEnabled(true); setCloseMarkupTags(true); setLineWrap(true); if (requestDroptarget) { new SQLPaneDropTarget(this); } } private static class SQLPaneDropTarget extends DropTargetAdapter { private TableProcedure sqlTable; public SQLPaneDropTarget(SQLEditPane sqlTextPane) { new DropTarget(sqlTextPane, this); } public void dragEnter(DropTargetDragEvent dtde) { dtde.acceptDrag(dtde.getDropAction()); } public void dragOver(DropTargetDragEvent dtde) { dtde.acceptDrag(dtde.getDropAction()); } public void drop(DropTargetDropEvent dtde) { Point p = dtde.getLocation(); DropTargetContext dtc = dtde.getDropTargetContext(); SQLEditPane jTextPane = (SQLEditPane) dtc.getComponent(); try { Transferable tr = dtde.getTransferable(); DataFlavor[] flavors = tr.getTransferDataFlavors(); for (int i = 0; i < flavors.length; i++) { if (!tr.isDataFlavorSupported(flavors[i])) { continue; } dtde.acceptDrop(dtde.getDropAction()); Object userObj = tr.getTransferData(flavors[i]); if (userObj instanceof TableProcedure) { this.sqlTable = (TableProcedure) userObj; JPopupMenu popupMenu = new JPopupMenu(); popupMenu.add(new NameAction(jTextPane, sqlTable).createMenuItem()); if (ComparatorUtils.equals(sqlTable.getType(), TableProcedure.PROCEDURE)) { popupMenu.add(new CallAction(jTextPane, sqlTable).createMenuItem()); } else { popupMenu.add(new SelectAction(jTextPane, sqlTable).createMenuItem()); } GUICoreUtils.showPopupMenu(popupMenu, jTextPane, (int) p.getX() + 1, (int) p.getY() + 1); } dtde.dropComplete(true); } dtde.rejectDrop(); } catch (Exception e) { dtde.rejectDrop(); } } class NameAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public NameAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name")); this.setMnemonic('N'); this.setSmallIcon(UIConstants.BLACK_ICON); } public void actionPerformed(ActionEvent evt) { if (sqlTable != null) { insertStringTo(sqlTextPane, sqlTable.toString()); } } } class SelectAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public SelectAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName("SELECT *"); this.setMnemonic('s'); this.setSmallIcon(UIConstants.BLACK_ICON); } public void actionPerformed(ActionEvent evt) { //daniel: 添加参数 insertStringTo(sqlTextPane, DataCoreUtils.createSelectSQL(sqlTable.getSchema(), sqlTable.getName(), sqlTable.getDialect())); } } class CallAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public CallAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName("CALL PROCEDURE "); this.setMnemonic('s'); this.setSmallIcon(UIConstants.BLACK_ICON); } public void actionPerformed(ActionEvent evt) { StringBuffer sBuf = new StringBuffer(); sBuf.append("{call "); if (sqlTable != null) { sBuf.append(sqlTable.toString()).append("()"); } sBuf.append('}'); insertStringTo(sqlTextPane, sBuf.toString()); } } private void insertStringTo(SQLEditPane sqlTextPane, String str) { Document document = sqlTextPane.getDocument(); try { document.insertString(sqlTextPane.getCaretPosition(), str, null); } catch (BadLocationException badLocationException) { FineLoggerFactory.getLogger().error(badLocationException.getMessage(), badLocationException); } sqlTextPane.requestFocus(); } } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java index 13b441239..0773dd41a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java @@ -1,7 +1,7 @@ package com.fr.design.gui.core; import com.fr.base.BaseUtils; -import com.fr.base.svg.SVGIcon; +import com.fr.base.svg.SVGIconUtils; import com.fr.form.ui.*; import com.fr.general.ComparatorUtils; @@ -128,27 +128,27 @@ public abstract class WidgetOption implements Serializable { } public static final WidgetOption DATEEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Date"), - SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/date_16_normal.svg"), + SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/date_16_normal.svg"), DateEditor.class); public static final WidgetOption TREE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_View_Tree"), - SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/tree_16_normal.svg"), TreeEditor.class); + SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/tree_16_normal.svg"), TreeEditor.class); - public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_ComboBox"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/combo_box_tree_16_normal.svg"), + public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_ComboBox"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/comboboxtree16_normal.svg"), TreeComboBoxEditor.class); public static final WidgetOption CHECKBOXGROUP = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox_Group"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg"), CheckBoxGroup.class); + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox_Group"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg"), CheckBoxGroup.class); public static final WidgetOption RADIOGROUP = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Radio_Group"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/button_group_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Radio_Group"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_group_16_normal.svg"), RadioGroup.class); public static final WidgetOption NUMBEREDITOR = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Number"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/number_field_16_normal.svg"), NumberEditor.class); + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Number"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/number_field_16_normal.svg"), NumberEditor.class); public static final WidgetOption LABEL = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Label"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/label_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Label"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/label_16_normal.svg"), Label.class); public static final WidgetOption BUTTON = WidgetOptionFactory.createByWidgetClass( @@ -156,23 +156,23 @@ public abstract class WidgetOption implements Serializable { Button.class); public static final WidgetOption FREEBUTTON = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Button"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/button_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Button"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_16_normal.svg"), FreeButton.class); public static final WidgetOption MULTI_FILEEDITOR = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_File"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/files_up_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_File"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/files_up_normal.svg"), MultiFileEditor.class); public static final WidgetOption COMBOBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Box"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Box"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg"), ComboBox.class); public static final WidgetOption COMBOCHECKBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Checkbox"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Checkbox"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg"), ComboCheckBox.class); public static final WidgetOption CHECKBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/check_box_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/check_box_16_normal.svg"), CheckBox.class); public static final WidgetOption LIST = WidgetOptionFactory.createByWidgetClass( @@ -182,16 +182,16 @@ public abstract class WidgetOption implements Serializable { public static final WidgetOption TEXTEDITOR = WidgetOptionFactory.createByWidgetClass( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Text") - , SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/text_field_16_normal.svg"), + , SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_field_16_normal.svg"), TextEditor.class); public static final WidgetOption TEXTAREA = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Textarea"), SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/text_area_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Textarea"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_area_16_normal.svg"), TextArea.class); public static final WidgetOption PASSWORD = WidgetOptionFactory.createByWidgetClass( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Password"), - SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/widget/password_field_16_normal.svg"), Password.class); + SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/password_field_16_normal.svg"), Password.class); public static final WidgetOption IFRAMEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Form_Iframe"), BaseUtils.readIcon("/com/fr/web/images/form/resources/iframe_16.png"), IframeEditor.class); diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java index 32f20ad56..ea592a072 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java @@ -3,6 +3,7 @@ package com.fr.design.gui.ibutton; import com.fr.base.BaseUtils; import com.fr.base.CellBorderStyle; import com.fr.base.GraphHelper; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.constants.UIConstants; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -97,6 +98,14 @@ public class UIButton extends JButton implements UIObserver, UITextComponent { initListener(); } + public UIButton(String resource, boolean needSetDisabledIcon) { + super(SVGIconUtils.readSVGIcon(resource, SVGIconUtils.ICON_TYPE_NORMAL)); + if (needSetDisabledIcon) { + this.setDisabledIcon(SVGIconUtils.readSVGIcon(resource, SVGIconUtils.ICON_TYPE_DISABLED)); + } + init(); + } + protected void initListener() { if (shouldResponseChangeListener()) { this.addActionListener(new ActionListener() { @@ -388,4 +397,4 @@ public class UIButton extends JButton implements UIObserver, UITextComponent { public boolean shouldResponseChangeListener() { return true; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java b/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java index c4a3250e7..d977e4be4 100644 --- a/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java +++ b/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java @@ -32,7 +32,7 @@ public class IconPathConstants { public static final String TD_EDIT_DISABLED_ICON_PATH = "/com/fr/design/images/control/edit_disabled.svg"; public static final String TD_EL_SHARE_HELP_ICON_PATH = "/com/fr/design/images/control/help_open.png"; public static final String TD_EL_SHARE_CLOSE_ICON_PATH = "/com/fr/design/images/control/help_close.png"; - public static final String TD_REMOVE_ICON_PATH = "/com/fr/design/images/control/tab/remove.png"; + public static final String TD_REMOVE_ICON_PATH = "/com/fr/design/images/control/remove.png"; public static final String TD_REMOVE_NORMAL_ICON_PATH = "/com/fr/design/images/control/remove_normal.svg"; public static final String TD_REMOVE_DISABLED_ICON_PATH = "/com/fr/design/images/control/remove_disabled.svg"; public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png"; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 5624ae9f6..2d4149662 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -2,7 +2,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; -import com.fr.base.svg.SVGIcon; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; @@ -317,8 +316,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public NewFolderAction() { this.setName(KeySetUtils.NEW_FOLDER.getMenuKeySetName()); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg")); - this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg")); + this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/new_folder.png"); } @Override @@ -344,8 +342,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt private class VcsAction extends UpdateAction { public VcsAction() { - this.setSmallIcon(VcsHelper.VCS_LIST_NORMAL_SVG); - this.setDisabledIcon(VcsHelper.VCS_LIST_DISABLED_SVG); + this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/vcs_list.png"); } @Override @@ -427,8 +424,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public ShowInExplorerAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_In_Containing_Folder")); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg")); - this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg")); + this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/view_folder.png"); } @Override @@ -445,7 +441,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public RefreshTreeAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Refresh")); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg")); + this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/refresh.png"); } @Override @@ -463,8 +459,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public RenameAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Rename")); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/rename_normal.svg")); - this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg")); + this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/rename.png"); } @Override @@ -503,8 +498,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public DelFileAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Remove")); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/remove_normal.svg")); - this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg")); + this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/remove.png"); } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 0e035bcc0..7c91b0253 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -1,7 +1,8 @@ package com.fr.design.mainframe; import com.fr.base.FRContext; -import com.fr.base.svg.SVGIcon; + +import com.fr.base.svg.SVGIconUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -847,7 +848,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void resetButtonIcon() { if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) { iconSuffix = ICON_SUFFIX_NORMAL; - button.setIcon(SVGIcon.readSVGIcon(getBtnIconUrl(), ICON_WIDTH, ICON_HEIGHT)); + button.setIcon(SVGIconUtils.readIcon(getBtnIconUrl())); button.setBackground(originBtnBackground); button.setOpaque(false); } @@ -856,7 +857,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void setTabButtonSelected() { resetPropertyIcons(); iconSuffix = ICON_SUFFIX_SELECTED; - button.setIcon(SVGIcon.readSVGIcon(getBtnIconUrl(), ICON_WIDTH, ICON_HEIGHT)); + button.setIcon(SVGIconUtils.readIcon(getBtnIconUrl())); button.setBackground(selectedBtnBackground); button.setOpaque(true); selectedItem = this; @@ -867,7 +868,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private void initButton() { - button = new UIButton(SVGIcon.readSVGIcon(getBtnIconUrl(), ICON_WIDTH, ICON_HEIGHT)) { + button = new UIButton(SVGIconUtils.readIcon(getBtnIconUrl())) { public Dimension getPreferredSize() { return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT); } @@ -876,7 +877,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { super.paintComponent(g); } }; - button.setDisabledIcon(SVGIcon.readSVGIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED, ICON_WIDTH, ICON_HEIGHT)); + button.setDisabledIcon(SVGIconUtils.readIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED)); button.set4LargeToolbarButton(); button.setUI(new UIButtonUI() { @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 22e2c798f..0ec5b9c4f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -1,6 +1,6 @@ package com.fr.design.mainframe.vcs.common; -import com.fr.base.svg.SVGIcon; + import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; import com.fr.design.file.HistoryTemplateListCache; @@ -40,8 +40,6 @@ public class VcsHelper implements JTemplateActionListener { public final static EmptyBorder EMPTY_BORDER_MEDIUM = new EmptyBorder(5, 10, 0, 10); public final static EmptyBorder EMPTY_BORDER_BOTTOM = new EmptyBorder(10, 10, 10, 10); public final static Icon VCS_LIST_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/vcs_list.png"); - public final static Icon VCS_LIST_NORMAL_SVG = SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg"); - public final static Icon VCS_LIST_DISABLED_SVG = SVGIcon.readSVGIcon("/com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg"); public final static Icon VCS_BACK_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/vcs_back.png"); public final static Icon VCS_FILTER_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_filter@1x.png"); public final static Icon VCS_EDIT_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_edit.png"); diff --git a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java index fb657f475..8a0cf4aa8 100644 --- a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java @@ -1,7 +1,6 @@ package com.fr.design.menu; -import com.fr.base.BaseUtils; -import com.fr.base.svg.SVGIcon; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.*; import com.fr.design.gui.iscrollbar.UIScrollBar; @@ -41,7 +40,6 @@ public class MenuDef extends ShortCut { protected JPopupMenu popupMenu; protected boolean hasScrollSubMenu; protected boolean isHeadMenu; - private boolean isSVGIcon = false; private String anchor; @@ -101,11 +99,6 @@ public class MenuDef extends ShortCut { this.iconPath = iconPath; } - public void setIconPath(String iconPath, boolean isSVGIcon) { - this.iconPath = iconPath; - this.isSVGIcon = isSVGIcon; - } - public int getShortCutCount() { return this.shortcutList.size(); } @@ -173,7 +166,7 @@ public class MenuDef extends ShortCut { public UIButton createUIButton() { if (createdButton == null) { if (iconPath != null) { - createdButton = new UIButton(isSVGIcon ? SVGIcon.readSVGIcon(iconPath) : BaseUtils.readIcon(iconPath)); + createdButton = new UIButton(SVGIconUtils.readIcon(iconPath)); createdButton.set4ToolbarButton(); } else { createdButton = new UIButton(name); @@ -201,7 +194,7 @@ public class MenuDef extends ShortCut { createdJMenu = createJMenu0(); createdJMenu.setMnemonic(this.getMnemonic()); if (this.iconPath != null) { - createdJMenu.setIcon(isSVGIcon ? SVGIcon.readSVGIcon(iconPath) : BaseUtils.readIcon(iconPath)); + createdJMenu.setIcon(SVGIconUtils.readIcon(iconPath)); } MenuListener menuListener = createMenuListener(); createdJMenu.addMenuListener(menuListener); diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index c24125059..ba507644a 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -1,5 +1,6 @@ package com.fr.design.report.fit.menupane; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.JTemplateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; @@ -65,7 +66,7 @@ public class ReportFitAttrAction extends JTemplateAction { } this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/reportfit/fit.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/reportfit/fit_normal.svg")); } /** diff --git a/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java b/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java index 24328ef41..c0e9199fd 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java +++ b/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java @@ -3,7 +3,8 @@ */ package com.fr.design.style.color; -import com.fr.base.svg.SVGIcon; + +import com.fr.base.svg.SVGIconUtils; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; @@ -34,7 +35,7 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi private UIObserverListener uiObserverListener; public UIToolbarColorButton(Icon icon) { - super(new UIColorButton(icon), new UIButton(SVGIcon.readSVGIcon("/com/fr/design/images/gui/popup_normal.svg"))); + super(new UIColorButton(icon), new UIButton(SVGIconUtils.readIcon("/com/fr/design/images/gui/popup_normal.svg"))); getLeftButton().setEventBanned(true); getRightButton().addFocusListener(new FocusListener() { diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder.png b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder.png new file mode 100644 index 0000000000000000000000000000000000000000..9ea75fc6d857fef4e30a72519a4afd56ac7d0759 GIT binary patch literal 288 zcmV+*0pI?KP)Px#+DSw~R5%gEQZWv~Fbs4MVnN~&NHDM_p?`o*d;oU-!9REbQ$B&n3KD#!jd9YZ zL{^Iw7P8d7JD;680RKK>Xn>+9W_9gOhd_UWW_n3Ypv)08z%4pKh|E)B%07QE@ZUiymM#>D+As)0WaWr ztQm14H_tYZQa{rs*#@+cg*TuTh9~fYLE8Vz7E)O=cGKD8@dwfyc?I1ENXzPx$%t=H+R5%g6QZYyyQ5gQ;<(i5hVhE)sp%Ii&P!}(O++o4NC8(1myHh7o5ZCHx z=^_$3b}VQ>hwPd~tvNC{h(oE3LWqPQxHWh2p5JTx9|=O}ApPOp_uv12-}nA^_lW*? zq*AG^WHR}c_tiP+M8mK~g=oJg@+>JSB!p-PL5I4o=N-qL0QU{^HBK0@!xE8mE~U3F zr5J+vT1px7Jh=h!5Add#tFX%eqpgGZ1)^_6eep`g9-p6|o5SvTtbOnYv4)k9!#{#$ zS@BlO*(4GNwq0I?iBzOwu@nNJ{#y)CAuj(Qk#B(UHc<3}L4BFUid3nTnmEExE|>GC zEffk5PYh6)#h9mv8aEmL8u}uxEA(Bl%PV}e@14zm$$bNm@38#e(@UIAr$;iG%uB`b z4KU^jk$h(u3;n&srfH73Zu_FqXyTr97)YsY<9$Gg`c5wc$7$!$cXeIcRlER`>-E}A zEEau%o3|Q`MqVcpiQ{Uu`iuL9F%ynN!h3knXqs3nm&+y96Y9Z{&1M5vSJjXB8!M>Y z<49+q{6zj1AKAn)HT2eO+y2a&E(0zahB+yO`vKx<2-QWpMSi4d^a-4Q2+n{ literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove.png b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove.png new file mode 100644 index 0000000000000000000000000000000000000000..6fb2baac51ead86742e20545aa0a62413be50b12 GIT binary patch literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|5K|k5|2~(;g&RwlQDDH z6mGYiaof(gobd%$;YW8~2X4ulg}lLC>)IYUq%_XtS$r|Kq4RPN8^beAv5Lrm+Yvy^ O7(8A5T-G@yGywp$2|2L< literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename.png b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename.png new file mode 100644 index 0000000000000000000000000000000000000000..5c244dd5d48b170673b7027067115be464b40e92 GIT binary patch literal 433 zcmV;i0Z#sjP)Px$Ye_^wR5%f}Qaw+@Fc7tykJ5z=u@trJWWk_>pbWr&VdbYFR{jPv5h5Z|1Ys#V zkzgttLxY+Gb1$teD?=oNI4SY-^WDqyT^RdgaI@a`{mm@PK7}}t;Pd>6D-Qc02&P!g z&;mjnUUAOOMx%|B#iE=eX*hJZm&+=alHKO{;{^#9W-;MOD}b*w&G&yu00IZ}>Uc4phw4jy1|IO`Up4$(SLcLsq%N`??4XXCnV-hdJ4 z$qKFB+JQ;_7Hh>Qinhw~>zM>*bl-CbQD3fU@#qTsNs@ekGebK-6RDWG-8RpI?X`6e z9L|tq7AtH6pg}aom>R~-F}kiJ)?P&q;zd4vnygHB%WHVnfFdAXsHPLZgm05!+4cl)Z9ZIy?;DNytk b|J&IQ*9Ev-ia$+h00000NkvXXu0mjf!mPe( literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list.png b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list.png new file mode 100644 index 0000000000000000000000000000000000000000..df6cd02de67c069a372e1342661652a8c9673956 GIT binary patch literal 286 zcmV+(0pb3MP)Px#*hxe|R5%f(Qtc7KAPfbsW9Sq_ox!??Lv;|H!IMs*dte_nxfn|2PW~kCgFph# z)mI3VMEwH7RuiKAlf`0dL9jDNy_E%U8wM$*E$1A;iNSmSVu2$#4}em-0)!YJJ2tjO zqGPX}Aso&b6VYk4zg2N6AzkS5Iu}Fr4ogR9uJhjYnm~DQd`un`14MK+Sq42gtt0){&T49(8_T?t=RJO_5M$2~~aNTjdU#-}JWy~$+B~QMA7BFG^`?QXH9-_QN k{;t1ffX|1*w%FhJ4RGa2%S^h7EC2ui07*qoM6N<$f~l)@dH?_b literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder.png b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder.png new file mode 100644 index 0000000000000000000000000000000000000000..4d16dc7aea783ce693256d5f013d9de8f7f5c8da GIT binary patch literal 208 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|x;$MRLo5WB zPQJ+7pupo2{n)L9>-$m76tyjCzUQ_n3jTP>SpNP;V@Bb|jw|kDKe9mmQ z&9`%I6z%!cB;Leu<(k2)SNHcSHg750`2D6G!-Y8qbux?@-Z-fr`XE!vkg`@efMJ1U zbK>q-3=YgNp$qH}dL?;ohw9fZQ;)a(@ckd#bS`~OzPrbrfv#fkboFyt=akR{02Z)O ANdN!< literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_box_tree_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/comboboxtree16_normal.svg similarity index 100% rename from designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_box_tree_16_normal.svg rename to designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/comboboxtree16_normal.svg diff --git a/designer-base/src/main/resources/com/fr/design/images/data/bind/distance_connect_normal.svg b/designer-base/src/main/resources/com/fr/design/images/data/bind/distanceconnect_normal.svg similarity index 100% rename from designer-base/src/main/resources/com/fr/design/images/data/bind/distance_connect_normal.svg rename to designer-base/src/main/resources/com/fr/design/images/data/bind/distanceconnect_normal.svg diff --git a/designer-base/src/main/resources/com/fr/design/images/data/bind/local_connect_normal.svg b/designer-base/src/main/resources/com/fr/design/images/data/bind/localconnect_normal.svg similarity index 100% rename from designer-base/src/main/resources/com/fr/design/images/data/bind/local_connect_normal.svg rename to designer-base/src/main/resources/com/fr/design/images/data/bind/localconnect_normal.svg diff --git a/designer-base/src/main/resources/com/fr/design/images/data/source/dataDictionary_normal.svg b/designer-base/src/main/resources/com/fr/design/images/data/source/dataDictionary_normal.svg new file mode 100644 index 000000000..5ca77fe5b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/data/source/dataDictionary_normal.svg @@ -0,0 +1,7 @@ + + + icon_形态_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/edit/redo_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/edit/redo_disabled.svg new file mode 100644 index 000000000..7866d7b44 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/edit/redo_disabled.svg @@ -0,0 +1,7 @@ + + + icon_重做_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/edit/undo_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/edit/undo_disabled.svg new file mode 100644 index 000000000..ca7b9f1c6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/edit/undo_disabled.svg @@ -0,0 +1,7 @@ + + + icon_撤销_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/expand/cellAttr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/expand/cellAttr_normal.svg new file mode 100644 index 000000000..557ab9d03 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/expand/cellAttr_normal.svg @@ -0,0 +1,7 @@ + + + icon_扩展_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/redo_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/redo_disabled.svg new file mode 100644 index 000000000..7866d7b44 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/redo_disabled.svg @@ -0,0 +1,7 @@ + + + icon_重做_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/redo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/redo_normal.svg new file mode 100644 index 000000000..6723f533a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/redo_normal.svg @@ -0,0 +1,7 @@ + + + icon_重做_下拉列表用 + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/undo_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/undo_disabled.svg new file mode 100644 index 000000000..ca7b9f1c6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/undo_disabled.svg @@ -0,0 +1,7 @@ + + + icon_撤销_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/undo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/undo_normal.svg new file mode 100644 index 000000000..f66553747 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/undo_normal.svg @@ -0,0 +1,7 @@ + + + icon_撤销_下拉列表用 + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/repeatAndFrozen_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/repeatAndFrozen_normal.svg new file mode 100644 index 000000000..537d76854 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/repeatAndFrozen_normal.svg @@ -0,0 +1,7 @@ + + + icon_重复与冻结设置_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellAttr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellAttr_normal.svg new file mode 100644 index 000000000..2c8311fed --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellAttr_normal.svg @@ -0,0 +1,7 @@ + + + icon_其他属性_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/highlight_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/highlight_normal.svg new file mode 100644 index 000000000..7d05f4183 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/highlight_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_条件属性_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/modified_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/modified_normal.svg new file mode 100644 index 000000000..93b9e7a6d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/modified_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_控件设置_下拉列表用_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/cell_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/cell_normal.svg new file mode 100644 index 000000000..7122f3db8 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/cell_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格元素_下拉列表用_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/float_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/float_normal.svg new file mode 100644 index 000000000..ba67578c1 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/float_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_悬浮元素_下拉列表用_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/hyperLink_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/hyperLink_normal.svg new file mode 100644 index 000000000..85b0fd1d4 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/hyperLink_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_超级链接_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/insertColumn_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/insertColumn_normal.svg new file mode 100644 index 000000000..358dcc357 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/insertColumn_normal.svg @@ -0,0 +1,13 @@ + + + icon_列_normal + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/insertRow_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/insertRow_normal.svg new file mode 100644 index 000000000..ecf535ba6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/insertRow_normal.svg @@ -0,0 +1,14 @@ + + + icon_行_normal + + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/exit_authority_edit_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/exit_authority_edit_normal.svg index 1897f7488..cb214cf19 100644 --- a/designer-base/src/main/resources/com/fr/design/images/m_report/exit_authority_edit_normal.svg +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/exit_authority_edit_normal.svg @@ -1,8 +1,7 @@ - - icon_关闭_权限编辑_normal - - - + + icon_退出权限编辑_normal + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/linear_attr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/linearAttr_normal.svg similarity index 100% rename from designer-base/src/main/resources/com/fr/design/images/m_report/linear_attr_normal.svg rename to designer-base/src/main/resources/com/fr/design/images/m_report/linearAttr_normal.svg diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/mobile_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/mobile_normal.svg new file mode 100644 index 000000000..f13090adb --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/mobile_normal.svg @@ -0,0 +1,7 @@ + + + icon_移动端属性_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/parameter_report_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/p_normal.svg similarity index 100% rename from designer-base/src/main/resources/com/fr/design/images/m_report/parameter_report_normal.svg rename to designer-base/src/main/resources/com/fr/design/images/m_report/p_normal.svg diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/report_engine_attr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/reportEngineAttr_normal.svg similarity index 100% rename from designer-base/src/main/resources/com/fr/design/images/m_report/report_engine_attr_normal.svg rename to designer-base/src/main/resources/com/fr/design/images/m_report/reportEngineAttr_normal.svg diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/report_write_attr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/reportWriteAttr_normal.svg similarity index 100% rename from designer-base/src/main/resources/com/fr/design/images/m_report/report_write_attr_normal.svg rename to designer-base/src/main/resources/com/fr/design/images/m_report/reportWriteAttr_normal.svg diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/web_report_attribute_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/webreportattribute_normal.svg similarity index 100% rename from designer-base/src/main/resources/com/fr/design/images/m_report/web_report_attribute_normal.svg rename to designer-base/src/main/resources/com/fr/design/images/m_report/webreportattribute_normal.svg diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/style_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/style_normal.svg new file mode 100644 index 000000000..de5f21cc5 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/style_normal.svg @@ -0,0 +1,7 @@ + + + icon_样式_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/reportfit/fit_normal.svg b/designer-base/src/main/resources/com/fr/design/images/reportfit/fit_normal.svg new file mode 100644 index 000000000..21717e20a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/reportfit/fit_normal.svg @@ -0,0 +1,7 @@ + + + icon_模板自适应属性_normal + + + + \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java index d56e1ef2d..1ea306685 100644 --- a/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java @@ -1,7 +1,7 @@ package com.fr.design.actions; -import com.fr.base.svg.SVGIcon; -import com.fr.design.actions.UpdateAction; + +import com.fr.base.svg.SVGIconUtils; import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; @@ -21,7 +21,7 @@ public class NewFormAction extends UpdateAction { this.setMenuKeySet(NEW_FORM); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/new_form_for_dock_normal.svg")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/new_form_for_dock_normal.svg")); this.setAccelerator(getMenuKeySet().getKeyStroke()); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java index 2ae2ae973..98663dedd 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java @@ -1,6 +1,6 @@ package com.fr.design.designer.beans.actions; -import com.fr.base.svg.SVGIcon; + import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.beans.actions.behavior.ComponentEnable; import com.fr.design.mainframe.FormDesigner; @@ -16,8 +16,7 @@ public class CopyAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Copy")); this.setMnemonic('C'); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/copy_normal.svg")); - this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/copy_disabled.svg")); + this.setSmallIcon("/com/fr/design/images/m_edit/copy.png"); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)); setUpdateBehavior(new ComponentEnable()); this.setEnabled(!DesignModeContext.isBanCopyAndCut()); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java index f366602f9..60c4f4fa3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java @@ -1,6 +1,6 @@ package com.fr.design.designer.beans.actions; -import com.fr.base.svg.SVGIcon; + import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.beans.actions.behavior.ComponentEnable; import com.fr.design.mainframe.FormDesigner; @@ -16,8 +16,7 @@ public class CutAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut")); this.setMnemonic('T'); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/cut_normal.svg")); - this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/cut_disabled.svg")); + this.setSmallIcon("/com/fr/design/images/m_edit/cut.png"); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); this.setUpdateBehavior(new ComponentEnable()); this.setEnabled(!DesignModeContext.isBanCopyAndCut()); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java index 94e434cc8..8c5194225 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java @@ -7,7 +7,7 @@ import java.awt.event.KeyEvent; import javax.swing.*; -import com.fr.base.svg.SVGIcon; + import com.fr.design.designer.beans.actions.behavior.ComponentEnable; import com.fr.design.mainframe.FormDesigner; @@ -24,8 +24,7 @@ public class FormDeleteAction extends FormWidgetEditAction { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_Delete")); this.setMnemonic('D'); // Richie:删除菜单图标 - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/delete_normal.svg")); - this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/delete_disabled.svg")); + this.setSmallIcon("/com/fr/design/images/m_report/delete.png"); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)); this.setUpdateBehavior(new ComponentEnable()); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java index 1e6a17b2e..1670e3083 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java @@ -1,6 +1,5 @@ package com.fr.design.designer.beans.actions; -import com.fr.base.svg.SVGIcon; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.mainframe.FormDesigner; @@ -15,8 +14,7 @@ public class PasteAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Edit_Paste")); this.setMnemonic('P'); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/paste_normal.svg")); - this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/paste_disabled.svg")); + this.setSmallIcon("/com/fr/design/images/m_edit/paste.png"); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)); } diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java index ad58ccf35..fa43aa097 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java @@ -1,6 +1,7 @@ package com.fr.design.form.parameter; -import com.fr.base.svg.SVGIcon; + +import com.fr.base.svg.SVGIconUtils; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.properties.WidgetPropertyTable; import com.fr.design.gui.core.WidgetOption; @@ -27,7 +28,7 @@ public class FormParaTargetMode extends FormDesignerModeForSpecial { public WidgetOption[] getPredefinedWidgetOptions() { return new WidgetOption[]{ WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Query_Button"), - SVGIcon.readSVGIcon("/com/fr/web/images/form/resources/preview_16_normal.svg"), FormSubmitButton.class)}; + SVGIconUtils.readIcon("/com/fr/web/images/form/resources/preview_16_normal.svg"), FormSubmitButton.class)}; } public ArrayList createRootDesignerPropertyGroup() { 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 95d846836..3c5e0d14f 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 @@ -247,7 +247,7 @@ public class JForm extends JTemplate implements BaseJForm { this.setMenuKeySet(KeySetUtils.REPORT_FOOTER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/footer_normal.svg")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_report/footer_normal.svg")); } /** diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java index eccee9e26..8323f7295 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java @@ -3,7 +3,8 @@ */ package com.fr.design.actions.report; -import com.fr.base.svg.SVGIcon; + +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.ReportComponentAction; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.headerfooter.EditHeaderPane; @@ -32,7 +33,7 @@ public class ReportHeaderAction extends ReportComponentAction { this.setMenuKeySet(KeySetUtils.REPORT_HEADER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/header_normal.svg")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_report/header_normal.svg")); } /** diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java index a002f56e8..8329004f9 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java @@ -2,6 +2,7 @@ package com.fr.design.actions.report; import com.fr.base.PaperSize; import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.JWorkBookAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -35,7 +36,7 @@ public class ReportMobileAttrAction extends JWorkBookAction{ this.setMenuKeySet(REPORT_APP_ATTR); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/mobile.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_report/mobile_normal.svg")); this.generateAndSetSearchText(ReportMobileAttrPane.class.getName()); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java index 8c804863e..eb409a8e3 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java @@ -3,6 +3,7 @@ */ package com.fr.design.actions.report; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.ReportComponentAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -27,7 +28,7 @@ public class ReportPageAttrAction extends ReportComponentAction extends Tar MenuDef insertFloatMenu = new MenuDef(); insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName()); insertFloatMenu.setTooltip(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_T_Insert_Float")); - insertFloatMenu.setIconPath("/com/fr/design/images/m_insert/floatPop_normal.svg", true); + insertFloatMenu.setIconPath("/com/fr/design/images/m_insert/floatPop_normal.svg"); UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, this); for (int i = 0; i < actions.length; i++) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java index 83a1c0850..44992a84b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -182,7 +182,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { private void addInsertFloatMenuDef(MenuDef menuDef) { // 悬浮元素菜单 MenuDef subMenuDef = new MenuDef(KeySetUtils.INSERT_FLOAT.getMenuName()); - subMenuDef.setIconPath("/com/fr/design/images/m_insert/float.png"); + subMenuDef.setIconPath("/com/fr/design/images/m_insert/float_normal.svg"); menuDef.addShortCut(subMenuDef); UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, this); for (int i = 0; i < actions.length; i++) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java b/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java index b2b29421c..572538558 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java @@ -1,8 +1,7 @@ package com.fr.design.mainframe; -import com.fr.base.BaseUtils; import com.fr.base.Style; -import com.fr.base.svg.SVGIcon; + import com.fr.design.actions.ElementCaseAction; import com.fr.grid.selection.CellSelection; @@ -32,7 +31,7 @@ public class FormatBrushAction extends ElementCaseAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_FormatBrush")); this.setMnemonic('B'); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_edit/formatBrush_normal.svg")); + this.setSmallIcon("/com/fr/design/images/m_edit/formatBrush.png"); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, DEFAULT_MODIFIER)); } 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 6be7acfc2..3aa08926a 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 @@ -690,7 +690,7 @@ public class JWorkBook extends JTemplate { .addShortCut(new PageExcelExportAction(this), new ExcelExportAction(this), new PageToSheetExcelExportAction(this)); // Export - MenuDef MenuDef exportMenuDef = new MenuDef(KeySetUtils.EXPORT.getMenuName()); - exportMenuDef.setIconPath("/com/fr/design/images/m_file/export_normal.svg", true); + exportMenuDef.setIconPath("/com/fr/design/images/m_file/export_normal.svg"); addShortCut(exportMenuDef, excelExportMenuDef); return exportMenuDef; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java index 30d46767f..12702a9fb 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java @@ -24,7 +24,8 @@ import javax.swing.UIManager; import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; -import com.fr.base.svg.SVGIcon; + +import com.fr.base.svg.SVGIconUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; @@ -58,14 +59,14 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse private static final Color LINE_COLOR = new Color(0xababab); - private static final Icon ADD_WORK_SHEET = SVGIcon.readSVGIcon("com/fr/base/images/oem/add_worksheet_normal.svg", 22, 12); - protected static final Icon ADD_POLY_SHEET = SVGIcon.readSVGIcon("com/fr/design/images/sheet/add_polysheet_normal.svg", 22, 12); - private static final Icon WORK_SHEET_ICON = SVGIcon.readSVGIcon("com/fr/base/images/oem/worksheet_normal.svg", 12, 12); - private static final Icon POLY_SHEET_ICON = SVGIcon.readSVGIcon("com/fr/design/images/sheet/polysheet_normal.svg", 12, 12); - private static final Icon LEFT_ICON = SVGIcon.readSVGIcon("com/fr/design/images/sheet/pre_page_normal.svg"); - private static final Icon RIGHT_ICON = SVGIcon.readSVGIcon("com/fr/design/images/sheet/next_page_normal.svg"); - private static final Icon DISABLED_LEFT_ICON = SVGIcon.readSVGIcon("com/fr/design/images/sheet/pre_page_disabled.svg"); - private static final Icon DISABLED_RIGHT_ICON = SVGIcon.readSVGIcon("com/fr/design/images/sheet/next_page_disabled.svg"); + private static final Icon ADD_WORK_SHEET = SVGIconUtils.readIcon("com/fr/base/images/oem/add_worksheet_normal.svg"); + protected static final Icon ADD_POLY_SHEET = SVGIconUtils.readIcon("com/fr/design/images/sheet/add_polysheet_normal.svg"); + private static final Icon WORK_SHEET_ICON = SVGIconUtils.readIcon("com/fr/base/images/oem/worksheet_normal.svg"); + private static final Icon POLY_SHEET_ICON = SVGIconUtils.readIcon("com/fr/design/images/sheet/polysheet_normal.svg"); + private static final Icon LEFT_ICON = SVGIconUtils.readIcon("com/fr/design/images/sheet/pre_page_normal.svg"); + private static final Icon RIGHT_ICON = SVGIconUtils.readIcon("com/fr/design/images/sheet/next_page_normal.svg"); + private static final Icon DISABLED_LEFT_ICON = SVGIconUtils.readIcon("com/fr/design/images/sheet/pre_page_disabled.svg"); + private static final Icon DISABLED_RIGHT_ICON = SVGIconUtils.readIcon("com/fr/design/images/sheet/next_page_disabled.svg"); private static final int NUM = 10; private static final int ICON_SEP_DISTANCE = 8; diff --git a/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java b/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java index d9a8cbf35..f5e9cface 100644 --- a/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java +++ b/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java @@ -8,7 +8,7 @@ import java.awt.event.KeyEvent; import javax.swing.KeyStroke; -import com.fr.base.svg.SVGIcon; + import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.TemplateComponentActionInterface; import com.fr.design.actions.UpdateAction; @@ -26,8 +26,7 @@ public class DeleteBlockAction extends UpdateAction implements TemplateComponent this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_Delete")); this.setMnemonic('D'); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); - this.setSmallIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/delete_normal.svg")); - this.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/m_report/delete_disabled.svg")); + this.setSmallIcon("/com/fr/design/images/m_report/delete.png"); } @Override diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index fb80e8891..fe1693726 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -4,6 +4,7 @@ import com.fr.base.BaseFormula; import com.fr.design.actions.columnrow.DSColumnConditionAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.DSColumnCellAction; +import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dscolumn.DSColumnAdvancedPane; @@ -258,7 +259,7 @@ public class CellDSColumnEditor extends CellQuickEditor { condition.setEditingComponent(tc); } //丢掉icon,修改按钮名称为编辑 - condition.setSmallIcon(null); + condition.setSmallIcon(UIConstants.BLACK_ICON); condition.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); conditionUIButton = new UIButton(condition); Component[][] components = new Component[][]{ diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java index 438d440f6..a515c7204 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java @@ -2,6 +2,7 @@ package com.fr.quickeditor.cellquick; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.RichTextCellAction; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -47,7 +48,7 @@ public class CellRichTextEditor extends CellQuickEditor { protected void refreshDetails() { RichTextCellAction subReportCellAction = new RichTextCellAction(tc); subReportCellAction.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit")); - subReportCellAction.setSmallIcon(null); + subReportCellAction.setSmallIcon(UIConstants.BLACK_ICON); richTextButton.setAction(subReportCellAction); } diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java index 3f29b592a..e6c3ddf82 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java @@ -2,6 +2,7 @@ package com.fr.quickeditor.cellquick; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.SubReportCellAction; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -43,7 +44,7 @@ public class CellSubReportEditor extends CellQuickEditor { protected void refreshDetails() { SubReportCellAction subReportCellAction = new SubReportCellAction(tc); subReportCellAction.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit")); - subReportCellAction.setSmallIcon(null); + subReportCellAction.setSmallIcon(UIConstants.BLACK_ICON); subReportButton.setAction(subReportCellAction); } 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 a538416fc..a9a1ccbd1 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -1,6 +1,6 @@ package com.fr.start; -import com.fr.base.svg.SVGIcon; + import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.file.WebPreviewUtils; @@ -222,8 +222,7 @@ public class MainDesigner extends BaseDesigner { private void createSaveButton() { - saveButton = new UIButton(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/save_normal.svg")); - saveButton.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/save_disabled.svg")); + saveButton = new UIButton("/com/fr/design/images/buttonicon/save.png", true); saveButton.setToolTipText(KeySetUtils.SAVE_TEMPLATE.getMenuKeySetName()); saveButton.set4ToolbarButton(); saveButton.addActionListener(new ActionListener() { @@ -239,8 +238,7 @@ public class MainDesigner extends BaseDesigner { private void createUndoButton() { - undo = new UIButton(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/undo_normal.svg")); - undo.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/undo_disabled.svg")); + undo = new UIButton("/com/fr/design/images/buttonicon/undo.png", true); undo.setToolTipText(KeySetUtils.UNDO.getMenuKeySetName()); undo.set4ToolbarButton(); undo.addActionListener(new ActionListener() { @@ -255,8 +253,7 @@ public class MainDesigner extends BaseDesigner { } private void createRedoButton() { - redo = new UIButton(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/redo_normal.svg")); - redo.setDisabledIcon(SVGIcon.readSVGIcon("/com/fr/design/images/buttonicon/redo_disabled.svg")); + redo = new UIButton("/com/fr/design/images/buttonicon/redo.png", true); redo.setToolTipText(KeySetUtils.REDO.getMenuKeySetName()); redo.set4ToolbarButton(); redo.addActionListener(new ActionListener() { diff --git a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java index f35d1e5e9..911533437 100644 --- a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java +++ b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java @@ -203,6 +203,7 @@ public class ImagePreLoader { "com/fr/design/images/buttonicon/type_string.png", "com/fr/base/images/cell/control/add.png", "com/fr/design/images/expand/cellAttr.gif", + "com/fr/design/images/expand/cellAttr_normal.svg", "com/fr/design/images/expand/none16x16.png", "com/fr/design/images/expand/asc.png", "com/fr/design/images/expand/des.png", @@ -212,7 +213,7 @@ public class ImagePreLoader { "com/fr/design/images/buttonicon/widget/tree_16.png", "com/fr/design/images/buttonicon/widget/tree_16_normal.svg", "com/fr/design/images/buttonicon/widget/comboboxtree.png", - "com/fr/design/images/buttonicon/widget/combo_box_tree_16_normal.svg", + "com/fr/design/images/buttonicon/widget/comboboxtree16_normal.svg", "com/fr/design/images/buttonicon/widget/checkbox_group_16.png", "com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg", "com/fr/design/images/buttonicon/widget/button_group_16.png", @@ -225,6 +226,7 @@ public class ImagePreLoader { "com/fr/design/images/buttonicon/widget/button_16.png", "com/fr/design/images/buttonicon/widget/button_16_normal.svg", "com/fr/design/images/buttonicon/widget/files_up.png", + "com/fr/design/images/buttonicon/widget/files_up_normal.svg", "com/fr/design/images/buttonicon/widget/combo_box_16.png", "com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg", "com/fr/design/images/buttonicon/widget/combo_check_16.png", @@ -362,11 +364,12 @@ public class ImagePreLoader { "com/fr/design/images/m_file/text.png", "com/fr/design/images/m_web/datasource.png", "com/fr/design/images/m_report/webreportattribute.png", - "com/fr/design/images/m_report/web_report_attribute_normal.svg", + "com/fr/design/images/m_report/webreportattribute_normal.svg", "com/fr/design/images/m_report/exportAttr.png", "com/fr/design/images/m_report/p.png", - "com/fr/design/images/m_report/parameter_report_normal.svg", + "com/fr/design/images/m_report/p_normal.svg", "com/fr/design/images/m_report/mobile.png", + "com/fr/design/images/m_report/mobile_normal.svg", "com/fr/web/images/print.png", "com/fr/web/images/print_normal.svg", "com/fr/design/images/m_report/watermark.png", @@ -380,11 +383,11 @@ public class ImagePreLoader { "com/fr/design/images/m_report/background.png", "com/fr/design/images/m_report/background_normal.svg", "com/fr/design/images/m_report/reportWriteAttr.png", - "com/fr/design/images/m_report/report_write_attr_normal.svg", + "com/fr/design/images/m_report/reportWriteAttr_normal.svg", "com/fr/design/images/m_report/linearAttr.png", - "com/fr/design/images/m_report/linear_attr_normal.svg", + "com/fr/design/images/m_report/linearAttr_normal.svg", "com/fr/design/images/m_report/reportEngineAttr.png", - "com/fr/design/images/m_report/report_engine_attr_normal.svg", + "com/fr/design/images/m_report/reportEngineAttr_normal.svg", "com/fr/design/images/m_report/allow_authority_edit.png", "com/fr/design/images/m_report/allow_authority_edit_normal.svg", "com/fr/design/images/m_insert/bindColumn.png", @@ -414,13 +417,18 @@ public class ImagePreLoader { "com/fr/design/images/control/addPopup.png", "com/fr/design/images/toolbarbtn/toolbarbtnclear.png", "com/fr/design/images/m_insert/insertRow.png", + "com/fr/design/images/m_insert/insertRow_normal.svg", "com/fr/design/images/m_insert/insertColumn.png", + "com/fr/design/images/m_insert/insertColumn_normal.svg", "com/fr/design/images/m_format/modified.png", + "com/fr/design/images/m_format/modified_normal.svg", "com/fr/design/images/m_format/highlight.png", + "com/fr/design/images/m_format/highlight_normal.svg", "com/fr/web/images/form/resources/preview_16.png", "com/fr/web/images/form/resources/preview_16_normal.svg", "com/fr/web/images/save.png", "com/fr/design/images/m_insert/hyperLink.png", + "com/fr/design/images/m_insert/hyperLink_normal.svg", "com/fr/web/images/flashPrint.png", "com/fr/design/images/m_edit/merge.png", "com/fr/design/images/m_edit/merge_normal.svg", @@ -431,6 +439,7 @@ public class ImagePreLoader { "com/fr/design/images/m_edit/unmerge_disabled.svg", "com/fr/web/images/pdf.png", "com/fr/design/images/m_format/cellAttr.png", + "com/fr/design/images/m_format/cellAttr_normal.svg", "com/fr/web/images/pdfPrint.png", "com/fr/web/images/serverPrint.png", "com/fr/web/images/email.png", @@ -447,6 +456,7 @@ public class ImagePreLoader { "com/fr/web/images/pageNumber.png", "com/fr/web/images/first.png", "com/fr/design/images/m_web/style.png", + "com/fr/design/images/m_web/style_normal.svg", "com/fr/web/images/last.png", "com/fr/web/images/previous.png", "com/fr/web/images/next.png", @@ -456,17 +466,20 @@ public class ImagePreLoader { "com/fr/web/images/verify.png", "com/fr/web/images/save2.png", "com/fr/design/images/m_file/export.png", + "com/fr/design/images/m_file/export_normal.svg", "com/fr/web/images/showValue.png", "com/fr/web/images/pianyi.png", "com/fr/web/images/writeOffline.png", "com/fr/web/images/edit/stash.png", "com/fr/web/images/edit/clearstash.png", "com/fr/design/images/m_insert/cell.png", + "com/fr/design/images/m_insert/cell_normal.svg", "com/fr/design/images/m_insert/float.png", "com/fr/design/images/gui/color/background.png", "com/fr/design/images/gui/color/background_normal.svg", "com/fr/design/images/m_format/cell.png", "com/fr/design/images/data/source/dataDictionary.png", + "com/fr/design/images/data/source/dataDictionary_normal.svg", "com/fr/design/images/m_format/cellstyle/bold_white.png", "com/fr/design/images/m_format/cellstyle/italic_white.png", "com/fr/design/images/m_format/cellstyle/underline_white.png", From 0d11c8ae863e41ee2bddbbb85756955f9da77335 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 24 Dec 2020 15:17:34 +0800 Subject: [PATCH 026/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.11:?= =?UTF-8?q?=20=E6=9B=BF=E6=8D=A2=E4=BA=86=E8=8F=9C=E5=8D=95=E6=A0=8F-?= =?UTF-8?q?=E5=B8=AE=E5=8A=A9=E5=92=8C=E8=8F=9C=E5=8D=95=E6=A0=8F-?= =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E7=9A=84=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/community/BBSAction.java | 8 +++---- .../design/actions/community/BugAction.java | 9 ++++---- .../actions/community/BugNeedAction.java | 4 ++-- .../actions/community/CenterAction.java | 4 ++-- .../actions/community/FacebookFansAction.java | 5 ++--- .../design/actions/community/NeedAction.java | 4 ++-- .../actions/community/QuestionAction.java | 4 ++-- .../design/actions/community/SignAction.java | 5 ++--- .../actions/community/TechSolutionAction.java | 4 ++-- .../design/actions/community/VideoAction.java | 5 ++--- .../design/actions/help/TutorialAction.java | 4 ++-- .../fr/design/actions/help/WebDemoAction.java | 6 +++--- .../help/alphafine/AlphaFineAction.java | 4 ++-- .../actions/server/FunctionManagerAction.java | 8 +++---- .../actions/server/GlobalParameterAction.java | 6 +++--- .../actions/server/GlobalTableDataAction.java | 8 +++---- .../actions/server/PlatformManagerAction.java | 6 +++--- .../actions/server/PluginManagerAction.java | 6 +++--- .../action/RemoteDesignAuthManagerAction.java | 4 ++-- .../update/actions/SoftwareUpdateAction.java | 4 ++-- .../com/fr/design/images/bbs/bbs_normal.svg | 7 +++++++ .../com/fr/design/images/bbs/bug_normal.svg | 7 +++++++ .../fr/design/images/bbs/center_normal.svg | 7 +++++++ .../fr/design/images/bbs/facebook_normal.svg | 9 ++++++++ .../com/fr/design/images/bbs/help_normal.svg | 7 +++++++ .../com/fr/design/images/bbs/need_normal.svg | 7 +++++++ .../fr/design/images/bbs/question_normal.svg | 7 +++++++ .../com/fr/design/images/bbs/sign_normal.svg | 7 +++++++ .../fr/design/images/bbs/solution_normal.svg | 7 +++++++ .../com/fr/design/images/bbs/video_normal.svg | 7 +++++++ .../design/images/chart/ChartType_normal.svg | 9 ++++++++ .../data/dock/serverdatabase_normal.svg | 13 ++++++++++++ .../fr/design/images/m_help/demo_normal.svg | 7 +++++++ .../fr/design/images/m_web/edit_normal.svg | 8 +++++++ .../design/images/m_web/function_normal.svg | 7 +++++++ .../images/server/platform_16_16_normal.svg | 8 +++++++ .../fr/design/images/server/plugin_normal.svg | 8 +++++++ .../images/update/update_new_normal.svg | 7 +++++++ ...e_Design_Auth_Manager_normal@1x_normal.svg | 9 ++++++++ .../fr/design/module/ChartPreStyleAction.java | 6 +++--- .../map/server/ChartMapEditorAction.java | 4 ++-- .../van/chart/map/images/mapData_normal.svg | 8 +++++++ .../server/ServerConfigManagerAction.java | 6 +++--- .../actions/server/StyleListAction.java | 3 ++- .../actions/server/WidgetManagerAction.java | 4 ++-- .../com/fr/start/preload/ImagePreLoader.java | 21 +++++++++++++++++++ .../alphafine/images/smallsearch_normal.svg | 7 +++++++ 47 files changed, 248 insertions(+), 67 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/bbs/bbs_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/bbs/bug_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/bbs/center_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/bbs/facebook_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/bbs/help_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/bbs/need_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/bbs/question_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/bbs/sign_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/bbs/solution_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/bbs/video_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/chart/ChartType_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/data/dock/serverdatabase_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_help/demo_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_web/edit_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_web/function_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/server/platform_16_16_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/server/plugin_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/update/update_new_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x_normal.svg create mode 100644 designer-chart/src/main/resources/com/fr/van/chart/map/images/mapData_normal.svg create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/smallsearch_normal.svg diff --git a/designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java b/designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java index 98ad28c9c..b61b7d56f 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.community; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; @@ -13,15 +13,15 @@ import java.awt.event.ActionEvent; public class BBSAction extends UpdateAction { - + public BBSAction() { this.setMenuKeySet(BBS); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/bbs.png")); - + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/bbs/bbs_normal.svg")); + } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/community/BugAction.java b/designer-base/src/main/java/com/fr/design/actions/community/BugAction.java index d9c75321d..fe7dc986d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/BugAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/BugAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.community; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.BrowseUtils; @@ -17,8 +17,7 @@ public class BugAction extends UpdateAction { this.setMenuKeySet(BUG); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/bug.png")); - + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/bbs/bug_normal.svg")); } @Override @@ -29,7 +28,7 @@ public void actionPerformed(ActionEvent arg0) } public static final MenuKeySet BUG = new MenuKeySet() { - + @Override public String getMenuName() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Bug"); @@ -43,7 +42,7 @@ public void actionPerformed(ActionEvent arg0) @Override public char getMnemonic() { - + return 'U'; } }; diff --git a/designer-base/src/main/java/com/fr/design/actions/community/BugNeedAction.java b/designer-base/src/main/java/com/fr/design/actions/community/BugNeedAction.java index 17ee23b53..9f3419758 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/BugNeedAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/BugNeedAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.community; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.locale.impl.BugNeedMark; import com.fr.design.menu.MenuKeySet; @@ -20,7 +20,7 @@ public class BugNeedAction extends UpdateAction { this.setMenuKeySet(BugAndNeed); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/need.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/bbs/need_normal.svg")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java b/designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java index 3ba97c0fc..3977858c5 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.community; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.BrowseUtils; import com.fr.general.CloudCenter; @@ -17,7 +17,7 @@ public class CenterAction extends UpAction{ this.setMenuKeySet(CENTER); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/center.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/bbs/center_normal.svg")); } diff --git a/designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java b/designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java index 9ab799bcc..8f0cc0470 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java @@ -1,10 +1,9 @@ package com.fr.design.actions.community; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.BrowseUtils; import com.fr.general.CloudCenter; -import com.fr.general.IOUtils; - import javax.swing.KeyStroke; import java.awt.event.ActionEvent; @@ -14,7 +13,7 @@ public class FacebookFansAction extends UpAction { this.setMenuKeySet(FACEBOOKFANS); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/facebook.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/bbs/facebook_normal.svg")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java b/designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java index c604e51d0..d73f7630a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.community; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.BrowseUtils; @@ -18,7 +18,7 @@ public class NeedAction extends UpdateAction this.setMenuKeySet(NEED); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/need.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/bbs/need_normal.svg")); } diff --git a/designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java b/designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java index 9a19ef4cc..a80118a6a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.community; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.BrowseUtils; @@ -16,7 +16,7 @@ public class QuestionAction extends UpdateAction { this.setMenuKeySet(QUESTIONS); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/question.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/bbs/question_normal.svg")); } diff --git a/designer-base/src/main/java/com/fr/design/actions/community/SignAction.java b/designer-base/src/main/java/com/fr/design/actions/community/SignAction.java index c08619b23..9f73afa56 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/SignAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/SignAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.community; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; @@ -19,8 +19,7 @@ public class SignAction extends UpdateAction this.setMenuKeySet(SIGN); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/sign.png")); - + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/bbs/sign_normal.svg")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java b/designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java index a09921609..b86a13008 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.community; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.BrowseUtils; @@ -21,7 +21,7 @@ public class TechSolutionAction extends UpdateAction{ this.setMenuKeySet(TSO); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/solution.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/bbs/solution_normal.svg")); } diff --git a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java index f3cb21bc7..3cc8c945f 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java @@ -1,10 +1,10 @@ package com.fr.design.actions.community; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.locale.impl.VideoMark; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.BrowseUtils; -import com.fr.general.IOUtils; import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleMark; @@ -20,8 +20,7 @@ public class VideoAction extends UpdateAction this.setMenuKeySet(VIDEO); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/video.png")); - + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/bbs/video_normal.svg")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java index 5de31eb31..2c6a23620 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java @@ -1,10 +1,10 @@ package com.fr.design.actions.help; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; -import com.fr.general.IOUtils; import com.fr.general.http.HttpToolbox; import com.fr.log.FineLoggerFactory; import com.fr.stable.CommonUtils; @@ -28,7 +28,7 @@ public class TutorialAction extends UpdateAction { this.setMenuKeySet(HELP_TUTORIAL); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/help.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/bbs/help_normal.svg")); this.setAccelerator(getMenuKeySet().getKeyStroke()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java b/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java index 613982abd..5b18dd2c3 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.help; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; @@ -16,7 +16,7 @@ public class WebDemoAction extends UpdateAction { this.setMenuKeySet(PRODUCT_DEMO); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_help/demo.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_help/demo_normal.svg")); } /** @@ -45,4 +45,4 @@ public class WebDemoAction extends UpdateAction { } }; -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java index f78d341a5..a5c0432f2 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java @@ -1,5 +1,6 @@ package com.fr.design.actions.help.alphafine; +import com.fr.base.svg.SVGIcon; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; @@ -8,7 +9,6 @@ import com.fr.design.dialog.DialogActionListener; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; -import com.fr.general.IOUtils; import javax.swing.KeyStroke; import java.awt.event.ActionEvent; @@ -21,7 +21,7 @@ public class AlphaFineAction extends UpdateAction { this.setMenuKeySet(ALPHAFINE); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png")); + this.setSmallIcon(SVGIcon.readSVGIcon("com/fr/design/mainframe/alphafine/images/smallsearch_normal.svg")); this.generateAndSetSearchText(AlphaFineConfigPane.class.getName()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java index bbc324ffd..a8302fd9f 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java @@ -4,6 +4,7 @@ package com.fr.design.actions.server; +import com.fr.base.svg.SVGIconUtils; import com.fr.config.Configuration; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; @@ -12,7 +13,6 @@ import com.fr.design.formula.FunctionManagerPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.MenuKeySet; import com.fr.file.FunctionConfig; -import com.fr.general.IOUtils; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; @@ -29,7 +29,7 @@ public class FunctionManagerAction extends UpdateAction { this.setMenuKeySet(FUNCTION_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()+"..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/function.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_web/function_normal.svg")); this.generateAndSetSearchText(FunctionManagerPane.class.getName()); } @@ -63,7 +63,7 @@ public class FunctionManagerAction extends UpdateAction { functionManagerPane.populate(mirror); functionManagerDialog.setVisible(true); } - + public void update() { this.setEnabled(true); } @@ -84,4 +84,4 @@ public class FunctionManagerAction extends UpdateAction { return null; } }; -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java index c546129e9..d3ecb7f97 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java @@ -3,8 +3,8 @@ */ package com.fr.design.actions.server; -import com.fr.base.BaseUtils; import com.fr.base.ParameterConfig; +import com.fr.base.svg.SVGIconUtils; import com.fr.config.ServerPreferenceConfig; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; @@ -31,7 +31,7 @@ public class GlobalParameterAction extends UpdateAction { this.setMenuKeySet(GLOBAL_PARAMETER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/p.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_report/p_normal.svg")); } /** @@ -91,4 +91,4 @@ public class GlobalParameterAction extends UpdateAction { return null; } }; -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index 627a862fb..02965e1aa 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java @@ -3,8 +3,8 @@ */ package com.fr.design.actions.server; -import com.fr.base.BaseUtils; import com.fr.base.TableData; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.data.DesignTableDataManager; @@ -40,7 +40,7 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS this.setMenuKeySet(SERVER_TABLEDATA); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase_normal.svg")); } public static final MenuKeySet SERVER_TABLEDATA = new MenuKeySet() { @@ -70,7 +70,7 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS final TableDataConfig tableDataConfig = TableDataConfig.getInstance(); final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { public void complete() { - + TableDataConfig mirror = tableDataConfig.mirror(); populate(mirror); } @@ -166,4 +166,4 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS public void fireDSChanged(Map map) { DesignTableDataManager.fireDSChanged(map); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java index 5f364303a..42e802ea7 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.server; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.DesignUtils; @@ -14,7 +14,7 @@ public class PlatformManagerAction extends UpdateAction { this.setMenuKeySet(PLATEFORM_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/server/platform_16_16.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/server/platform_16_16_normal.svg")); } /** @@ -41,4 +41,4 @@ public class PlatformManagerAction extends UpdateAction { return null; } }; -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java index d000dbbbb..6c8a6790a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java @@ -1,9 +1,9 @@ package com.fr.design.actions.server; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.design.os.impl.PMDialogAction; -import com.fr.general.IOUtils; import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; @@ -20,7 +20,7 @@ public class PluginManagerAction extends UpdateAction { this.setMenuKeySet(PLUGIN_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/server/plugin.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/server/plugin_normal.svg")); } @Override public void actionPerformed(ActionEvent e) { @@ -45,4 +45,4 @@ public class PluginManagerAction extends UpdateAction { return null; } }; -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java index f48cb12ed..ca6558826 100644 --- a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java @@ -1,6 +1,6 @@ package com.fr.design.remote.action; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -27,7 +27,7 @@ public class RemoteDesignAuthManagerAction extends UpdateAction { public RemoteDesignAuthManagerAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Authority_Manager")); // 远程设计权限管理 - this.setSmallIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x.png")); + this.setSmallIcon(SVGIconUtils.readIcon("com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x_normal.svg")); } diff --git a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java index d65d8fec5..5282d1246 100644 --- a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java @@ -1,6 +1,6 @@ package com.fr.design.update.actions; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.os.impl.UpdateDialogAction; import com.fr.stable.os.support.OSBasedAction; @@ -15,7 +15,7 @@ public class SoftwareUpdateAction extends UpdateAction { public SoftwareUpdateAction() { setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_UpdateAndUpgrade")); - setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/update/update_new.png")); + setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/update/update_new_normal.svg")); } diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/bbs_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/bbs_normal.svg new file mode 100644 index 000000000..4a9711e35 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/bbs_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/首页_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/bug_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/bug_normal.svg new file mode 100644 index 000000000..d3f4a599e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/bug_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/bug反馈_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/center_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/center_normal.svg new file mode 100644 index 000000000..4fbcfa77d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/center_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/活动中心_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/facebook_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/facebook_normal.svg new file mode 100644 index 000000000..be85b39f1 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/facebook_normal.svg @@ -0,0 +1,9 @@ + + + icon_facebook粉丝圈_normal + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/help_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/help_normal.svg new file mode 100644 index 000000000..d5b808fc9 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/help_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/帮助文档_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/need_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/need_normal.svg new file mode 100644 index 000000000..ab21bc50f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/need_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/需求反馈_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/question_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/question_normal.svg new file mode 100644 index 000000000..e94015aaf --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/question_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/问题求助_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/sign_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/sign_normal.svg new file mode 100644 index 000000000..3f3f3d875 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/sign_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/报表工程师认证_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/solution_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/solution_normal.svg new file mode 100644 index 000000000..1538ce2cf --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/solution_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/技术方案_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/video_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/video_normal.svg new file mode 100644 index 000000000..2cde6094d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/video_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/视频教程_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/chart/ChartType_normal.svg b/designer-base/src/main/resources/com/fr/design/images/chart/ChartType_normal.svg new file mode 100644 index 000000000..b4e4dcb5b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/chart/ChartType_normal.svg @@ -0,0 +1,9 @@ + + + icon_图表预定义配色_normal + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/data/dock/serverdatabase_normal.svg b/designer-base/src/main/resources/com/fr/design/images/data/dock/serverdatabase_normal.svg new file mode 100644 index 000000000..0371b6c90 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/data/dock/serverdatabase_normal.svg @@ -0,0 +1,13 @@ + + + icon_服务器数据集_normal + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_help/demo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_help/demo_normal.svg new file mode 100644 index 000000000..6f18bd2f0 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_help/demo_normal.svg @@ -0,0 +1,7 @@ + + + icon_产品演示_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/edit_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/edit_normal.svg new file mode 100644 index 000000000..8145a3a18 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/edit_normal.svg @@ -0,0 +1,8 @@ + + + icon_服务器配置_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/function_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/function_normal.svg new file mode 100644 index 000000000..349c6ae7a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/function_normal.svg @@ -0,0 +1,7 @@ + + + icon_函数管理器_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/server/platform_16_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/server/platform_16_16_normal.svg new file mode 100644 index 000000000..2363d22f2 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/server/platform_16_16_normal.svg @@ -0,0 +1,8 @@ + + + icon_报表平台管理_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/server/plugin_normal.svg b/designer-base/src/main/resources/com/fr/design/images/server/plugin_normal.svg new file mode 100644 index 000000000..0ecf1d294 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/server/plugin_normal.svg @@ -0,0 +1,8 @@ + + + icon_插件管理_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/update/update_new_normal.svg b/designer-base/src/main/resources/com/fr/design/images/update/update_new_normal.svg new file mode 100644 index 000000000..c163c82f2 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/update/update_new_normal.svg @@ -0,0 +1,7 @@ + + + icon_更新升级_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x_normal.svg b/designer-base/src/main/resources/com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x_normal.svg new file mode 100644 index 000000000..d4e2a743e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x_normal.svg @@ -0,0 +1,9 @@ + + + icon_远程设计权限管理_normal + + + + + + \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java index 5d7a9e67d..74e352207 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java @@ -1,6 +1,7 @@ package com.fr.design.module; import com.fr.base.ChartPreStyleConfig; +import com.fr.base.svg.SVGIconUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; @@ -8,7 +9,6 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; -import com.fr.general.IOUtils; import com.fr.module.ModuleContext; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; @@ -33,7 +33,7 @@ public class ChartPreStyleAction extends UpdateAction { this.setMenuKeySet(CHART_DEFAULT_STYLE); this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/chart/ChartType.png")); + this.setSmallIcon(SVGIconUtils.readIcon("com/fr/design/images/chart/ChartType_normal.svg")); this.generateAndSetSearchText(ChartPreStyleManagerPane.class.getName()); } @@ -101,4 +101,4 @@ public class ChartPreStyleAction extends UpdateAction { return null; } }; -} \ No newline at end of file +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java b/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java index dc64adef1..9eaf19ed1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java @@ -1,10 +1,10 @@ package com.fr.van.chart.map.server; import com.fr.base.ServerConfig; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.general.GeneralContext; -import com.fr.general.IOUtils; import com.fr.start.ServerStarter; import com.fr.workspace.WorkContext; @@ -17,7 +17,7 @@ import java.awt.event.ActionEvent; public class ChartMapEditorAction extends UpdateAction { public ChartMapEditorAction(){ - this.setSmallIcon(IOUtils.readIcon("/com/fr/van/chart/map/images/mapData.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/van/chart/map/images/mapData_normal.svg")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Data")); } diff --git a/designer-chart/src/main/resources/com/fr/van/chart/map/images/mapData_normal.svg b/designer-chart/src/main/resources/com/fr/van/chart/map/images/mapData_normal.svg new file mode 100644 index 000000000..086e6d9ef --- /dev/null +++ b/designer-chart/src/main/resources/com/fr/van/chart/map/images/mapData_normal.svg @@ -0,0 +1,8 @@ + + + icon_地图数据_normal + + + + + \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java index a75fa5d26..1c0e5b36c 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java @@ -3,6 +3,7 @@ */ package com.fr.design.actions.server; +import com.fr.base.svg.SVGIconUtils; import com.fr.config.Configuration; import com.fr.config.ServerPreferenceConfig; import com.fr.design.actions.UpdateAction; @@ -11,7 +12,6 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.MenuKeySet; import com.fr.design.webattr.EditReportServerParameterPane; -import com.fr.general.IOUtils; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; @@ -31,7 +31,7 @@ public class ServerConfigManagerAction extends UpdateAction { this.setMenuKeySet(SERVER_CONFIG_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/edit.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_web/edit_normal.svg")); this.generateAndSetSearchText(EditReportServerParameterPane.class.getName()); } @@ -45,7 +45,7 @@ public class ServerConfigManagerAction extends UpdateAction { final EditReportServerParameterPane editReportServerParameterPane = new EditReportServerParameterPane() { @Override public void complete() { - + ServerPreferenceConfig mirror = config.mirror(); populate(mirror); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java index 97b496324..cd0cbe4ef 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java @@ -1,5 +1,6 @@ package com.fr.design.actions.server; +import com.fr.base.svg.SVGIconUtils; import com.fr.config.Configuration; import com.fr.config.ServerPreferenceConfig; import com.fr.design.actions.UpdateAction; @@ -31,7 +32,7 @@ public class StyleListAction extends UpdateAction { this.setMenuKeySet(PREDEFINED_STYLES); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_web/style_normal.svg")); this.generateAndSetSearchText(StyleManagerPane.class.getName()); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java index df432c7ad..713ce1ad5 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.server; -import com.fr.base.BaseUtils; +import com.fr.base.svg.SVGIconUtils; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; @@ -23,7 +23,7 @@ public class WidgetManagerAction extends UpdateAction { this.setMenuKeySet(WIDGET_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/modified.png")); + this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_format/modified_normal.svg")); } /** diff --git a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java index 911533437..eacddf20c 100644 --- a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java +++ b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java @@ -52,6 +52,7 @@ public class ImagePreLoader { "/com/fr/design/images/m_file/preview.png", "com/fr/base/images/cell/blank.gif", "com/fr/design/images/data/dock/serverdatabase.png", + "com/fr/design/images/data/dock/serverdatabase_normal.svg", "/com/fr/design/images/data/dock/serverclasstabledata.png", "/com/fr/design/images/data/dock/serverdatatable.png", "/com/fr/design/images/data/file.png", @@ -74,6 +75,7 @@ public class ImagePreLoader { "com/fr/design/images/buttonicon/run24.png", "com/fr/design/images/buttonicon/runs.png", "com/fr/design/mainframe/alphafine/images/smallsearch.png", + "com/fr/design/mainframe/alphafine/images/smallsearch_normal.svg", "com/fr/design/images/buttonicon/pageb24.png", "com/fr/design/images/buttonicon/writeb24.png", "com/fr/design/images/buttonicon/anab24.png", @@ -126,6 +128,7 @@ public class ImagePreLoader { "com/fr/design/images/control/tab/remove.png", "com/fr/design/images/m_file/preview.png", "com/fr/design/images/m_web/connection.png", + "com/fr/design/images/m_web/connection_normal.svg", "com/fr/design/images/control/addPopup.png", "com/fr/design/images/buttonicon/propertiestab/cellelement_normal.png", "com/fr/design/images/buttonicon/propertiestab/cellattr_normal.png", @@ -151,6 +154,7 @@ public class ImagePreLoader { "com/fr/design/images/data/bind/localconnect.png", "com/fr/design/images/gui/tab_add_normal.png", "com/fr/design/images/m_help/demo.png", + "com/fr/design/images/m_help/demo_normal.svg", "com/fr/design/images/gui/tab_add_hover.png", "com/fr/design/images/gui/tab_add_click.png", "com/fr/design/images/gui/tab_delete.png", @@ -161,6 +165,17 @@ public class ImagePreLoader { "com/fr/design/images/update.png", "com/fr/design/images/need.png", "com/fr/design/images/bug.png", + "/com/fr/design/images/bbs/video_normal.svg", + "/com/fr/design/images/bbs/help_normal.svg", + "/com/fr/design/images/bbs/bbs_normal.svg", + "/com/fr/design/images/bbs/question_normal.svg", + "/com/fr/design/images/bbs/solution_normal.svg", + "/com/fr/design/images/bbs/bug_normal.svg", + "/com/fr/design/images/bbs/need_normal.svg", + "/com/fr/design/images/bbs/center_normal.svg", + "/com/fr/design/images/bbs/sign_normal.svg", + "/com/fr/design/images/bbs/facebook_normal.svg", + "/com/fr/design/images/update/update_new_normal.svg", "com/fr/design/images/signature.png", "com/fr/design/images/m_file/switch.png", "com/fr/design/images/gui/blank.gif", @@ -179,7 +194,9 @@ public class ImagePreLoader { "com/fr/design/images/gui/frm.png", "com/fr/design/images/gui/cht.png", "com/fr/design/images/chart/ChartType.png", + "com/fr/design/images/chart/ChartType_normal.svg", "com/fr/van/chart/map/images/mapData.png", + "com/fr/van/chart/map/images/mapData_normal.svg", "com/fr/design/images/buttonicon/add.png", "com/fr/base/images/cell/control/remove.png", "com/fr/design/images/control/up.png", @@ -445,14 +462,18 @@ public class ImagePreLoader { "com/fr/web/images/email.png", "com/fr/web/images/preview.png", "com/fr/design/images/server/platform_16_16.png", + "com/fr/design/images/server/platform_16_16_normal.svg", "com/fr/design/images/data/user_widget.png", "com/fr/design/images/server/plugin.png", + "com/fr/design/images/server/plugin_normal.svg", "com/fr/web/images/excel.png", "com/fr/design/images/m_web/function.png", + "com/fr/design/images/m_web/function_normal.svg", "com/fr/web/images/word.png", "com/fr/web/images/pageSetup.png", "com/fr/web/images/export.png", "com/fr/design/images/m_web/edit.png", + "com/fr/design/images/m_web/edit_normal.svg", "com/fr/web/images/pageNumber.png", "com/fr/web/images/first.png", "com/fr/design/images/m_web/style.png", diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/smallsearch_normal.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/smallsearch_normal.svg new file mode 100644 index 000000000..2bd8d0a15 --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/smallsearch_normal.svg @@ -0,0 +1,7 @@ + + + icon_搜索_normal + + + + \ No newline at end of file From ed8b98823c31ed4e913f1fa49af79fef2396e88d Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 24 Dec 2020 15:26:31 +0800 Subject: [PATCH 027/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.12:?= =?UTF-8?q?=20=E5=88=A0=E9=99=A4=E8=AF=AF=E4=BC=A0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/base/svg/IconType.java | 62 ------------------- 1 file changed, 62 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/base/svg/IconType.java diff --git a/designer-base/src/main/java/com/fr/base/svg/IconType.java b/designer-base/src/main/java/com/fr/base/svg/IconType.java deleted file mode 100644 index 7df9a0954..000000000 --- a/designer-base/src/main/java/com/fr/base/svg/IconType.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.fr.base.svg; - -import com.fr.stable.StringUtils; - -/** - * @author Yvan - * @version 10.0 - * Created by Yvan on 2020/12/22 - */ -public enum IconType { - - /** - * png图片转化的Icon - */ - PNG(".png", 0), - /** - * svg图片转化的normalIcon - */ - NORMAL_SVG("_normal", 1), - /** - * SVG图片转化的disabledIcon - */ - DISABLED_SVG("_disabled", 2), - /** - * SVG图片转化的selectedIcon - */ - SELECTED_SVG("_selected", 3); - - private String iconType; - private int iconCode; - - IconType(String iconType, int iconCode) { - this.iconType = iconType; - this.iconCode = iconCode; - } - - public String getIconType() { - return iconType; - } - - public void setIconType(String iconType) { - this.iconType = iconType; - } - - public int getIconCode() { - return iconCode; - } - - public void setIconCode(int iconCode) { - this.iconCode = iconCode; - } - - public static String getIconType(int iconCode) { - for (IconType iconType : IconType.values()) { - if (iconType.getIconCode() == iconCode) { - return iconType.getIconType(); - } - } - return StringUtils.EMPTY; - } - -} From f1c52d9fbc48aa732d82bfaad5b02f11e07fb123 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 24 Dec 2020 15:39:27 +0800 Subject: [PATCH 028/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.13:?= =?UTF-8?q?=20=E4=B8=8A=E4=BC=A0=E4=B8=8B=E5=9B=A0=E4=B8=BA=E4=B9=8B?= =?UTF-8?q?=E5=89=8D=E4=BB=A3=E7=A0=81=E5=86=B2=E7=AA=81=E4=B8=A2=E5=A4=B1?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/actions/report/ReportPageAttrAction.java | 2 +- .../src/main/java/com/fr/start/preload/ImagePreLoader.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java index eb409a8e3..389b1991a 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java @@ -28,7 +28,7 @@ public class ReportPageAttrAction extends ReportComponentAction Date: Thu, 24 Dec 2020 15:56:04 +0800 Subject: [PATCH 029/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.14:?= =?UTF-8?q?=20=E5=B0=86SVGIconUtils=E7=9A=84=E5=90=8D=E5=AD=97=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BAIconUtils?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../svg/{SVGIconUtils.java => IconUtils.java} | 2 +- .../actions/AllowAuthorityEditAction.java | 4 +-- .../actions/ExitAuthorityEditAction.java | 5 ++- .../design/actions/TableDataSourceAction.java | 4 +-- .../com/fr/design/actions/UpdateAction.java | 12 +++---- .../design/actions/community/BBSAction.java | 4 +-- .../design/actions/community/BugAction.java | 4 +-- .../actions/community/BugNeedAction.java | 4 +-- .../actions/community/CenterAction.java | 4 +-- .../actions/community/FacebookFansAction.java | 4 +-- .../design/actions/community/NeedAction.java | 4 +-- .../actions/community/QuestionAction.java | 4 +-- .../design/actions/community/SignAction.java | 4 +-- .../actions/community/TechSolutionAction.java | 4 +-- .../design/actions/community/VideoAction.java | 4 +-- .../actions/file/OpenTemplateAction.java | 4 +-- .../actions/file/SaveAsTemplateAction.java | 4 +-- .../design/actions/file/SwitchExistEnv.java | 6 ++-- .../design/actions/help/TutorialAction.java | 4 +-- .../fr/design/actions/help/WebDemoAction.java | 4 +-- .../actions/server/ConnectionListAction.java | 4 +-- .../actions/server/FunctionManagerAction.java | 4 +-- .../actions/server/GlobalParameterAction.java | 4 +-- .../actions/server/GlobalTableDataAction.java | 4 +-- .../actions/server/PlatformManagerAction.java | 4 +-- .../actions/server/PluginManagerAction.java | 4 +-- .../com/fr/design/constants/UIConstants.java | 4 +-- .../com/fr/design/gui/core/WidgetOption.java | 32 +++++++++---------- .../com/fr/design/gui/ibutton/UIButton.java | 6 ++-- .../mainframe/EastRegionContainerPane.java | 10 +++--- .../main/java/com/fr/design/menu/MenuDef.java | 6 ++-- .../action/RemoteDesignAuthManagerAction.java | 4 +-- .../fit/menupane/ReportFitAttrAction.java | 5 ++- .../style/color/UIToolbarColorButton.java | 4 +-- .../update/actions/SoftwareUpdateAction.java | 4 +-- .../fr/design/module/ChartPreStyleAction.java | 4 +-- .../map/server/ChartMapEditorAction.java | 4 +-- .../com/fr/design/actions/NewFormAction.java | 4 +-- .../form/parameter/FormParaTargetMode.java | 4 +-- .../fr/design/gui/core/FormWidgetOption.java | 10 +++--- .../design/mainframe/FormParaWidgetPane.java | 4 +-- .../fr/design/mainframe/FormTargetMode.java | 4 +-- .../actions/cell/CellAttributeAction.java | 4 +-- .../actions/cell/CellExpandAttrAction.java | 4 +-- .../actions/cell/CellWidgetAttrAction.java | 5 ++- .../cell/ConditionAttributesAction.java | 4 +-- .../design/actions/cell/EditCellAction.java | 4 +-- .../actions/cell/UIToolbarBorderButton.java | 4 +-- .../actions/cell/style/AlignmentAction.java | 8 ++--- .../cell/style/ReportFontBoldAction.java | 4 +-- .../style/ReportFontForegroundAction.java | 4 +-- .../cell/style/ReportFontItalicAction.java | 4 +-- .../cell/style/ReportFontUnderlineAction.java | 4 +-- .../cell/style/StyleBackgroundAction.java | 4 +-- .../actions/columnrow/InsertColumnAction.java | 5 ++- .../actions/columnrow/InsertRowAction.java | 4 +-- .../design/actions/edit/HyperlinkAction.java | 4 +-- .../file/newReport/NewPolyReportAction.java | 4 +-- .../file/newReport/NewWorkBookAction.java | 4 +-- .../report/ReportBackgroundAction.java | 4 +-- .../actions/report/ReportColumnsAction.java | 4 +-- .../report/ReportEngineAttrAction.java | 4 +-- .../report/ReportExportAttrAction.java | 4 +-- .../actions/report/ReportFooterAction.java | 4 +-- .../actions/report/ReportHeaderAction.java | 4 +-- .../report/ReportMobileAttrAction.java | 5 ++- .../actions/report/ReportPageAttrAction.java | 5 ++- .../actions/report/ReportPageSetupAction.java | 4 +-- .../actions/report/ReportParameterAction.java | 4 +-- .../report/ReportPrintSettingAction.java | 4 +-- .../actions/report/ReportWatermarkAction.java | 4 +-- .../actions/report/ReportWebAttrAction.java | 4 +-- .../actions/report/ReportWriteAttrAction.java | 4 +-- .../server/ServerConfigManagerAction.java | 4 +-- .../actions/server/StyleListAction.java | 8 ++--- .../actions/server/WidgetManagerAction.java | 4 +-- .../fr/design/mainframe/SheetNameTabPane.java | 18 +++++------ 77 files changed, 189 insertions(+), 199 deletions(-) rename designer-base/src/main/java/com/fr/base/svg/{SVGIconUtils.java => IconUtils.java} (99%) diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGIconUtils.java b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java similarity index 99% rename from designer-base/src/main/java/com/fr/base/svg/SVGIconUtils.java rename to designer-base/src/main/java/com/fr/base/svg/IconUtils.java index ba4aaa40f..e13ca53b2 100644 --- a/designer-base/src/main/java/com/fr/base/svg/SVGIconUtils.java +++ b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java @@ -12,7 +12,7 @@ import javax.swing.ImageIcon; * @version 10.0 * Created by Yvan on 2020/12/23 */ -public class SVGIconUtils { +public class IconUtils { private static final String ICON_SUFFIX_SVG = ".svg"; private static final String ICON_SUFFIX_PNG = ".png"; diff --git a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java index 048a8e193..890a4d877 100644 --- a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; @@ -22,7 +22,7 @@ public class AllowAuthorityEditAction extends TemplateComponentAction { this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit_normal.svg")); } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java index aca5f3f54..1b48f4c69 100644 --- a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java @@ -1,7 +1,6 @@ package com.fr.design.actions; -import com.fr.base.BaseUtils; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.DesignModelAdapter; @@ -20,7 +19,7 @@ public class ExitAuthorityEditAction extends TemplateComponentAction { public ExitAuthorityEditAction(TargetComponent t) { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Authority_Edit_Status_Exit")); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_report/exit_authority_edit_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_report/exit_authority_edit_normal.svg")); } diff --git a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java index 4420feb8f..1c77c31d4 100644 --- a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java @@ -1,7 +1,7 @@ package com.fr.design.actions; import javax.swing.SwingUtilities; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.data.DesignTableDataManager; import com.fr.data.TableDataSource; import com.fr.design.data.datapane.ReportTableDataPane; @@ -26,7 +26,7 @@ public class TableDataSourceAction extends TemplateComponentAction> { this.setMenuKeySet(KeySetUtils.SAVE_AS_TEMPLATE); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_file/saveAs_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_file/saveAs_normal.svg")); } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index d8cf3eff1..99cc7ef33 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -1,6 +1,6 @@ package com.fr.design.actions.file; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.EnvChangeEntrance; import com.fr.design.actions.UpdateAction; @@ -42,11 +42,11 @@ public class SwitchExistEnv extends MenuDef { DesignerWorkspaceInfo env = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); switch (env.getType()) { case Local: { - this.setSmallIcon(SVGIconUtils.readIcon("com/fr/design/images/data/bind/localconnect_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("com/fr/design/images/data/bind/localconnect_normal.svg")); break; } case Remote: { - this.setSmallIcon(SVGIconUtils.readIcon("com/fr/design/images/data/bind/distanceconnect_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("com/fr/design/images/data/bind/distanceconnect_normal.svg")); break; } } diff --git a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java index 2c6a23620..a55b429aa 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.help; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.general.CloudCenter; @@ -28,7 +28,7 @@ public class TutorialAction extends UpdateAction { this.setMenuKeySet(HELP_TUTORIAL); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/bbs/help_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/bbs/help_normal.svg")); this.setAccelerator(getMenuKeySet().getKeyStroke()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java b/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java index 5b18dd2c3..0785de9cc 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.help; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; @@ -16,7 +16,7 @@ public class WebDemoAction extends UpdateAction { this.setMenuKeySet(PRODUCT_DEMO); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_help/demo_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_help/demo_normal.svg")); } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index ca7bf90f7..705644da2 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.server; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.data.impl.Connection; import com.fr.design.actions.UpdateAction; import com.fr.design.data.datapane.connect.ConnectionShowPane; @@ -26,7 +26,7 @@ public class ConnectionListAction extends UpdateAction { this.setMenuKeySet(DEFINE_DATA_CONNECTION); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_web/connection_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_web/connection_normal.svg")); this.generateAndSetSearchText(DatabaseConnectionPane.JDBC.class.getName()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java index a8302fd9f..2fbe47f39 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java @@ -4,7 +4,7 @@ package com.fr.design.actions.server; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.config.Configuration; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; @@ -29,7 +29,7 @@ public class FunctionManagerAction extends UpdateAction { this.setMenuKeySet(FUNCTION_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()+"..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_web/function_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_web/function_normal.svg")); this.generateAndSetSearchText(FunctionManagerPane.class.getName()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java index d3ecb7f97..7dc3474ae 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java @@ -4,7 +4,7 @@ package com.fr.design.actions.server; import com.fr.base.ParameterConfig; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.config.ServerPreferenceConfig; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; @@ -31,7 +31,7 @@ public class GlobalParameterAction extends UpdateAction { this.setMenuKeySet(GLOBAL_PARAMETER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_report/p_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_report/p_normal.svg")); } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index 02965e1aa..53988db0d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java @@ -4,7 +4,7 @@ package com.fr.design.actions.server; import com.fr.base.TableData; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.data.DesignTableDataManager; @@ -40,7 +40,7 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS this.setMenuKeySet(SERVER_TABLEDATA); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase_normal.svg")); } public static final MenuKeySet SERVER_TABLEDATA = new MenuKeySet() { diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java index 42e802ea7..b6f1f4c25 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.server; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.DesignUtils; @@ -14,7 +14,7 @@ public class PlatformManagerAction extends UpdateAction { this.setMenuKeySet(PLATEFORM_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/server/platform_16_16_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/server/platform_16_16_normal.svg")); } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java index 6c8a6790a..329857878 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.server; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.design.os.impl.PMDialogAction; @@ -20,7 +20,7 @@ public class PluginManagerAction extends UpdateAction { this.setMenuKeySet(PLUGIN_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/server/plugin_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/server/plugin_normal.svg")); } @Override public void actionPerformed(ActionEvent e) { diff --git a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java index e8d11afe8..19ae615d4 100644 --- a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java +++ b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java @@ -3,7 +3,7 @@ */ package com.fr.design.constants; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.general.IOUtils; import com.fr.stable.Constants; @@ -180,7 +180,7 @@ public interface UIConstants { public static final Icon YES_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/yes.png"); public static final Icon CHOOSEN_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/select_item.png"); public static final Icon PRE_WIDGET_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/prewidget.png"); - public static final Icon PRE_WIDGET_NORMAL_ICON = SVGIconUtils.readIcon("com/fr/design/images/buttonicon/prewidget_normal.svg"); + public static final Icon PRE_WIDGET_NORMAL_ICON = IconUtils.readIcon("com/fr/design/images/buttonicon/prewidget_normal.svg"); public static final Icon EDIT_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editn.png"); public static final Icon EDIT_PRESSED_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editp.png"); public static final Icon HIDE_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/hiden.png"); diff --git a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java index 0773dd41a..9dc110346 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java @@ -1,7 +1,7 @@ package com.fr.design.gui.core; import com.fr.base.BaseUtils; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.form.ui.*; import com.fr.general.ComparatorUtils; @@ -128,27 +128,27 @@ public abstract class WidgetOption implements Serializable { } public static final WidgetOption DATEEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Date"), - SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/date_16_normal.svg"), + IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/date_16_normal.svg"), DateEditor.class); public static final WidgetOption TREE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_View_Tree"), - SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/tree_16_normal.svg"), TreeEditor.class); + IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/tree_16_normal.svg"), TreeEditor.class); - public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_ComboBox"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/comboboxtree16_normal.svg"), + public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_ComboBox"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/comboboxtree16_normal.svg"), TreeComboBoxEditor.class); public static final WidgetOption CHECKBOXGROUP = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox_Group"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg"), CheckBoxGroup.class); + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox_Group"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg"), CheckBoxGroup.class); public static final WidgetOption RADIOGROUP = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Radio_Group"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_group_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Radio_Group"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_group_16_normal.svg"), RadioGroup.class); public static final WidgetOption NUMBEREDITOR = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Number"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/number_field_16_normal.svg"), NumberEditor.class); + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Number"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/number_field_16_normal.svg"), NumberEditor.class); public static final WidgetOption LABEL = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Label"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/label_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Label"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/label_16_normal.svg"), Label.class); public static final WidgetOption BUTTON = WidgetOptionFactory.createByWidgetClass( @@ -156,23 +156,23 @@ public abstract class WidgetOption implements Serializable { Button.class); public static final WidgetOption FREEBUTTON = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Button"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Button"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_16_normal.svg"), FreeButton.class); public static final WidgetOption MULTI_FILEEDITOR = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_File"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/files_up_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_File"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/files_up_normal.svg"), MultiFileEditor.class); public static final WidgetOption COMBOBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Box"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Box"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg"), ComboBox.class); public static final WidgetOption COMBOCHECKBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Checkbox"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Checkbox"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg"), ComboCheckBox.class); public static final WidgetOption CHECKBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/check_box_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/check_box_16_normal.svg"), CheckBox.class); public static final WidgetOption LIST = WidgetOptionFactory.createByWidgetClass( @@ -182,16 +182,16 @@ public abstract class WidgetOption implements Serializable { public static final WidgetOption TEXTEDITOR = WidgetOptionFactory.createByWidgetClass( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Text") - , SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_field_16_normal.svg"), + , IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_field_16_normal.svg"), TextEditor.class); public static final WidgetOption TEXTAREA = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Textarea"), SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_area_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Textarea"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_area_16_normal.svg"), TextArea.class); public static final WidgetOption PASSWORD = WidgetOptionFactory.createByWidgetClass( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Password"), - SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/widget/password_field_16_normal.svg"), Password.class); + IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/password_field_16_normal.svg"), Password.class); public static final WidgetOption IFRAMEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Form_Iframe"), BaseUtils.readIcon("/com/fr/web/images/form/resources/iframe_16.png"), IframeEditor.class); diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java index ea592a072..335397d90 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java @@ -3,7 +3,7 @@ package com.fr.design.gui.ibutton; import com.fr.base.BaseUtils; import com.fr.base.CellBorderStyle; import com.fr.base.GraphHelper; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.constants.UIConstants; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -99,9 +99,9 @@ public class UIButton extends JButton implements UIObserver, UITextComponent { } public UIButton(String resource, boolean needSetDisabledIcon) { - super(SVGIconUtils.readSVGIcon(resource, SVGIconUtils.ICON_TYPE_NORMAL)); + super(IconUtils.readSVGIcon(resource, IconUtils.ICON_TYPE_NORMAL)); if (needSetDisabledIcon) { - this.setDisabledIcon(SVGIconUtils.readSVGIcon(resource, SVGIconUtils.ICON_TYPE_DISABLED)); + this.setDisabledIcon(IconUtils.readSVGIcon(resource, IconUtils.ICON_TYPE_DISABLED)); } init(); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 6c625deb8..76422555f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -2,7 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.FRContext; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -891,7 +891,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void resetButtonIcon() { if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) { iconSuffix = ICON_SUFFIX_NORMAL; - button.setIcon(SVGIconUtils.readIcon(getBtnIconUrl())); + button.setIcon(IconUtils.readIcon(getBtnIconUrl())); button.setBackground(originBtnBackground); button.setOpaque(false); } @@ -900,7 +900,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void setTabButtonSelected() { resetPropertyIcons(); iconSuffix = ICON_SUFFIX_SELECTED; - button.setIcon(SVGIconUtils.readIcon(getBtnIconUrl())); + button.setIcon(IconUtils.readIcon(getBtnIconUrl())); button.setBackground(selectedBtnBackground); button.setOpaque(true); selectedItem = this; @@ -911,7 +911,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private void initButton() { - button = new UIButton(SVGIconUtils.readIcon(getBtnIconUrl())) { + button = new UIButton(IconUtils.readIcon(getBtnIconUrl())) { public Dimension getPreferredSize() { return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT); } @@ -924,7 +924,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } } }; - button.setDisabledIcon(SVGIconUtils.readIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED)); + button.setDisabledIcon(IconUtils.readIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED)); button.set4LargeToolbarButton(); button.setUI(new UIButtonUI() { @Override diff --git a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java index 8a0cf4aa8..f2ed81394 100644 --- a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java @@ -1,6 +1,6 @@ package com.fr.design.menu; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.*; import com.fr.design.gui.iscrollbar.UIScrollBar; @@ -166,7 +166,7 @@ public class MenuDef extends ShortCut { public UIButton createUIButton() { if (createdButton == null) { if (iconPath != null) { - createdButton = new UIButton(SVGIconUtils.readIcon(iconPath)); + createdButton = new UIButton(IconUtils.readIcon(iconPath)); createdButton.set4ToolbarButton(); } else { createdButton = new UIButton(name); @@ -194,7 +194,7 @@ public class MenuDef extends ShortCut { createdJMenu = createJMenu0(); createdJMenu.setMnemonic(this.getMnemonic()); if (this.iconPath != null) { - createdJMenu.setIcon(SVGIconUtils.readIcon(iconPath)); + createdJMenu.setIcon(IconUtils.readIcon(iconPath)); } MenuListener menuListener = createMenuListener(); createdJMenu.addMenuListener(menuListener); diff --git a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java index ca6558826..98e9c91ed 100644 --- a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java @@ -1,6 +1,6 @@ package com.fr.design.remote.action; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -27,7 +27,7 @@ public class RemoteDesignAuthManagerAction extends UpdateAction { public RemoteDesignAuthManagerAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Authority_Manager")); // 远程设计权限管理 - this.setSmallIcon(SVGIconUtils.readIcon("com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x_normal.svg")); } diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index 5befaa43e..160982228 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -1,6 +1,6 @@ package com.fr.design.report.fit.menupane; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.JTemplateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; @@ -9,7 +9,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuKeySet; -import com.fr.general.IOUtils; import com.fr.report.fit.FitProvider; import com.fr.report.fit.ReportFitAttr; @@ -67,7 +66,7 @@ public class ReportFitAttrAction extends JTemplateAction { } this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/reportfit/fit_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/reportfit/fit_normal.svg")); } /** diff --git a/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java b/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java index c0e9199fd..07c4c5739 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java +++ b/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java @@ -4,7 +4,7 @@ package com.fr.design.style.color; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; @@ -35,7 +35,7 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi private UIObserverListener uiObserverListener; public UIToolbarColorButton(Icon icon) { - super(new UIColorButton(icon), new UIButton(SVGIconUtils.readIcon("/com/fr/design/images/gui/popup_normal.svg"))); + super(new UIColorButton(icon), new UIButton(IconUtils.readIcon("/com/fr/design/images/gui/popup_normal.svg"))); getLeftButton().setEventBanned(true); getRightButton().addFocusListener(new FocusListener() { diff --git a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java index 5282d1246..dc65591e8 100644 --- a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java @@ -1,6 +1,6 @@ package com.fr.design.update.actions; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.os.impl.UpdateDialogAction; import com.fr.stable.os.support.OSBasedAction; @@ -15,7 +15,7 @@ public class SoftwareUpdateAction extends UpdateAction { public SoftwareUpdateAction() { setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_UpdateAndUpgrade")); - setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/update/update_new_normal.svg")); + setSmallIcon(IconUtils.readIcon("/com/fr/design/images/update/update_new_normal.svg")); } diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java index 74e352207..e0105b1b3 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java @@ -1,7 +1,7 @@ package com.fr.design.module; import com.fr.base.ChartPreStyleConfig; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; @@ -33,7 +33,7 @@ public class ChartPreStyleAction extends UpdateAction { this.setMenuKeySet(CHART_DEFAULT_STYLE); this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("com/fr/design/images/chart/ChartType_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("com/fr/design/images/chart/ChartType_normal.svg")); this.generateAndSetSearchText(ChartPreStyleManagerPane.class.getName()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java b/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java index 9eaf19ed1..25f16c52a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java @@ -1,7 +1,7 @@ package com.fr.van.chart.map.server; import com.fr.base.ServerConfig; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.general.GeneralContext; @@ -17,7 +17,7 @@ import java.awt.event.ActionEvent; public class ChartMapEditorAction extends UpdateAction { public ChartMapEditorAction(){ - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/van/chart/map/images/mapData_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/van/chart/map/images/mapData_normal.svg")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Data")); } diff --git a/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java index 1ea306685..3c4c491ca 100644 --- a/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java @@ -1,7 +1,7 @@ package com.fr.design.actions; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; @@ -21,7 +21,7 @@ public class NewFormAction extends UpdateAction { this.setMenuKeySet(NEW_FORM); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/new_form_for_dock_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/buttonicon/new_form_for_dock_normal.svg")); this.setAccelerator(getMenuKeySet().getKeyStroke()); } diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java index fa43aa097..e4e058af7 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java @@ -1,7 +1,7 @@ package com.fr.design.form.parameter; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.properties.WidgetPropertyTable; import com.fr.design.gui.core.WidgetOption; @@ -28,7 +28,7 @@ public class FormParaTargetMode extends FormDesignerModeForSpecial { public WidgetOption[] getPredefinedWidgetOptions() { return new WidgetOption[]{ WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Query_Button"), - SVGIconUtils.readIcon("/com/fr/web/images/form/resources/preview_16_normal.svg"), FormSubmitButton.class)}; + IconUtils.readIcon("/com/fr/web/images/form/resources/preview_16_normal.svg"), FormSubmitButton.class)}; } public ArrayList createRootDesignerPropertyGroup() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/CellAttributeAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/CellAttributeAction.java index 0266548c9..6d838ec70 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/CellAttributeAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/CellAttributeAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.cell; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.menu.KeySetUtils; @@ -12,7 +12,7 @@ public class CellAttributeAction extends CellAttributeTableAction { this.setMenuKeySet(KeySetUtils.CELL_OTHER_ATTR); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_format/cellAttr_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_format/cellAttr_normal.svg")); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/CellExpandAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/CellExpandAttrAction.java index d6ba64926..ce06b1b6f 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/CellExpandAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/CellExpandAttrAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.cell; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.menu.KeySetUtils; @@ -11,7 +11,7 @@ public class CellExpandAttrAction extends CellAttributeTableAction{ this.setMenuKeySet(KeySetUtils.CELL_EXPAND_ATTR); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/expand/cellAttr_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/expand/cellAttr_normal.svg")); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/CellWidgetAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/CellWidgetAttrAction.java index d33223217..5dee3a7f3 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/CellWidgetAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/CellWidgetAttrAction.java @@ -1,7 +1,6 @@ package com.fr.design.actions.cell; -import com.fr.base.BaseUtils; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.menu.KeySetUtils; @@ -17,7 +16,7 @@ public class CellWidgetAttrAction extends UpdateAction { this.setMenuKeySet(KeySetUtils.CELL_WIDGET_ATTR); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_format/modified_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_format/modified_normal.svg")); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/ConditionAttributesAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/ConditionAttributesAction.java index f73d7f8d0..70d163d69 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/ConditionAttributesAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/ConditionAttributesAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.cell; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.menu.KeySetUtils; @@ -18,7 +18,7 @@ public class ConditionAttributesAction extends UpdateAction { this.setMenuKeySet(KeySetUtils.CONDITION_ATTR); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_format/highlight_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_format/highlight_normal.svg")); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/EditCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/EditCellAction.java index 01b6bbaac..9f88381bf 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/EditCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/EditCellAction.java @@ -4,7 +4,7 @@ package com.fr.design.actions.cell; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.ElementCaseAction; import com.fr.design.mainframe.ElementCasePane; @@ -20,7 +20,7 @@ public class EditCellAction extends ElementCaseAction { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit")); this.setMnemonic('I'); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/control/edit_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/control/edit_normal.svg")); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java b/designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java index c3f537fdc..7c605ec8d 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java @@ -2,7 +2,7 @@ package com.fr.design.actions.cell; import com.fr.base.CellBorderStyle; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; @@ -47,7 +47,7 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH private JPopupMenu popupWin; public UIToolbarBorderButton(Icon icon, ElementCasePane reportPane) { - super(new UIButton(icon), new UIButton(SVGIconUtils.readIcon("/com/fr/design/images/gui/popup_normal.svg"))); + super(new UIButton(icon), new UIButton(IconUtils.readIcon("/com/fr/design/images/gui/popup_normal.svg"))); this.reportPane = reportPane; } diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java index 7d34a6038..91ca79f30 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java @@ -4,7 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.chart.BaseChartCollection; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.ButtonGroupAction; import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.constants.UIConstants; @@ -23,9 +23,9 @@ import javax.swing.*; public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface { private static final Icon[][] ICONS = new Icon[][]{ - {SVGIconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.svg"), SVGIconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_selected.svg")}, - {SVGIconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.svg"), SVGIconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_selected.svg")}, - {SVGIconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.svg"), SVGIconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_selected.svg")}}; + {IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.svg"), IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_selected.svg")}, + {IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.svg"), IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_selected.svg")}, + {IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.svg"), IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_selected.svg")}}; private static final Integer[] valueArray = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontBoldAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontBoldAction.java index 700c74406..30e18ae5d 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontBoldAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontBoldAction.java @@ -5,7 +5,7 @@ package com.fr.design.actions.cell.style; import com.fr.base.Style; import com.fr.base.core.StyleUtils; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.ToggleButtonUpdateAction; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.mainframe.ElementCasePane; @@ -21,7 +21,7 @@ import javax.swing.*; public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction { private UIToggleButton button; protected Style style; - private final static Icon[] ICONS = {SVGIconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_normal.svg"), SVGIconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_selected.svg")}; + private final static Icon[] ICONS = {IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_normal.svg"), IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_selected.svg")}; public ReportFontBoldAction(ElementCasePane t) { super(t); diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontForegroundAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontForegroundAction.java index 625c936ae..6f7698fae 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontForegroundAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontForegroundAction.java @@ -6,7 +6,7 @@ package com.fr.design.actions.cell.style; import com.fr.base.Style; import com.fr.base.core.StyleUtils; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.core.ActionFactory; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.style.color.UIToolbarColorButton; @@ -51,7 +51,7 @@ public class ReportFontForegroundAction extends AbstractStyleAction implements C public JComponent createToolBarComponent() { Object object = this.getValue(UIToolbarColorButton.class.getName()); if (object == null || !(object instanceof UIToolbarColorButton)) { - UIToolbarColorButton tbButton = new UIToolbarColorButton(SVGIconUtils.readIcon("/com/fr/design/images/gui/color/foreground_normal.svg")); + UIToolbarColorButton tbButton = new UIToolbarColorButton(IconUtils.readIcon("/com/fr/design/images/gui/color/foreground_normal.svg")); this.putValue(UIToolbarColorButton.class.getName(), tbButton); tbButton.set4Toolbar(); tbButton.setEnabled(this.isEnabled()); diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontItalicAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontItalicAction.java index df9168f16..9a3db8712 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontItalicAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontItalicAction.java @@ -5,7 +5,7 @@ package com.fr.design.actions.cell.style; import com.fr.base.Style; import com.fr.base.core.StyleUtils; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.general.FRFont; import com.fr.design.mainframe.ElementCasePane; @@ -17,7 +17,7 @@ import javax.swing.*; */ public class ReportFontItalicAction extends ReportFontBoldAction { - private final static Icon[] ICONS = {SVGIconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_normal.svg"), SVGIconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_selected.svg")}; + private final static Icon[] ICONS = {IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_normal.svg"), IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_selected.svg")}; public ReportFontItalicAction(ElementCasePane t) { super(t); diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java index f590559d4..356b1642b 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java @@ -5,7 +5,7 @@ package com.fr.design.actions.cell.style; import com.fr.base.Style; import com.fr.base.core.StyleUtils; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.general.FRFont; import com.fr.design.mainframe.ElementCasePane; @@ -18,7 +18,7 @@ import javax.swing.*; */ public class ReportFontUnderlineAction extends ReportFontBoldAction { - private final static Icon[] ICONS = {SVGIconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline_normal.svg"), SVGIconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline_selected.svg")}; + private final static Icon[] ICONS = {IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline_normal.svg"), IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline_selected.svg")}; public ReportFontUnderlineAction(ElementCasePane t) { super(t); diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/StyleBackgroundAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/StyleBackgroundAction.java index 9a216b8e3..4d8f200dc 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/StyleBackgroundAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/StyleBackgroundAction.java @@ -12,7 +12,7 @@ import javax.swing.event.ChangeListener; import com.fr.base.Style; import com.fr.base.background.ColorBackground; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.core.ActionFactory; import com.fr.general.ComparatorUtils; @@ -60,7 +60,7 @@ public class StyleBackgroundAction extends AbstractStyleAction implements Change public JComponent createToolBarComponent() { Object object = this.getValue(UIToolbarColorButton.class.getName()); if (object == null || !(object instanceof UIToolbarColorButton)) { - UIToolbarColorButton tbButton = new UIToolbarColorButton(SVGIconUtils.readIcon("/com/fr/design/images/gui/color/background_normal.svg")); + UIToolbarColorButton tbButton = new UIToolbarColorButton(IconUtils.readIcon("/com/fr/design/images/gui/color/background_normal.svg")); tbButton.set4Toolbar(); this.putValue(UIToolbarColorButton.class.getName(), tbButton); diff --git a/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertColumnAction.java b/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertColumnAction.java index afaa4a204..ee910802b 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertColumnAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertColumnAction.java @@ -3,8 +3,7 @@ */ package com.fr.design.actions.columnrow; -import com.fr.base.BaseUtils; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.CellSelectionAction; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -28,7 +27,7 @@ public class InsertColumnAction extends CellSelectionAction { this.setName(name); this.setMnemonic(INSERT_COLUMN.getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_insert/insertColumn_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_insert/insertColumn_normal.svg")); } public static final MenuKeySet INSERT_COLUMN = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertRowAction.java b/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertRowAction.java index 1254802c5..ab243d66a 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertRowAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertRowAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.columnrow; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.CellSelectionAction; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -26,7 +26,7 @@ public class InsertRowAction extends CellSelectionAction { super(t); this.setName(name); this.setMnemonic(INSERT_ROW.getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_insert/insertRow_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_insert/insertRow_normal.svg")); } public static final MenuKeySet INSERT_ROW = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/edit/HyperlinkAction.java b/designer-realize/src/main/java/com/fr/design/actions/edit/HyperlinkAction.java index fe53fe968..4e683fca2 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/edit/HyperlinkAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/edit/HyperlinkAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.edit; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.menu.KeySetUtils; @@ -19,7 +19,7 @@ public class HyperlinkAction extends UpdateAction { this.setMenuKeySet(KeySetUtils.HYPER_LINK); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_insert/hyperLink_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_insert/hyperLink_normal.svg")); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewPolyReportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewPolyReportAction.java index d8b3ea68e..0125ccfbc 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewPolyReportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewPolyReportAction.java @@ -6,7 +6,7 @@ import java.awt.event.KeyEvent; import javax.swing.KeyStroke; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JPolyWorkBook; @@ -19,7 +19,7 @@ public class NewPolyReportAction extends UpdateAction { public NewPolyReportAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_New_Multi_Report")); this.setMnemonic('F'); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_file/formExport_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_file/formExport_normal.svg")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, DEFAULT_MODIFIER)); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java index e23fecfbc..8da47420f 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java @@ -1,7 +1,7 @@ package com.fr.design.actions.file.newReport; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JWorkBook; @@ -26,7 +26,7 @@ public class NewWorkBookAction extends UpdateAction { } protected Icon icon() { - return SVGIconUtils.readIcon("/com/fr/design/images/buttonicon/newcpts_normal.svg"); + return IconUtils.readIcon("/com/fr/design/images/buttonicon/newcpts_normal.svg"); } /** diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java index 03b8dd076..fdfc041d4 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java @@ -4,7 +4,7 @@ package com.fr.design.actions.report; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.ReportComponentAction; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ReportComponent; @@ -23,7 +23,7 @@ public class ReportBackgroundAction extends ReportComponentAction { this.setMenuKeySet(KeySetUtils.REPORT_FOOTER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_report/footer_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_report/footer_normal.svg")); } /** diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java index 8323f7295..50b70bf47 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java @@ -4,7 +4,7 @@ package com.fr.design.actions.report; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.ReportComponentAction; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.headerfooter.EditHeaderPane; @@ -33,7 +33,7 @@ public class ReportHeaderAction extends ReportComponentAction { this.setMenuKeySet(KeySetUtils.REPORT_HEADER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_report/header_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_report/header_normal.svg")); } /** diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java index 8329004f9..3d976c5e9 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java @@ -2,7 +2,7 @@ package com.fr.design.actions.report; import com.fr.base.PaperSize; import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.JWorkBookAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -11,7 +11,6 @@ import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.MenuKeySet; import com.fr.design.report.mobile.ReportMobileAttrPane; import com.fr.file.FILE; -import com.fr.general.IOUtils; import com.fr.intelli.record.Focus; import com.fr.main.TemplateWorkBook; @@ -36,7 +35,7 @@ public class ReportMobileAttrAction extends JWorkBookAction{ this.setMenuKeySet(REPORT_APP_ATTR); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIconUtils.readIcon("/com/fr/design/images/m_report/mobile_normal.svg")); + this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_report/mobile_normal.svg")); this.generateAndSetSearchText(ReportMobileAttrPane.class.getName()); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java index 389b1991a..796071054 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java @@ -3,14 +3,13 @@ */ package com.fr.design.actions.report; -import com.fr.base.svg.SVGIconUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.ReportComponentAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.WorkSheetDesigner; import com.fr.design.menu.KeySetUtils; import com.fr.design.report.freeze.RepeatAndFreezeSettingPane; -import com.fr.general.IOUtils; import com.fr.report.worksheet.WorkSheet; import javax.swing.SwingUtilities; @@ -28,7 +27,7 @@ public class ReportPageAttrAction extends ReportComponentAction Date: Thu, 24 Dec 2020 17:29:03 +0800 Subject: [PATCH 030/147] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E7=95=8C=E9=9D=A2=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/style/FormatPane.java | 6 + .../component/VanChartTooltipContentPane.java | 91 +++--- .../richText/VanChartFieldAttrPane.java | 81 +++++ ...dAddPane.java => VanChartFieldButton.java} | 29 +- .../richText/VanChartFieldGroupPane.java | 115 ------- .../richText/VanChartFieldListPane.java | 294 ++++++++++++++++++ .../richText/VanChartFieldListener.java | 6 +- .../richText/VanChartRichEditorModel.java | 64 ++++ .../richText/VanChartRichEditorPane.java | 80 +---- .../richText/VanChartRichTextPane.java | 117 +++---- .../com/fr/design/editor/script/editor.js | 1 + 11 files changed, 563 insertions(+), 321 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java rename designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/{VanChartFieldAddPane.java => VanChartFieldButton.java} (82%) delete mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java diff --git a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java index 0b33b7adf..ba68ab36f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java @@ -6,6 +6,7 @@ import com.fr.base.Style; import com.fr.base.TextFormat; import com.fr.data.core.FormatField; import com.fr.data.core.FormatField.FormatContents; +import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit; import com.fr.design.border.UIRoundedBorder; @@ -469,6 +470,11 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse globalNameListener = listener; } + public void registerChangeListener(UIObserverListener listener) { + typeComboBox.registerChangeListener(listener); + textField.registerChangeListener(listener); + } + @Override public boolean shouldResponseNameListener() { return false; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index b6e768e34..9700e4faa 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -2,7 +2,6 @@ package com.fr.van.chart.designer.component; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -33,11 +32,11 @@ import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import com.fr.van.chart.designer.component.richText.VanChartRichTextDialog; import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; -import org.nfunk.jep.function.Str; import javax.swing.JComponent; import javax.swing.JPanel; @@ -99,7 +98,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - - BasicPane panel = new VanChartRichTextPane(parent, getDefaultFieldNames(), getTableFieldNames(), richEditorPane); - BasicDialog dialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), panel); + AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr(); + ModernUIPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); + VanChartRichTextPane richTextPane = new VanChartRichTextPane(parent, getTableFieldNames(), richEditorPane); + BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); + // 更新字段格式和汇总方式 + richTextPane.populateBean(this.richTextTooltipContent); + // 更新富文本编辑器内容 richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); - dialog.addDialogActionListener(new DialogActionAdapter() { + richTextDialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { - VanChartRichEditorPane.RichEditorModel model = richEditorPane.update(); + + // 收集字段格式和汇总方式 + updateTooltipFormat(richTextTooltipContent, richTextPane.updateBean()); + VanChartRichEditorModel model = richEditorPane.update(); String content = model.getContent(); + // 收集编辑后的富文本内容 updateLocalRichText(content, model.isAuto()); SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false); @@ -468,24 +467,13 @@ public class VanChartTooltipContentPane extends BasicBeanPane getDefaultFieldNames() { - List fieldNames = new ArrayList<>(); - - fieldNames.add("分类"); - fieldNames.add("系列"); - fieldNames.add("值"); - fieldNames.add("百分比"); - - return fieldNames; - } - private List getTableFieldNames() { List fieldNames = new ArrayList<>(); @@ -745,8 +733,11 @@ public class VanChartTooltipContentPane extends BasicBeanPane defaultFieldNameList; - private List tableFieldNameList; - - private List defaultFieldPaneList = new ArrayList<>(); - private List tableFieldPaneList = new ArrayList<>(); - - private VanChartFieldListener fieldListener; - - public VanChartFieldGroupPane(List defaultFieldNameList, List tableFieldNameList) { - this.defaultFieldNameList = defaultFieldNameList; - this.tableFieldNameList = tableFieldNameList; - - initFieldListener(); - - this.setLayout(new BorderLayout()); - - this.add(createDefaultFieldPane(), BorderLayout.CENTER); - this.add(createTableFieldPane(), BorderLayout.SOUTH); - } - - private JPanel createDefaultFieldPane() { - JPanel defaultField = new JPanel(); - - defaultField.setLayout(new GridLayout(0, 1, 1, 0)); - - for (String title : defaultFieldNameList) { - VanChartFieldAddPane fieldAddPane = new VanChartFieldAddPane(title, fieldListener); - - defaultField.add(fieldAddPane); - defaultFieldPaneList.add(fieldAddPane); - } - - defaultField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldNameList.size() * FIELD_ADD_H)); - defaultField.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); - - return defaultField; - } - - private JPanel createTableFieldPane() { - JPanel tableField = new JPanel(); - - tableField.setLayout(new GridLayout(0, 1, 1, 0)); - - for (String title : tableFieldNameList) { - VanChartFieldAddPane fieldAddPane = new VanChartFieldAddPane(title, fieldListener); - - tableField.add(fieldAddPane); - tableFieldPaneList.add(fieldAddPane); - } - - tableField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldNameList.size() * FIELD_ADD_H)); - - return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); - } - - private void initFieldListener() { - - fieldListener = new VanChartFieldListener() { - - private String fieldName; - - public void setGlobalName(String fieldName) { - this.fieldName = fieldName; - } - - public String getGlobalName() { - return this.fieldName; - } - - public void refreshSelectedField(String fieldName) { - if (ComparatorUtils.equals(fieldName, this.fieldName)) { - return; - } - - for (VanChartFieldAddPane fieldAddPane : defaultFieldPaneList) { - fieldAddPane.setSelectedState(ComparatorUtils.equals(fieldAddPane.getFieldName(), fieldName)); - } - - for (VanChartFieldAddPane fieldAddPane : tableFieldPaneList) { - fieldAddPane.setSelectedState(ComparatorUtils.equals(fieldAddPane.getFieldName(), fieldName)); - } - } - - public void addSelectedField(String fieldName) { - System.out.println(fieldName); - } - - public void populateFieldFormatPane() { - - } - - public void updateFieldFormatPane() { - - } - }; - } -} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java new file mode 100644 index 000000000..aa3dbd17b --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -0,0 +1,294 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.data.util.function.AbstractDataFunction; +import com.fr.design.event.UIObserverListener; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +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.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.Format; +import java.util.ArrayList; +import java.util.List; + +public class VanChartFieldListPane extends JPanel { + + private static final int FIELD_ADD_W = 400; + private static final int FIELD_ADD_H = 28; + + private VanChartFieldButton categoryNameButton; + private VanChartFieldButton seriesNameButton; + private VanChartFieldButton valueButton; + private VanChartFieldButton percentButton; + + private VanChartFieldAttrPane fieldAttrPane; + private ModernUIPane richEditorPane; + private List tableFieldNameList; + private List tableFieldButtonList = new ArrayList<>(); + + private VanChartFieldListener fieldListener; + + public VanChartFieldListPane(List tableFieldNameList, VanChartFieldAttrPane fieldAttrPane, + ModernUIPane richEditorPane) { + + this.tableFieldNameList = tableFieldNameList; + + this.fieldAttrPane = fieldAttrPane; + this.richEditorPane = richEditorPane; + + initFieldListListener(); + registerAttrListener(); + + this.setLayout(new BorderLayout()); + + this.add(createDefaultFieldPane(), BorderLayout.CENTER); + this.add(createTableFieldPane(), BorderLayout.SOUTH); + } + + private JPanel createDefaultFieldPane() { + JPanel defaultField = new JPanel(); + + defaultField.setLayout(new GridLayout(0, 1, 1, 0)); + createDefaultButtonGroup(defaultField); + + List defaultFieldButtonList = getDefaultFieldButtonList(); + + defaultField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldButtonList.size() * FIELD_ADD_H)); + defaultField.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); + + return defaultField; + } + + protected void createDefaultButtonGroup(JPanel field) { + categoryNameButton = createCategoryFieldButton(); + seriesNameButton = createSeriesFieldButton(); + valueButton = createValueFieldButton(); + percentButton = createPercentFieldButton(); + + field.add(categoryNameButton); + field.add(seriesNameButton); + field.add(valueButton); + field.add(percentButton); + } + + // 不同图表的name和id不一样 + protected VanChartFieldButton createCategoryFieldButton() { + String name = Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"); + String id = new AttrTooltipCategoryFormat().getFormatJSONKey(); + + return new VanChartFieldButton(name, id, false, fieldListener); + } + + protected VanChartFieldButton createSeriesFieldButton() { + String name = Toolkit.i18nText("Fine-Design_Chart_Series_Name"); + String id = new AttrTooltipSeriesFormat().getFormatJSONKey(); + + return new VanChartFieldButton(name, id, false, fieldListener); + } + + protected VanChartFieldButton createValueFieldButton() { + String name = Toolkit.i18nText("Fine-Design_Chart_Use_Value"); + String id = new AttrTooltipValueFormat().getFormatJSONKey(); + + return new VanChartFieldButton(name, id, false, fieldListener); + } + + protected VanChartFieldButton createPercentFieldButton() { + String name = Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); + String id = new AttrTooltipPercentFormat().getFormatJSONKey(); + + return new VanChartFieldButton(name, id, false, fieldListener); + } + + private JPanel createTableFieldPane() { + if (tableFieldNameList == null || tableFieldNameList.isEmpty()) { + return new JPanel(); + } + + JPanel tableField = new JPanel(); + + tableField.setLayout(new GridLayout(0, 1, 1, 0)); + + for (String name : tableFieldNameList) { + VanChartFieldButton fieldButton = new VanChartFieldButton(name, name, true, fieldListener); + + tableField.add(fieldButton); + tableFieldButtonList.add(fieldButton); + } + + tableField.setPreferredSize(new Dimension(FIELD_ADD_W, tableFieldNameList.size() * FIELD_ADD_H)); + + return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); + } + + protected List getDefaultFieldButtonList() { + List defaultFieldButtonList = new ArrayList<>(); + + defaultFieldButtonList.add(categoryNameButton); + defaultFieldButtonList.add(seriesNameButton); + defaultFieldButtonList.add(valueButton); + defaultFieldButtonList.add(percentButton); + + return defaultFieldButtonList; + } + + private void initFieldListListener() { + + fieldListener = new VanChartFieldListener() { + + private String fieldName; + + public void setGlobalName(String fieldName) { + this.fieldName = fieldName; + } + + public String getGlobalName() { + return this.fieldName; + } + + public VanChartFieldButton getSelectedField() { + List defaultFieldButtonList = getDefaultFieldButtonList(); + + for (VanChartFieldButton fieldButton : defaultFieldButtonList) { + if (ComparatorUtils.equals(fieldButton.getFieldName(), this.fieldName)) { + return fieldButton; + } + } + + for (VanChartFieldButton fieldButton : tableFieldButtonList) { + if (ComparatorUtils.equals(fieldButton.getFieldName(), this.fieldName)) { + return fieldButton; + } + } + + return null; + } + + public void refreshSelectedPane(String fieldName) { + if (ComparatorUtils.equals(fieldName, this.fieldName)) { + return; + } + + List defaultFieldButtonList = getDefaultFieldButtonList(); + + for (VanChartFieldButton fieldButton : defaultFieldButtonList) { + fieldButton.setSelectedState(ComparatorUtils.equals(fieldButton.getFieldName(), fieldName)); + } + + for (VanChartFieldButton fieldButton : tableFieldButtonList) { + fieldButton.setSelectedState(ComparatorUtils.equals(fieldButton.getFieldName(), fieldName)); + } + } + + public void addSelectedField(String fieldName, String fieldId) { + VanChartRichEditorModel model = richEditorPane.update(); + String content = model.getContent() + getFieldRichText(fieldName, fieldId); + model.setContent(content); + VanChartRichEditorPane.createRichEditorPane(model); + } + + public void populateFieldFormatPane() { + VanChartFieldButton fieldButton = this.getSelectedField(); + + if (fieldButton == null) { + return; + } + + Format format = fieldButton.getFormat(); + AbstractDataFunction dataFunction = (AbstractDataFunction) fieldButton.getDataFunction(); + boolean showDataFunction = fieldButton.isShowDataFunction(); + + fieldAttrPane.populate(format, dataFunction, showDataFunction); + } + + public void updateFieldFormatPane() { + VanChartFieldButton fieldButton = this.getSelectedField(); + + if (fieldButton == null) { + return; + } + + fieldButton.setFormat(fieldAttrPane.updateFormat()); + fieldButton.setDataFunction(fieldAttrPane.updateDataFunction()); + } + }; + } + + private void registerAttrListener() { + + fieldAttrPane.registerFunctionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + fieldListener.updateFieldFormatPane(); + } + }); + + fieldAttrPane.registerChangeListener(new UIObserverListener() { + public void doChange() { + fieldListener.updateFieldFormatPane(); + } + }); + } + + private void checkFieldListSelected() { + List defaultFieldButtonList = getDefaultFieldButtonList(); + + if (defaultFieldButtonList != null && defaultFieldButtonList.size() > 0) { + String selected = defaultFieldButtonList.get(0).getFieldName(); + + fieldListener.refreshSelectedPane(selected); + fieldListener.setGlobalName(selected); + fieldListener.populateFieldFormatPane(); + } + } + + private String getFieldRichText(String fieldName, String fieldId) { + return "

" + fieldName + "

"; + } + + public void populate(AttrTooltipContent tooltipContent) { + populateDefaultField(tooltipContent); + populateTableField(tooltipContent); + + // 初次打开富文本界面选中第一个 + checkFieldListSelected(); + } + + public void populateDefaultField(AttrTooltipContent tooltipContent) { + categoryNameButton.setFormat(tooltipContent.getRichTextCategoryFormat().getFormat()); + seriesNameButton.setFormat(tooltipContent.getRichTextSeriesFormat().getFormat()); + valueButton.setFormat(tooltipContent.getRichTextValueFormat().getFormat()); + percentButton.setFormat(tooltipContent.getRichTextPercentFormat().getFormat()); + } + + public void populateTableField(AttrTooltipContent tooltipContent) { + + } + + public void update(AttrTooltipContent tooltipContent) { + updateDefaultField(tooltipContent); + updateTableField(tooltipContent); + } + + public void updateDefaultField(AttrTooltipContent tooltipContent) { + tooltipContent.getRichTextCategoryFormat().setFormat(categoryNameButton.getFormat()); + tooltipContent.getRichTextSeriesFormat().setFormat(seriesNameButton.getFormat()); + tooltipContent.getRichTextValueFormat().setFormat(valueButton.getFormat()); + tooltipContent.getRichTextPercentFormat().setFormat(percentButton.getFormat()); + } + + public void updateTableField(AttrTooltipContent tooltipContent) { + + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java index 738492d67..62f096663 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java @@ -4,9 +4,11 @@ import com.fr.design.event.GlobalNameListener; public interface VanChartFieldListener extends GlobalNameListener { - public void refreshSelectedField(String fieldName); + public VanChartFieldButton getSelectedField(); - public void addSelectedField(String fieldName); + public void refreshSelectedPane(String fieldName); + + public void addSelectedField(String fieldName, String fieldId); public void populateFieldFormatPane(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java new file mode 100644 index 000000000..245eaa951 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java @@ -0,0 +1,64 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.plugin.chart.type.TextAlign; +import com.fr.stable.StringUtils; + +public class VanChartRichEditorModel { + + private String content = StringUtils.EMPTY; + private boolean auto = true; + private String params = StringUtils.EMPTY; + private String initParams = StringUtils.EMPTY; + private String align = TextAlign.LEFT.getAlign(); + + public VanChartRichEditorModel() { + } + + public VanChartRichEditorModel(String content, boolean auto, String params, String initParams, String align) { + this.content = content; + this.auto = auto; + this.params = params; + this.initParams = initParams; + this.align = align; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public boolean isAuto() { + return auto; + } + + public void setAuto(boolean auto) { + this.auto = auto; + } + + public String getParams() { + return params; + } + + public void setParams(String params) { + this.params = params; + } + + public String getInitParams() { + return initParams; + } + + public void setInitParams(String initParams) { + this.initParams = initParams; + } + + public String getAlign() { + return align; + } + + public void setAlign(String align) { + this.align = align; + } +} 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 66453a157..99afba30e 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 @@ -25,7 +25,7 @@ public class VanChartRichEditorPane { private static final String richEditorPath = "/com/fr/design/editor/rich_editor.html"; private static final String expression = "dispatch()"; - private static ModernUIPane richEditorPane; + private static ModernUIPane richEditorPane; private static Browser browser; public static void initRichEditorPane() { @@ -36,7 +36,7 @@ public class VanChartRichEditorPane { @Override public void run() { try { - richEditorPane = initPane(new RichEditorModel()); + richEditorPane = initPane(new VanChartRichEditorModel()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -47,9 +47,12 @@ public class VanChartRichEditorPane { } } - public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { - RichEditorModel model = getRichEditorModel(richEditor); + public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { + VanChartRichEditorModel model = getRichEditorModel(richEditor); + return createRichEditorPane(model); + } + public static ModernUIPane createRichEditorPane(VanChartRichEditorModel model) { if (richEditorPane == null) { richEditorPane = initPane(model); } else if (browser != null) { @@ -59,8 +62,8 @@ public class VanChartRichEditorPane { return richEditorPane; } - public static ModernUIPane initPane(RichEditorModel model) { - return new ModernUIPane.Builder() + public static ModernUIPane initPane(VanChartRichEditorModel model) { + return new ModernUIPane.Builder() .prepare(new ScriptContextAdapter() { public void onScriptContextCreated(ScriptContextEvent event) { browser = event.getBrowser(); @@ -79,13 +82,13 @@ public class VanChartRichEditorPane { .namespace(namespace).build(); } - public static void updatePane(Browser browser, RichEditorModel model) { + public static void updatePane(Browser browser, VanChartRichEditorModel model) { JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace); ns.asObject().setProperty(variable, model); browser.executeJavaScript("window." + namespace + "." + expression); } - public static RichEditorModel getRichEditorModel(AttrTooltipRichText richText) { + public static VanChartRichEditorModel getRichEditorModel(AttrTooltipRichText richText) { Map paramsMap = richText.getParams(); StringBuilder paramsStr = new StringBuilder(StringUtils.EMPTY); @@ -115,7 +118,7 @@ public class VanChartRichEditorPane { align = content.contains(left) ? left : center; } - return new RichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams, align); + return new VanChartRichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams, align); } public static String generateTransformI18nJS() { @@ -129,63 +132,4 @@ public class VanChartRichEditorPane { return "!(function () { window.transformI18n && window.transformI18n('" + language + "' || 'zh_CN'); }());"; } - - public static class RichEditorModel { - private String content = StringUtils.EMPTY; - private boolean auto = true; - private String params = StringUtils.EMPTY; - private String initParams = StringUtils.EMPTY; - private String align = TextAlign.LEFT.getAlign(); - - public RichEditorModel() { - } - - public RichEditorModel(String content, boolean auto, String params, String initParams, String align) { - this.content = content; - this.auto = auto; - this.params = params; - this.initParams = initParams; - this.align = align; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public boolean isAuto() { - return auto; - } - - public void setAuto(boolean auto) { - this.auto = auto; - } - - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } - - public String getInitParams() { - return initParams; - } - - public void setInitParams(String initParams) { - this.initParams = initParams; - } - - public String getAlign() { - return align; - } - - public void setAlign(String align) { - this.align = align; - } - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java index 927fbdaae..e48050619 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -1,25 +1,16 @@ package com.fr.van.chart.designer.component.richText; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.style.FormatPane; -import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.stable.StringUtils; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.SwingConstants; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Dimension; import java.util.List; @@ -32,110 +23,74 @@ public class VanChartRichTextPane extends BasicBeanPane { private static final int RICH_EDITOR_W = 940; private static final int RICH_EDITOR_H = 260; - private static final double P = TableLayout.PREFERRED; - private static final double D = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; - private static final double E = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - - private JScrollPane fieldContentPane; - private JScrollPane fieldPropsPane; - - private FormatPane fieldFormatPane; - private JPanel fieldSummaryPane; - - private UIComboBox fieldSummaryBox; + private VanChartFieldListPane fieldListPane; + private VanChartFieldAttrPane fieldAttrPane; private VanChartStylePane parent; - private List defaultFieldsFormat; private List tableFieldsFormat; - public VanChartRichTextPane(VanChartStylePane parent, List defaultFieldsFormat, List tableFieldsFormat, JPanel richEditor) { - this.parent = parent; + private ModernUIPane richEditor; - this.defaultFieldsFormat = defaultFieldsFormat; + public VanChartRichTextPane(VanChartStylePane parent, List tableFieldsFormat, ModernUIPane richEditor) { + this.parent = parent; this.tableFieldsFormat = tableFieldsFormat; + this.richEditor = richEditor; - initFieldContentPane(); - initFieldPropsPane(); + initFieldContent(); this.setLayout(new BorderLayout()); - this.add(createFieldDetailPane(), BorderLayout.CENTER); - this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH); + this.add(createFieldContentPane(), BorderLayout.CENTER); + this.add(createRichEditorPane(), BorderLayout.SOUTH); } - private void initFieldContentPane() { - JPanel content = new JPanel(); - content.setLayout(new BorderLayout()); - content.add(createDefaultContentPane(), BorderLayout.NORTH); - content.add(createTableFieldsPane(), BorderLayout.CENTER); - - fieldContentPane = new JScrollPane(content); - fieldContentPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); - fieldContentPane.setHorizontalScrollBar(null); - fieldContentPane.setBorder(BorderFactory.createTitledBorder("添加字段")); - } - - private void initFieldPropsPane() { - fieldFormatPane = new FormatPaneWithOutFont() { - protected JPanel createContentPane(Component[][] components) { - return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{P, P, P}, new double[]{D, E}); - } - }; - - fieldSummaryBox = new CalculateComboBox(); - - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), fieldSummaryBox} - }; - - fieldSummaryPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{P, P}, new double[]{D, E}); - - JPanel props = new JPanel(); - props.setLayout(new BorderLayout()); - props.add(fieldFormatPane, BorderLayout.NORTH); - props.add(fieldSummaryPane, BorderLayout.CENTER); - props.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); - - fieldPropsPane = new JScrollPane(props); - fieldPropsPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); - fieldPropsPane.setBorder(BorderFactory.createTitledBorder("字段设置")); + private void initFieldContent() { + fieldAttrPane = new VanChartFieldAttrPane(); + fieldListPane = new VanChartFieldListPane(tableFieldsFormat, fieldAttrPane, richEditor); } - private JPanel createDefaultContentPane() { + private JPanel createFieldContentPane() { + JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - return new VanChartFieldGroupPane(defaultFieldsFormat, tableFieldsFormat); - } + // 新增字段目录 + JPanel fieldListContent = new JPanel(); + fieldListContent.setLayout(new BorderLayout()); + fieldListContent.add(fieldListPane, BorderLayout.NORTH); - private JPanel createTableFieldsPane() { - return new JPanel(); - } + JScrollPane fieldListScrollPane = new JScrollPane(fieldListContent); + fieldListScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); + fieldListScrollPane.setHorizontalScrollBar(null); + fieldListScrollPane.setBorder(BorderFactory.createTitledBorder("添加字段")); - private JPanel createFieldDetailPane() { - JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + // 字段格式和汇总 + JScrollPane fieldAttrScrollPane = new JScrollPane(fieldAttrPane); + fieldAttrScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); + fieldAttrScrollPane.setBorder(BorderFactory.createTitledBorder("字段设置")); - fieldPane.add(fieldContentPane); - fieldPane.add(fieldPropsPane); + fieldPane.add(fieldListScrollPane); + fieldPane.add(fieldAttrScrollPane); return fieldPane; } - private JPanel createRichEditorPane(JPanel richEditor) { + private JPanel createRichEditorPane() { JPanel richEditorPane = new JPanel(); richEditorPane.setLayout(new BorderLayout()); richEditorPane.setPreferredSize(new Dimension(RICH_EDITOR_W, RICH_EDITOR_H)); - richEditorPane.add(richEditor, BorderLayout.CENTER); + richEditorPane.add(this.richEditor, BorderLayout.CENTER); return richEditorPane; } - public void populateBean(AttrTooltipContent ob) { - + public void populateBean(AttrTooltipContent tooltipContent) { + fieldListPane.populate(tooltipContent); } public AttrTooltipContent updateBean() { - return null; + AttrTooltipContent content = new AttrTooltipContent(); + fieldListPane.update(content); + return content; } protected String title4PopupWindow() { diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js index f3e053679..a2b5dd6a7 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js @@ -50,6 +50,7 @@ }, items: [{ type: "bi.htape", + tgap: 5, items: [{ type: "bi.label", text: BI.i18nText("BI-Design_Font_Style") + ": ", From ee5b371f37f5643a2fa834ed8a7d065900fbe91c Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 25 Dec 2020 12:48:45 +0800 Subject: [PATCH 031/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.14:?= =?UTF-8?q?=20=E2=91=A0vito=E5=BB=BA=E8=AE=AE=E4=B8=AD=E7=9A=84=E5=89=8D?= =?UTF-8?q?=E4=B8=89=E7=82=B9=E5=8A=9F=E8=83=BD=E5=85=B6=E5=AE=9E=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E5=AE=9E=E7=8E=B0=E4=BA=86=EF=BC=8C=E5=8F=AA=E6=98=AF?= =?UTF-8?q?=E6=B2=A1=E7=94=A8=E4=B8=80=E4=B8=AA=E7=B1=BB=E4=BC=BCManager?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E5=BC=8F=E5=86=99=E5=87=BA=E6=9D=A5=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E8=BF=99=E7=A7=8D=E4=B8=8D=E6=98=AF=E5=BE=88=E7=86=9F?= =?UTF-8?q?=EF=BC=8C=E5=90=ACvito=E8=AF=B4=E8=A6=81=E9=85=8D=E9=BD=90?= =?UTF-8?q?=E4=B8=80=E5=A4=A7=E5=A5=97=EF=BC=8C=E8=80=8C=E8=BF=99=E6=AC=A1?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=B7=B2=E7=BB=8F=E6=98=AF=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E6=89=80=E4=BB=A5=E6=94=BE=E5=9C=A8=E4=B8=8B?= =?UTF-8?q?=E6=AC=A1=E8=BF=AD=E4=BB=A3=E4=BB=BB=E5=8A=A1=E4=B8=AD=E4=B8=8E?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E4=B8=80=E8=B5=B7=E5=81=9A=EF=BC=9B=E2=91=A1?= =?UTF-8?q?=E5=B0=86=E5=87=A0=E4=B9=8E=E6=89=80=E6=9C=89=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E6=94=B9=E6=88=90svg=E7=9A=84=E5=9B=BE=E6=A0=87=EF=BC=8C?= =?UTF-8?q?=E4=BC=A0=E5=85=A5=E6=96=B9=E5=BC=8F=E7=BB=9F=E4=B8=80=E4=B8=BA?= =?UTF-8?q?=E4=BC=A0=E5=85=A5url=EF=BC=9B=E2=91=A2=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E4=BA=86test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/base/svg/IconUtils.java | 1 + .../actions/AllowAuthorityEditAction.java | 2 +- .../actions/ExitAuthorityEditAction.java | 2 +- .../design/actions/TableDataSourceAction.java | 2 +- .../com/fr/design/actions/UpdateAction.java | 14 +------ .../design/actions/community/BBSAction.java | 2 +- .../design/actions/community/BugAction.java | 2 +- .../actions/community/BugNeedAction.java | 2 +- .../actions/community/CenterAction.java | 2 +- .../actions/community/FacebookFansAction.java | 2 +- .../design/actions/community/NeedAction.java | 2 +- .../actions/community/QuestionAction.java | 2 +- .../design/actions/community/SignAction.java | 2 +- .../actions/community/TechSolutionAction.java | 2 +- .../design/actions/community/VideoAction.java | 2 +- .../fr/design/actions/edit/CopyAction.java | 2 +- .../com/fr/design/actions/edit/CutAction.java | 2 +- .../fr/design/actions/edit/PasteAction.java | 2 +- .../fr/design/actions/edit/RedoAction.java | 2 +- .../fr/design/actions/edit/UndoAction.java | 2 +- .../actions/file/OpenTemplateAction.java | 2 +- .../actions/file/SaveAsTemplateAction.java | 2 +- .../actions/file/SaveTemplateAction.java | 2 +- .../design/actions/file/SwitchExistEnv.java | 6 +-- .../design/actions/help/TutorialAction.java | 2 +- .../fr/design/actions/help/WebDemoAction.java | 2 +- .../help/alphafine/AlphaFineAction.java | 2 +- .../actions/server/ConnectionListAction.java | 2 +- .../actions/server/FunctionManagerAction.java | 2 +- .../actions/server/GlobalParameterAction.java | 2 +- .../actions/server/GlobalTableDataAction.java | 2 +- .../actions/server/PlatformManagerAction.java | 2 +- .../actions/server/PluginManagerAction.java | 2 +- .../com/fr/design/constants/UIConstants.java | 2 +- .../design/data/BasicTableDataTreePane.java | 4 +- .../data/datapane/TableDataTreePane.java | 4 +- .../com/fr/design/gui/core/WidgetOption.java | 30 +++++++------- .../design/gui/core/WidgetOptionFactory.java | 8 +++- .../com/fr/design/icon/IconPathConstants.java | 9 ---- .../DesignerFrameFileDealerPane.java | 12 +++--- .../action/RemoteDesignAuthManagerAction.java | 2 +- .../fit/menupane/ReportFitAttrAction.java | 2 +- .../roleAuthority/ReportAndFSManagePane.java | 4 +- .../style/color/UIToolbarColorButton.java | 2 +- .../update/actions/SoftwareUpdateAction.java | 2 +- ...r_dock_normal.svg => new_form3_normal.svg} | 0 .../java/com/fr/base/svg/IconUtilsTest.java | 41 +++++++++++++++++++ .../fr/design/module/ChartPreStyleAction.java | 2 +- .../map/server/ChartMapEditorAction.java | 2 +- .../com/fr/design/actions/NewFormAction.java | 2 +- .../designer/beans/actions/CopyAction.java | 2 +- .../designer/beans/actions/CutAction.java | 2 +- .../beans/actions/FormDeleteAction.java | 2 +- .../designer/beans/actions/PasteAction.java | 2 +- .../form/parameter/FormParaTargetMode.java | 2 +- .../fr/design/gui/core/FormWidgetOption.java | 8 ++-- .../fr/design/mainframe/FormTargetMode.java | 2 +- .../java/com/fr/design/mainframe/JForm.java | 2 +- .../actions/cell/CellAttributeAction.java | 2 +- .../actions/cell/CellExpandAttrAction.java | 2 +- .../actions/cell/CellWidgetAttrAction.java | 2 +- .../cell/ConditionAttributesAction.java | 2 +- .../design/actions/cell/EditCellAction.java | 2 +- .../actions/cell/GlobalStyleMenuDef.java | 2 +- .../actions/cell/UIToolbarBorderButton.java | 2 +- .../actions/cell/style/AlignmentAction.java | 6 +-- .../cell/style/ReportFontBoldAction.java | 2 +- .../style/ReportFontForegroundAction.java | 2 +- .../cell/style/ReportFontItalicAction.java | 2 +- .../cell/style/ReportFontUnderlineAction.java | 2 +- .../cell/style/StyleBackgroundAction.java | 2 +- .../actions/columnrow/InsertColumnAction.java | 2 +- .../actions/columnrow/InsertRowAction.java | 2 +- .../fr/design/actions/edit/DeleteAction.java | 2 +- .../design/actions/edit/HyperlinkAction.java | 2 +- .../actions/edit/merge/MergeCellAction.java | 2 +- .../actions/edit/merge/UnmergeCellAction.java | 2 +- .../file/newReport/NewPolyReportAction.java | 2 +- .../file/newReport/NewWorkBookAction.java | 2 +- .../actions/insert/cell/BiasCellAction.java | 2 +- .../actions/insert/cell/ChartCellAction.java | 2 +- .../insert/cell/DSColumnCellAction.java | 2 +- .../insert/cell/FormulaCellAction.java | 2 +- .../insert/cell/GeneralCellAction.java | 2 +- .../actions/insert/cell/ImageCellAction.java | 2 +- .../insert/cell/RichTextCellAction.java | 2 +- .../insert/cell/SubReportCellAction.java | 2 +- .../actions/insert/flot/ChartFloatAction.java | 2 +- .../insert/flot/FormulaFloatAction.java | 2 +- .../actions/insert/flot/ImageFloatAction.java | 2 +- .../insert/flot/TextBoxFloatAction.java | 2 +- .../report/ReportBackgroundAction.java | 2 +- .../actions/report/ReportColumnsAction.java | 2 +- .../report/ReportEngineAttrAction.java | 2 +- .../report/ReportExportAttrAction.java | 2 +- .../actions/report/ReportFooterAction.java | 2 +- .../actions/report/ReportHeaderAction.java | 2 +- .../report/ReportMobileAttrAction.java | 2 +- .../actions/report/ReportPageAttrAction.java | 2 +- .../actions/report/ReportPageSetupAction.java | 2 +- .../actions/report/ReportParameterAction.java | 2 +- .../report/ReportPrintSettingAction.java | 2 +- .../actions/report/ReportWatermarkAction.java | 2 +- .../actions/report/ReportWebAttrAction.java | 2 +- .../actions/report/ReportWriteAttrAction.java | 2 +- .../server/ServerConfigManagerAction.java | 2 +- .../actions/server/StyleListAction.java | 2 +- .../actions/server/WidgetManagerAction.java | 2 +- .../utils/DeprecatedActionManager.java | 4 +- .../fr/design/mainframe/ElementCasePane.java | 2 +- .../design/mainframe/FormatBrushAction.java | 2 +- .../com/fr/design/mainframe/JWorkBook.java | 2 +- .../fr/design/mainframe/SheetNameTabPane.java | 12 +++--- .../fr/poly/actions/DeleteBlockAction.java | 2 +- .../cellquick/CellDSColumnEditor.java | 5 --- .../com/fr/start/preload/ImagePreLoader.java | 2 +- 116 files changed, 194 insertions(+), 172 deletions(-) rename designer-base/src/main/resources/com/fr/design/images/buttonicon/{new_form_for_dock_normal.svg => new_form3_normal.svg} (100%) create mode 100644 designer-base/src/test/java/com/fr/base/svg/IconUtilsTest.java diff --git a/designer-base/src/main/java/com/fr/base/svg/IconUtils.java b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java index e13ca53b2..f19e54323 100644 --- a/designer-base/src/main/java/com/fr/base/svg/IconUtils.java +++ b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java @@ -26,6 +26,7 @@ public class IconUtils { /** * 可以读取SVG图标或者普通图标,并且可以读取不带扩展名的文件 + * 不带扩展名时以svg优先、其次png,最后gif * @param resource 图片路径 * @return 图标 */ diff --git a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java index 890a4d877..1a0509d26 100644 --- a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java @@ -22,7 +22,7 @@ public class AllowAuthorityEditAction extends TemplateComponentAction { this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit_normal.svg")); + this.setSmallIcon("/com/fr/design/images/m_report/allow_authority_edit"); } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java index 1b48f4c69..77ae198d0 100644 --- a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java @@ -19,7 +19,7 @@ public class ExitAuthorityEditAction extends TemplateComponentAction { public ExitAuthorityEditAction(TargetComponent t) { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Authority_Edit_Status_Exit")); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_report/exit_authority_edit_normal.svg")); + this.setSmallIcon("/com/fr/design/images/m_report/exit_authority_edit"); } diff --git a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java index 1c77c31d4..2903b12a1 100644 --- a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java @@ -26,7 +26,7 @@ public class TableDataSourceAction extends TemplateComponentAction> { this.setMenuKeySet(KeySetUtils.SAVE_AS_TEMPLATE); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_file/saveAs_normal.svg")); + this.setSmallIcon("/com/fr/design/images/m_file/saveAs"); } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java b/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java index 3557eb307..920f5b41a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java @@ -20,7 +20,7 @@ public class SaveTemplateAction extends JTemplateAction> { this.setMenuKeySet(KeySetUtils.SAVE_TEMPLATE); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon("/com/fr/design/images/m_file/save.png"); + this.setSmallIcon("/com/fr/design/images/m_file/save"); this.setAccelerator(getMenuKeySet().getKeyStroke()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index 99cc7ef33..bc88f72fd 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -25,7 +25,7 @@ public class SwitchExistEnv extends MenuDef { Iterator nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator(); while (nameIt.hasNext()) { String name = nameIt.next(); - this.setIconPath("com/fr/design/images/m_file/switch_normal.svg"); + this.setIconPath("com/fr/design/images/m_file/switch"); this.addShortCut(new GetExistEnvAction(name)); } this.addShortCut(SeparatorDef.DEFAULT); @@ -42,11 +42,11 @@ public class SwitchExistEnv extends MenuDef { DesignerWorkspaceInfo env = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); switch (env.getType()) { case Local: { - this.setSmallIcon(IconUtils.readIcon("com/fr/design/images/data/bind/localconnect_normal.svg")); + this.setSmallIcon("com/fr/design/images/data/bind/localconnect"); break; } case Remote: { - this.setSmallIcon(IconUtils.readIcon("com/fr/design/images/data/bind/distanceconnect_normal.svg")); + this.setSmallIcon("com/fr/design/images/data/bind/distanceconnect"); break; } } diff --git a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java index a55b429aa..af0ea605f 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java @@ -28,7 +28,7 @@ public class TutorialAction extends UpdateAction { this.setMenuKeySet(HELP_TUTORIAL); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/bbs/help_normal.svg")); + this.setSmallIcon("/com/fr/design/images/bbs/help"); this.setAccelerator(getMenuKeySet().getKeyStroke()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java b/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java index 0785de9cc..53ef796b3 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java @@ -16,7 +16,7 @@ public class WebDemoAction extends UpdateAction { this.setMenuKeySet(PRODUCT_DEMO); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_help/demo_normal.svg")); + this.setSmallIcon("/com/fr/design/images/m_help/demo"); } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java index a5c0432f2..3dc951578 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java @@ -21,7 +21,7 @@ public class AlphaFineAction extends UpdateAction { this.setMenuKeySet(ALPHAFINE); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SVGIcon.readSVGIcon("com/fr/design/mainframe/alphafine/images/smallsearch_normal.svg")); + this.setSmallIcon("com/fr/design/mainframe/alphafine/images/smallsearch"); this.generateAndSetSearchText(AlphaFineConfigPane.class.getName()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 705644da2..820de79e5 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -26,7 +26,7 @@ public class ConnectionListAction extends UpdateAction { this.setMenuKeySet(DEFINE_DATA_CONNECTION); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_web/connection_normal.svg")); + this.setSmallIcon("/com/fr/design/images/m_web/connection"); this.generateAndSetSearchText(DatabaseConnectionPane.JDBC.class.getName()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java index 2fbe47f39..d7f1cdbb7 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java @@ -29,7 +29,7 @@ public class FunctionManagerAction extends UpdateAction { this.setMenuKeySet(FUNCTION_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()+"..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_web/function_normal.svg")); + this.setSmallIcon("/com/fr/design/images/m_web/function"); this.generateAndSetSearchText(FunctionManagerPane.class.getName()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java index 7dc3474ae..d3f035972 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java @@ -31,7 +31,7 @@ public class GlobalParameterAction extends UpdateAction { this.setMenuKeySet(GLOBAL_PARAMETER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_report/p_normal.svg")); + this.setSmallIcon("/com/fr/design/images/m_report/p"); } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index 53988db0d..468fb1f98 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java @@ -40,7 +40,7 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS this.setMenuKeySet(SERVER_TABLEDATA); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase_normal.svg")); + this.setSmallIcon("/com/fr/design/images/data/dock/serverdatabase"); } public static final MenuKeySet SERVER_TABLEDATA = new MenuKeySet() { diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java index b6f1f4c25..f62327ad9 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java @@ -14,7 +14,7 @@ public class PlatformManagerAction extends UpdateAction { this.setMenuKeySet(PLATEFORM_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/server/platform_16_16_normal.svg")); + this.setSmallIcon("/com/fr/design/images/server/platform_16_16"); } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java index 329857878..bb9339568 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java @@ -20,7 +20,7 @@ public class PluginManagerAction extends UpdateAction { this.setMenuKeySet(PLUGIN_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/server/plugin_normal.svg")); + this.setSmallIcon("/com/fr/design/images/server/plugin"); } @Override public void actionPerformed(ActionEvent e) { diff --git a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java index 19ae615d4..8887f7986 100644 --- a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java +++ b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java @@ -180,7 +180,7 @@ public interface UIConstants { public static final Icon YES_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/yes.png"); public static final Icon CHOOSEN_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/select_item.png"); public static final Icon PRE_WIDGET_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/prewidget.png"); - public static final Icon PRE_WIDGET_NORMAL_ICON = IconUtils.readIcon("com/fr/design/images/buttonicon/prewidget_normal.svg"); + public static final Icon PRE_WIDGET_NORMAL_ICON = IconUtils.readIcon("com/fr/design/images/buttonicon/prewidget"); public static final Icon EDIT_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editn.png"); public static final Icon EDIT_PRESSED_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editp.png"); public static final Icon HIDE_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/hiden.png"); diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index 486315058..83740f685 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -398,7 +398,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp public PreviewTableDataAction(TableDataTree dataTree) { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); this.setMnemonic('p'); - this.setSmallIcon(IconPathConstants.PREVIEW_ICON_PATH); + this.setSmallIcon("/com/fr/design/images/m_file/preview"); this.dataTree = dataTree; } @@ -437,7 +437,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp public ConnectionTableAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Define_Data_Connection")); this.setMnemonic('D'); - this.setSmallIcon(IconPathConstants.TD_CONNECTION_ICON_PATH); + this.setSmallIcon("/com/fr/design/images/m_web/connection"); } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 76fd78edd..539e06665 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -278,7 +278,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { public EditAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); this.setMnemonic('E'); - this.setSmallIcon(IconPathConstants.TD_EDIT_ICON_PATH); + this.setSmallIcon("/com/fr/design/images/control/edit"); } public void actionPerformed(ActionEvent e) { @@ -296,7 +296,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { public RemoveAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); this.setMnemonic('R'); - this.setSmallIcon(IconPathConstants.TD_REMOVE_ICON_PATH); + this.setSmallIcon("/com/fr/design/images/control/remove"); } @Override diff --git a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java index 9dc110346..71289376a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java @@ -128,27 +128,27 @@ public abstract class WidgetOption implements Serializable { } public static final WidgetOption DATEEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Date"), - IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/date_16_normal.svg"), + "/com/fr/design/images/buttonicon/widget/date_16", DateEditor.class); public static final WidgetOption TREE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_View_Tree"), - IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/tree_16_normal.svg"), TreeEditor.class); + "/com/fr/design/images/buttonicon/widget/tree_16", TreeEditor.class); - public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_ComboBox"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/comboboxtree16_normal.svg"), + public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_ComboBox"), "/com/fr/design/images/buttonicon/widget/comboboxtree16", TreeComboBoxEditor.class); public static final WidgetOption CHECKBOXGROUP = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox_Group"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg"), CheckBoxGroup.class); + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox_Group"), "/com/fr/design/images/buttonicon/widget/checkbox_group_16", CheckBoxGroup.class); public static final WidgetOption RADIOGROUP = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Radio_Group"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_group_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Radio_Group"), "/com/fr/design/images/buttonicon/widget/button_group_16", RadioGroup.class); public static final WidgetOption NUMBEREDITOR = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Number"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/number_field_16_normal.svg"), NumberEditor.class); + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Number"), "/com/fr/design/images/buttonicon/widget/number_field_16", NumberEditor.class); public static final WidgetOption LABEL = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Label"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/label_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Label"), "/com/fr/design/images/buttonicon/widget/label_16", Label.class); public static final WidgetOption BUTTON = WidgetOptionFactory.createByWidgetClass( @@ -156,23 +156,23 @@ public abstract class WidgetOption implements Serializable { Button.class); public static final WidgetOption FREEBUTTON = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Button"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Button"), "/com/fr/design/images/buttonicon/widget/button_16", FreeButton.class); public static final WidgetOption MULTI_FILEEDITOR = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_File"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/files_up_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_File"), "/com/fr/design/images/buttonicon/widget/files_up", MultiFileEditor.class); public static final WidgetOption COMBOBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Box"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Box"), "/com/fr/design/images/buttonicon/widget/combo_box_16", ComboBox.class); public static final WidgetOption COMBOCHECKBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Checkbox"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Checkbox"), "/com/fr/design/images/buttonicon/widget/combo_check_16", ComboCheckBox.class); public static final WidgetOption CHECKBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/check_box_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox"), "/com/fr/design/images/buttonicon/widget/check_box_16", CheckBox.class); public static final WidgetOption LIST = WidgetOptionFactory.createByWidgetClass( @@ -182,16 +182,16 @@ public abstract class WidgetOption implements Serializable { public static final WidgetOption TEXTEDITOR = WidgetOptionFactory.createByWidgetClass( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Text") - , IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_field_16_normal.svg"), + , "/com/fr/design/images/buttonicon/widget/text_field_16", TextEditor.class); public static final WidgetOption TEXTAREA = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Textarea"), IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_area_16_normal.svg"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Textarea"), "/com/fr/design/images/buttonicon/widget/text_area_16", TextArea.class); public static final WidgetOption PASSWORD = WidgetOptionFactory.createByWidgetClass( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Password"), - IconUtils.readIcon("/com/fr/design/images/buttonicon/widget/password_field_16_normal.svg"), Password.class); + "/com/fr/design/images/buttonicon/widget/password_field_16", Password.class); public static final WidgetOption IFRAMEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Form_Iframe"), BaseUtils.readIcon("/com/fr/web/images/form/resources/iframe_16.png"), IframeEditor.class); diff --git a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java index 0266d9eb9..e9ba42788 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java @@ -1,6 +1,7 @@ package com.fr.design.gui.core; import com.fr.base.BaseUtils; +import com.fr.base.svg.IconUtils; import com.fr.form.ui.Widget; import javax.swing.*; @@ -14,4 +15,9 @@ public class WidgetOptionFactory { public static WidgetOption createByWidgetClass(String optionName, Icon optionIcon, Class widgetClass) { return new CustomWidgetOption(optionName, optionIcon, widgetClass); } -} \ No newline at end of file + + public static WidgetOption createByWidgetClass(String optionName, String resource, Class widgetClass) { + Icon optionIcon = IconUtils.readIcon(resource); + return new CustomWidgetOption(optionName, optionIcon, widgetClass); + } +} diff --git a/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java b/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java index d977e4be4..e3802161b 100644 --- a/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java +++ b/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java @@ -14,8 +14,6 @@ public class IconPathConstants { } public static final String ADD_POPMENU_ICON_PATH = "/com/fr/design/images/control/addPopup.png"; - public static final String ADD_POPMENU_NORMAL_ICON_PATH = "/com/fr/design/images/control/addPopup_normal.svg"; - public static final String ADD_POPMENU_DISABLED_ICON_PATH = "/com/fr/design/images/control/addPopup_disabled.svg"; public static final String DS_ICON_PATH = "/com/fr/design/images/data/datasource.png"; public static final String CLASS_TD_ICON_PATH = "/com/fr/design/images/data/source/classTableData.png"; @@ -25,18 +23,11 @@ public class IconPathConstants { public static final String DS_TREE_TD_ICON_PATH = "/com/fr/design/images/data/tree.png"; public static final String DS_QUERY_ICON_PATH = "/com/fr/design/images/data/database.png"; public static final String PREVIEW_ICON_PATH = "/com/fr/design/images/m_file/preview.png"; - public static final String PREVIEW_NORMAL_ICON_PATH = "/com/fr/design/images/m_file/preview_normal.svg"; - public static final String PREVIEW_DISABLED_ICON_PATH = "/com/fr/design/images/m_file/preview_disabled.svg"; public static final String TD_EDIT_ICON_PATH = "/com/fr/design/images/control/edit.png"; - public static final String TD_EDIT_NORMAL_ICON_PATH = "/com/fr/design/images/control/edit_normal.svg"; - public static final String TD_EDIT_DISABLED_ICON_PATH = "/com/fr/design/images/control/edit_disabled.svg"; public static final String TD_EL_SHARE_HELP_ICON_PATH = "/com/fr/design/images/control/help_open.png"; public static final String TD_EL_SHARE_CLOSE_ICON_PATH = "/com/fr/design/images/control/help_close.png"; public static final String TD_REMOVE_ICON_PATH = "/com/fr/design/images/control/remove.png"; - public static final String TD_REMOVE_NORMAL_ICON_PATH = "/com/fr/design/images/control/remove_normal.svg"; - public static final String TD_REMOVE_DISABLED_ICON_PATH = "/com/fr/design/images/control/remove_disabled.svg"; public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png"; - public static final String TD_CONNECTION_NORMAL_ICON_PATH = "/com/fr/design/images/m_web/connection_normal.svg"; public static final String SP_SHOW_ICON_PATH = "/com/fr/design/images/data/store_procedure.png"; public static final String STD_SHOW_ICON_PATH = "/com/fr/design/images/data/dock/serverdatabase.png"; public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png"; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index b82db2bde..d2771cd49 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -316,7 +316,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public NewFolderAction() { this.setName(KeySetUtils.NEW_FOLDER.getMenuKeySetName()); - this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/new_folder.png"); + this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/new_folder"); } @Override @@ -342,7 +342,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt private class VcsAction extends UpdateAction { public VcsAction() { - this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/vcs_list.png"); + this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/vcs_list"); } @Override @@ -424,7 +424,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public ShowInExplorerAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_In_Containing_Folder")); - this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/view_folder.png"); + this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/view_folder"); } @Override @@ -441,7 +441,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public RefreshTreeAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Refresh")); - this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/refresh.png"); + this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/refresh"); } @Override @@ -459,7 +459,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public RenameAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Rename")); - this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/rename.png"); + this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/rename"); } @Override @@ -498,7 +498,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public DelFileAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Remove")); - this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/remove.png"); + this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/remove"); } @Override diff --git a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java index 98e9c91ed..30112dc7a 100644 --- a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java @@ -27,7 +27,7 @@ public class RemoteDesignAuthManagerAction extends UpdateAction { public RemoteDesignAuthManagerAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Authority_Manager")); // 远程设计权限管理 - this.setSmallIcon(IconUtils.readIcon("com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x_normal.svg")); + this.setSmallIcon("com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x"); } diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index 160982228..ae0cfd2b6 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -66,7 +66,7 @@ public class ReportFitAttrAction extends JTemplateAction { } this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/reportfit/fit_normal.svg")); + this.setSmallIcon("/com/fr/design/images/reportfit/fit"); } /** diff --git a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java index 65f66290e..f393b1a09 100644 --- a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java +++ b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java @@ -181,7 +181,7 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo } private void initbuttonGroup() { - + Icon[] iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/demo.png")}; String[] textArray = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FS_Name")}; buttonGroup = new UIHeadGroup(iconArray, textArray) { @@ -254,7 +254,7 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo public RefreshAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh")); - this.setSmallIcon(UIConstants.REFRESH_ICON); + this.setSmallIcon("/com/fr/design/images/buttonicon/refresh"); } @Override diff --git a/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java b/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java index 07c4c5739..9a8640f62 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java +++ b/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java @@ -35,7 +35,7 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi private UIObserverListener uiObserverListener; public UIToolbarColorButton(Icon icon) { - super(new UIColorButton(icon), new UIButton(IconUtils.readIcon("/com/fr/design/images/gui/popup_normal.svg"))); + super(new UIColorButton(icon), new UIButton(IconUtils.readIcon("/com/fr/design/images/gui/popup"))); getLeftButton().setEventBanned(true); getRightButton().addFocusListener(new FocusListener() { diff --git a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java index dc65591e8..2b768d995 100644 --- a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java @@ -15,7 +15,7 @@ public class SoftwareUpdateAction extends UpdateAction { public SoftwareUpdateAction() { setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_UpdateAndUpgrade")); - setSmallIcon(IconUtils.readIcon("/com/fr/design/images/update/update_new_normal.svg")); + setSmallIcon("/com/fr/design/images/update/update_new"); } diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/new_form_for_dock_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/new_form3_normal.svg similarity index 100% rename from designer-base/src/main/resources/com/fr/design/images/buttonicon/new_form_for_dock_normal.svg rename to designer-base/src/main/resources/com/fr/design/images/buttonicon/new_form3_normal.svg diff --git a/designer-base/src/test/java/com/fr/base/svg/IconUtilsTest.java b/designer-base/src/test/java/com/fr/base/svg/IconUtilsTest.java new file mode 100644 index 000000000..a1979db1d --- /dev/null +++ b/designer-base/src/test/java/com/fr/base/svg/IconUtilsTest.java @@ -0,0 +1,41 @@ +package com.fr.base.svg; + +import com.fr.cert.token.lang.Assert; +import junit.framework.TestCase; + +import javax.swing.Icon; +import javax.swing.ImageIcon; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2020/12/25 + */ +public class IconUtilsTest extends TestCase { + + public void testReadIcon() { + String resource = "com/fr/design/images/m_edit/copy.png"; + + Icon pngIcon = IconUtils.readIcon(resource); + assertTrue(pngIcon instanceof ImageIcon); + + resource = "com/fr/design/images/m_edit/copy_normal.svg"; + Icon suffixIcon = IconUtils.readIcon(resource); + assertTrue(suffixIcon instanceof SVGIcon); + + resource = "com/fr/design/images/m_edit/copy"; + Icon noSuffixIcon = IconUtils.readIcon(resource); + assertTrue(noSuffixIcon instanceof SVGIcon); + } + + public void testReadSVGIcon() { + String resource = "com/fr/design/images/m_edit/copy.png"; + + Icon suffixIcon = IconUtils.readSVGIcon(resource, IconUtils.ICON_TYPE_NORMAL); + assertTrue(suffixIcon instanceof SVGIcon); + + resource = "com/fr/design/images/m_edit/copy"; + Icon noSuffixIcon = IconUtils.readSVGIcon(resource, IconUtils.ICON_TYPE_NORMAL); + assertTrue(noSuffixIcon instanceof SVGIcon); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java index e0105b1b3..61b9a8c4f 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java @@ -33,7 +33,7 @@ public class ChartPreStyleAction extends UpdateAction { this.setMenuKeySet(CHART_DEFAULT_STYLE); this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("com/fr/design/images/chart/ChartType_normal.svg")); + this.setSmallIcon("com/fr/design/images/chart/ChartType"); this.generateAndSetSearchText(ChartPreStyleManagerPane.class.getName()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java b/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java index 25f16c52a..e9b0373a8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java @@ -17,7 +17,7 @@ import java.awt.event.ActionEvent; public class ChartMapEditorAction extends UpdateAction { public ChartMapEditorAction(){ - this.setSmallIcon(IconUtils.readIcon("/com/fr/van/chart/map/images/mapData_normal.svg")); + this.setSmallIcon("/com/fr/van/chart/map/images/mapData"); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Data")); } diff --git a/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java index 3c4c491ca..c867be8d2 100644 --- a/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java @@ -21,7 +21,7 @@ public class NewFormAction extends UpdateAction { this.setMenuKeySet(NEW_FORM); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/buttonicon/new_form_for_dock_normal.svg")); + this.setSmallIcon("/com/fr/design/images/buttonicon/new_form3"); this.setAccelerator(getMenuKeySet().getKeyStroke()); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java index 98663dedd..c577a8693 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java @@ -16,7 +16,7 @@ public class CopyAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Copy")); this.setMnemonic('C'); - this.setSmallIcon("/com/fr/design/images/m_edit/copy.png"); + this.setSmallIcon("/com/fr/design/images/m_edit/copy"); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)); setUpdateBehavior(new ComponentEnable()); this.setEnabled(!DesignModeContext.isBanCopyAndCut()); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java index 60c4f4fa3..e93eebd72 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java @@ -16,7 +16,7 @@ public class CutAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut")); this.setMnemonic('T'); - this.setSmallIcon("/com/fr/design/images/m_edit/cut.png"); + this.setSmallIcon("/com/fr/design/images/m_edit/cut"); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); this.setUpdateBehavior(new ComponentEnable()); this.setEnabled(!DesignModeContext.isBanCopyAndCut()); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java index 8c5194225..5f9a59de5 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java @@ -24,7 +24,7 @@ public class FormDeleteAction extends FormWidgetEditAction { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_Delete")); this.setMnemonic('D'); // Richie:删除菜单图标 - this.setSmallIcon("/com/fr/design/images/m_report/delete.png"); + this.setSmallIcon("/com/fr/design/images/m_report/delete"); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)); this.setUpdateBehavior(new ComponentEnable()); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java index 1670e3083..ef35097b2 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java @@ -14,7 +14,7 @@ public class PasteAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Edit_Paste")); this.setMnemonic('P'); - this.setSmallIcon("/com/fr/design/images/m_edit/paste.png"); + this.setSmallIcon("/com/fr/design/images/m_edit/paste"); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)); } diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java index e4e058af7..72c7b8bfd 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java @@ -28,7 +28,7 @@ public class FormParaTargetMode extends FormDesignerModeForSpecial { public WidgetOption[] getPredefinedWidgetOptions() { return new WidgetOption[]{ WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Query_Button"), - IconUtils.readIcon("/com/fr/web/images/form/resources/preview_16_normal.svg"), FormSubmitButton.class)}; + "/com/fr/web/images/form/resources/preview_16", FormSubmitButton.class)}; } public ArrayList createRootDesignerPropertyGroup() { 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 f11294919..b39dc9188 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 @@ -247,7 +247,7 @@ public class JForm extends JTemplate implements BaseJForm { this.setMenuKeySet(KeySetUtils.REPORT_FOOTER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_report/footer_normal.svg")); + this.setSmallIcon("/com/fr/design/images/m_report/footer"); } /** diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java index 50b70bf47..c23ed10b5 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java @@ -33,7 +33,7 @@ public class ReportHeaderAction extends ReportComponentAction { this.setMenuKeySet(KeySetUtils.REPORT_HEADER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_report/header_normal.svg")); + this.setSmallIcon("/com/fr/design/images/m_report/header"); } /** diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java index 3d976c5e9..b18c62b08 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java @@ -35,7 +35,7 @@ public class ReportMobileAttrAction extends JWorkBookAction{ this.setMenuKeySet(REPORT_APP_ATTR); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IconUtils.readIcon("/com/fr/design/images/m_report/mobile_normal.svg")); + this.setSmallIcon("/com/fr/design/images/m_report/mobile"); this.generateAndSetSearchText(ReportMobileAttrPane.class.getName()); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java index 796071054..9177f4d30 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java @@ -27,7 +27,7 @@ public class ReportPageAttrAction extends ReportComponentAction extends Tar MenuDef insertFloatMenu = new MenuDef(); insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName()); insertFloatMenu.setTooltip(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_T_Insert_Float")); - insertFloatMenu.setIconPath("/com/fr/design/images/m_insert/floatPop_normal.svg"); + insertFloatMenu.setIconPath("/com/fr/design/images/m_insert/floatPop"); UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, this); for (int i = 0; i < actions.length; i++) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java b/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java index 572538558..9b89864b6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java @@ -31,7 +31,7 @@ public class FormatBrushAction extends ElementCaseAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_FormatBrush")); this.setMnemonic('B'); - this.setSmallIcon("/com/fr/design/images/m_edit/formatBrush.png"); + this.setSmallIcon("/com/fr/design/images/m_edit/formatBrush"); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, DEFAULT_MODIFIER)); } 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 cdfc6d181..ff14d54f4 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 @@ -682,7 +682,7 @@ public class JWorkBook extends JTemplate { .addShortCut(new PageExcelExportAction(this), new ExcelExportAction(this), new PageToSheetExcelExportAction(this)); // Export - MenuDef MenuDef exportMenuDef = new MenuDef(KeySetUtils.EXPORT.getMenuName()); - exportMenuDef.setIconPath("/com/fr/design/images/m_file/export_normal.svg"); + exportMenuDef.setIconPath("/com/fr/design/images/m_file/export"); addShortCut(exportMenuDef, excelExportMenuDef); return exportMenuDef; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java index 9ea41b270..7b6fbff6f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java @@ -59,12 +59,12 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse private static final Color LINE_COLOR = new Color(0xababab); - private static final Icon ADD_WORK_SHEET = IconUtils.readIcon("com/fr/base/images/oem/add_worksheet_normal.svg"); - protected static final Icon ADD_POLY_SHEET = IconUtils.readIcon("com/fr/design/images/sheet/add_polysheet_normal.svg"); - private static final Icon WORK_SHEET_ICON = IconUtils.readIcon("com/fr/base/images/oem/worksheet_normal.svg"); - private static final Icon POLY_SHEET_ICON = IconUtils.readIcon("com/fr/design/images/sheet/polysheet_normal.svg"); - private static final Icon LEFT_ICON = IconUtils.readIcon("com/fr/design/images/sheet/pre_page_normal.svg"); - private static final Icon RIGHT_ICON = IconUtils.readIcon("com/fr/design/images/sheet/next_page_normal.svg"); + private static final Icon ADD_WORK_SHEET = IconUtils.readIcon("com/fr/base/images/oem/add_worksheet"); + protected static final Icon ADD_POLY_SHEET = IconUtils.readIcon("com/fr/design/images/sheet/add_polysheet"); + private static final Icon WORK_SHEET_ICON = IconUtils.readIcon("com/fr/base/images/oem/worksheet"); + private static final Icon POLY_SHEET_ICON = IconUtils.readIcon("com/fr/design/images/sheet/polysheet"); + private static final Icon LEFT_ICON = IconUtils.readIcon("com/fr/design/images/sheet/pre_page"); + private static final Icon RIGHT_ICON = IconUtils.readIcon("com/fr/design/images/sheet/next_page"); private static final Icon DISABLED_LEFT_ICON = IconUtils.readIcon("com/fr/design/images/sheet/pre_page_disabled.svg"); private static final Icon DISABLED_RIGHT_ICON = IconUtils.readIcon("com/fr/design/images/sheet/next_page_disabled.svg"); private static final int NUM = 10; diff --git a/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java b/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java index f5e9cface..1acda00e6 100644 --- a/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java +++ b/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java @@ -26,7 +26,7 @@ public class DeleteBlockAction extends UpdateAction implements TemplateComponent this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_Delete")); this.setMnemonic('D'); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); - this.setSmallIcon("/com/fr/design/images/m_report/delete.png"); + this.setSmallIcon("/com/fr/design/images/m_report/delete"); } @Override diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 3537bb76c..c1882270b 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -260,13 +260,8 @@ public class CellDSColumnEditor extends CellQuickEditor { condition.setEditingComponent(tc); } //丢掉icon,修改按钮名称为编辑 -<<<<<<< HEAD condition.setSmallIcon(UIConstants.BLACK_ICON); condition.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); -======= - condition.setSmallIcon(null); - condition.setName(Toolkit.i18nText("Fine-Design_Basic_Edit")); ->>>>>>> 6a58fc5b120d2dd8e44dbcb1ae5679f977fe2cd7 conditionUIButton = new UIButton(condition); Component[][] components = new Component[][]{ new Component[]{uiLabel, UIComponentUtils.wrapWithBorderLayoutPane(conditionUIButton)} diff --git a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java index a1051eb44..138e7df2b 100644 --- a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java +++ b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java @@ -365,7 +365,7 @@ public class ImagePreLoader { "com/fr/design/images/control/refresh.png", "com/fr/design/images/toolbarbtn/close.png", "com/fr/design/images/buttonicon/new_form3.png", - "com/fr/design/images/buttonicon/new_form_for_dock_normal.svg", + "com/fr/design/images/buttonicon/new_form3_normal.svg", "com/fr/design/images/m_file/save.png", "com/fr/design/images/m_file/save_normal.svg", "com/fr/design/images/m_file/save_disabled.svg", From 131ec5ca099ee8db1d9c11de9ed9ad49d92d3f49 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 25 Dec 2020 14:16:30 +0800 Subject: [PATCH 032/147] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13?= =?UTF-8?q?=E3=80=91JDK11=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.15:?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AF=AD=E5=8F=A5=EF=BC=8C=E5=B0=86=E4=B8=AD=E6=96=87=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=EF=BC=8C=E6=94=B9=E6=88=90=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/base/svg/IconUtils.java | 2 +- .../com/fr/design/EnvChangeEntranceTest.java | 286 ++++++++-------- .../design/extra/PluginOperateUtilsTest.java | 310 +++++++++--------- 3 files changed, 299 insertions(+), 299 deletions(-) diff --git a/designer-base/src/main/java/com/fr/base/svg/IconUtils.java b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java index f19e54323..119471dce 100644 --- a/designer-base/src/main/java/com/fr/base/svg/IconUtils.java +++ b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java @@ -63,7 +63,7 @@ public class IconUtils { if (IOUtils.readResource(gifPath) != null) { return IOUtils.readIcon(gifPath); } - FineLoggerFactory.getLogger().error(resource + "对应文件不存在"); + FineLoggerFactory.getLogger().error("File not exists:{}", resource); return new ImageIcon(); } diff --git a/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java index 7f53d05de..3b680915c 100644 --- a/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java +++ b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java @@ -1,143 +1,143 @@ -package com.fr.design; - -import com.fr.decision.webservice.v10.plugin.helper.PluginErrorRemindHandler; -import com.fr.design.env.DesignerWorkspaceInfo; -import com.fr.design.env.DesignerWorkspaceType; -import com.fr.design.env.LocalDesignerWorkspaceInfo; -import com.fr.design.env.RemoteDesignerWorkspaceInfo; -import com.fr.env.CheckServiceDialog; -import com.fr.env.PluginErrorRemindDialog; -import com.fr.invoke.Reflect; -import com.fr.workspace.connect.WorkspaceConnectionInfo; -import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; -import org.easymock.EasyMock; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.easymock.PowerMock; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import java.awt.Frame; - -/** - * @author: Maksim - * @Date: Created in 2020/3/5 - * @Description: - */ -@RunWith(PowerMockRunner.class) -@PrepareForTest({FunctionalHttpRequest.class, - EnvChangeEntrance.class, - CheckServiceDialog.class, - DesignerEnvManager.class, - PluginErrorRemindHandler.class}) -public class EnvChangeEntranceTest { - - @Test - public void showServiceDialog() throws Exception { - try { - EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); - DesignerWorkspaceInfo selectedEnv = EasyMock.mock(DesignerWorkspaceInfo.class); - WorkspaceConnectionInfo connectionInfo = EasyMock.mock(WorkspaceConnectionInfo.class); - - String remoteBranch = "Build#persist-2020.02.15.01.01.12.12"; - EasyMock.expect(selectedEnv.getConnection()).andReturn(connectionInfo); - EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Remote); - EasyMock.expect(selectedEnv.getRemindTime()).andReturn(null); - - FunctionalHttpRequest request = EasyMock.mock(FunctionalHttpRequest.class); - EasyMock.expect(request.getServiceList()).andReturn(null); - - PowerMock.expectNew(FunctionalHttpRequest.class, connectionInfo).andReturn(request).anyTimes(); - EasyMock.expect(request.getServerBranch()).andReturn(remoteBranch); - - CheckServiceDialog dialog = EasyMock.mock(CheckServiceDialog.class); - PowerMock.expectNew(CheckServiceDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString(), EasyMock.anyString(), EasyMock.anyString()).andReturn(dialog); - - EasyMock.replay(request, selectedEnv, connectionInfo); - PowerMock.replayAll(); - - entrance.showServiceDialog(selectedEnv); - - }catch (Exception e){ - Assert.fail(); - } - } - - @Test - public void testUpdateNotRememberPwdEnv() { - - DesignerEnvManager manager = new DesignerEnvManager(); - - PowerMock.mockStatic(DesignerEnvManager.class); - EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(manager).anyTimes(); - - PowerMock.replayAll(); - - EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); - - manager.putEnv("test1", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true))); - manager.putEnv("test2", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", false))); - manager.putEnv("test3", LocalDesignerWorkspaceInfo.create("name", "path")); - - Reflect.on(entrance).call("updateNotRememberPwdEnv"); - - Assert.assertEquals(manager.getWorkspaceInfo("test1").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)).getConnection()); - Assert.assertEquals(manager.getWorkspaceInfo("test2").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "", "", "", false)).getConnection()); - Assert.assertEquals(manager.getWorkspaceInfo("test3").getName(), "name"); - Assert.assertEquals(manager.getWorkspaceInfo("test3").getPath(), "path"); - - PowerMock.verifyAll(); - - } - - @Test - public void testIsNotRememberPwd() { - EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); - - DesignerWorkspaceInfo info1 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)); - DesignerWorkspaceInfo info2 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "111", "", "", false)); - DesignerWorkspaceInfo info3 = LocalDesignerWorkspaceInfo.create("name", "path"); - DesignerWorkspaceInfo info4 = null; - - Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info1).get()); - Assert.assertTrue(Reflect.on(entrance).call("isNotRememberPwd", info2).get()); - Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info3).get()); - Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info4).get()); - } - - @Test - public void testPluginErrorRemind() throws Exception { - - try { - DesignerWorkspaceInfo selectedEnv = EasyMock.mock(DesignerWorkspaceInfo.class); - EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Remote).once(); - EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Local).times(2); - - PowerMock.mockStatic(PluginErrorRemindHandler.class); - EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("").once(); - EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("111").once(); - - PluginErrorRemindDialog dialog = EasyMock.mock(PluginErrorRemindDialog.class); - PowerMock.expectNew(PluginErrorRemindDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString()).andReturn(dialog).once(); - - dialog.setVisible(true); - EasyMock.expectLastCall(); - - EasyMock.replay(selectedEnv, dialog); - PowerMock.replayAll(); - - EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); - - entrance.pluginErrorRemind(selectedEnv); - entrance.pluginErrorRemind(selectedEnv); - entrance.pluginErrorRemind(selectedEnv); - - - EasyMock.verify(selectedEnv, dialog); - PowerMock.verifyAll(); - } catch (Exception e) { - Assert.fail(); - } - } -} \ No newline at end of file +//package com.fr.design; +// +////import com.fr.decision.webservice.v10.plugin.helper.PluginErrorRemindHandler; +//import com.fr.design.env.DesignerWorkspaceInfo; +//import com.fr.design.env.DesignerWorkspaceType; +//import com.fr.design.env.LocalDesignerWorkspaceInfo; +//import com.fr.design.env.RemoteDesignerWorkspaceInfo; +//import com.fr.env.CheckServiceDialog; +//import com.fr.env.PluginErrorRemindDialog; +//import com.fr.invoke.Reflect; +//import com.fr.workspace.connect.WorkspaceConnectionInfo; +//import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; +//import org.easymock.EasyMock; +//import org.junit.Assert; +//import org.junit.Test; +//import org.junit.runner.RunWith; +//import org.powermock.api.easymock.PowerMock; +//import org.powermock.core.classloader.annotations.PrepareForTest; +//import org.powermock.modules.junit4.PowerMockRunner; +// +//import java.awt.Frame; +// +///** +// * @author: Maksim +// * @Date: Created in 2020/3/5 +// * @Description: +// */ +//@RunWith(PowerMockRunner.class) +//@PrepareForTest({FunctionalHttpRequest.class, +// EnvChangeEntrance.class, +// CheckServiceDialog.class, +// DesignerEnvManager.class, +// PluginErrorRemindHandler.class}) +//public class EnvChangeEntranceTest { +// +// @Test +// public void showServiceDialog() throws Exception { +// try { +// EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); +// DesignerWorkspaceInfo selectedEnv = EasyMock.mock(DesignerWorkspaceInfo.class); +// WorkspaceConnectionInfo connectionInfo = EasyMock.mock(WorkspaceConnectionInfo.class); +// +// String remoteBranch = "Build#persist-2020.02.15.01.01.12.12"; +// EasyMock.expect(selectedEnv.getConnection()).andReturn(connectionInfo); +// EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Remote); +// EasyMock.expect(selectedEnv.getRemindTime()).andReturn(null); +// +// FunctionalHttpRequest request = EasyMock.mock(FunctionalHttpRequest.class); +// EasyMock.expect(request.getServiceList()).andReturn(null); +// +// PowerMock.expectNew(FunctionalHttpRequest.class, connectionInfo).andReturn(request).anyTimes(); +// EasyMock.expect(request.getServerBranch()).andReturn(remoteBranch); +// +// CheckServiceDialog dialog = EasyMock.mock(CheckServiceDialog.class); +// PowerMock.expectNew(CheckServiceDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString(), EasyMock.anyString(), EasyMock.anyString()).andReturn(dialog); +// +// EasyMock.replay(request, selectedEnv, connectionInfo); +// PowerMock.replayAll(); +// +// entrance.showServiceDialog(selectedEnv); +// +// }catch (Exception e){ +// Assert.fail(); +// } +// } +// +// @Test +// public void testUpdateNotRememberPwdEnv() { +// +// DesignerEnvManager manager = new DesignerEnvManager(); +// +// PowerMock.mockStatic(DesignerEnvManager.class); +// EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(manager).anyTimes(); +// +// PowerMock.replayAll(); +// +// EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); +// +// manager.putEnv("test1", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true))); +// manager.putEnv("test2", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", false))); +// manager.putEnv("test3", LocalDesignerWorkspaceInfo.create("name", "path")); +// +// Reflect.on(entrance).call("updateNotRememberPwdEnv"); +// +// Assert.assertEquals(manager.getWorkspaceInfo("test1").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)).getConnection()); +// Assert.assertEquals(manager.getWorkspaceInfo("test2").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "", "", "", false)).getConnection()); +// Assert.assertEquals(manager.getWorkspaceInfo("test3").getName(), "name"); +// Assert.assertEquals(manager.getWorkspaceInfo("test3").getPath(), "path"); +// +// PowerMock.verifyAll(); +// +// } +// +// @Test +// public void testIsNotRememberPwd() { +// EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); +// +// DesignerWorkspaceInfo info1 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)); +// DesignerWorkspaceInfo info2 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "111", "", "", false)); +// DesignerWorkspaceInfo info3 = LocalDesignerWorkspaceInfo.create("name", "path"); +// DesignerWorkspaceInfo info4 = null; +// +// Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info1).get()); +// Assert.assertTrue(Reflect.on(entrance).call("isNotRememberPwd", info2).get()); +// Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info3).get()); +// Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info4).get()); +// } +// +// @Test +// public void testPluginErrorRemind() throws Exception { +// +// try { +// DesignerWorkspaceInfo selectedEnv = EasyMock.mock(DesignerWorkspaceInfo.class); +// EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Remote).once(); +// EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Local).times(2); +// +// PowerMock.mockStatic(PluginErrorRemindHandler.class); +// EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("").once(); +// EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("111").once(); +// +// PluginErrorRemindDialog dialog = EasyMock.mock(PluginErrorRemindDialog.class); +// PowerMock.expectNew(PluginErrorRemindDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString()).andReturn(dialog).once(); +// +// dialog.setVisible(true); +// EasyMock.expectLastCall(); +// +// EasyMock.replay(selectedEnv, dialog); +// PowerMock.replayAll(); +// +// EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); +// +// entrance.pluginErrorRemind(selectedEnv); +// entrance.pluginErrorRemind(selectedEnv); +// entrance.pluginErrorRemind(selectedEnv); +// +// +// EasyMock.verify(selectedEnv, dialog); +// PowerMock.verifyAll(); +// } catch (Exception e) { +// Assert.fail(); +// } +// } +//} diff --git a/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java b/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java index bc81cb2c3..edcde5d11 100644 --- a/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java +++ b/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java @@ -1,155 +1,155 @@ -package com.fr.design.extra; - -import com.fr.invoke.Reflect; -import com.fr.json.JSONObject; -import com.fr.plugin.context.PluginContext; -import com.fr.plugin.context.PluginMarker; -import com.fr.plugin.context.PluginMarkerAdapter; -import com.fr.plugin.error.PluginErrorCode; -import com.fr.plugin.manage.PluginManager; -import com.fr.plugin.manage.control.PluginTask; -import com.fr.plugin.manage.control.PluginTaskResult; -import org.easymock.EasyMock; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.easymock.PowerMock; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Lucian.Chen - * @version 10.0 - * Created by Lucian.Chen on 2020/12/17 - */ -@RunWith(PowerMockRunner.class) -@PrepareForTest({PluginManager.class, PluginUtils.class}) -public class PluginOperateUtilsTest { - - @Test - public void testGetSuccessInfo() { - PluginTaskResult pluginTaskResult = EasyMock.mock(PluginTaskResult.class); - PluginTaskResult pluginTaskResult1 = EasyMock.mock(PluginTaskResult.class); - PluginTaskResult pluginTaskResult2 = EasyMock.mock(PluginTaskResult.class); - - List pluginTaskResults1 = new ArrayList<>(); - pluginTaskResults1.add(pluginTaskResult1); - List pluginTaskResults2 = new ArrayList<>(); - pluginTaskResults2.add(pluginTaskResult1); - pluginTaskResults2.add(pluginTaskResult2); - - PluginMarker pluginMarker1 = PluginMarker.create("plugin-1", "1.0"); - PluginMarker pluginMarker2 = PluginMarkerAdapter.create("plugin-2", "2.0", "name-2"); - PluginTask pluginTask1 = PluginTask.installTask(pluginMarker1); - PluginTask pluginTask2 = PluginTask.installTask(pluginMarker2); - - EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults1).times(2); - EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults2).times(2); - EasyMock.expect(pluginTaskResult1.getCurrentTask()).andReturn(pluginTask1).anyTimes(); - EasyMock.expect(pluginTaskResult2.getCurrentTask()).andReturn(pluginTask2).anyTimes(); - - EasyMock.expect(pluginTaskResult1.errorCode()).andReturn(PluginErrorCode.BelowSystem).anyTimes(); - EasyMock.expect(pluginTaskResult2.errorCode()).andReturn(PluginErrorCode.BeyondSystem).anyTimes(); - - PluginContext plugin1 = EasyMock.mock(PluginContext.class); - PluginContext plugin2 = EasyMock.mock(PluginContext.class); - EasyMock.expect(plugin1.getName()).andReturn("context-1").anyTimes(); - EasyMock.expect(plugin2.getName()).andReturn("context-2").anyTimes(); - PowerMock.mockStatic(PluginManager.class); - EasyMock.expect(PluginManager.getContext(pluginMarker1.getPluginID())) - .andReturn(plugin1).once().andReturn(null).once().andReturn(plugin1).once().andReturn(null).once(); - EasyMock.expect(PluginManager.getContext(pluginMarker2.getPluginID())) - .andReturn(plugin2).once().andReturn(null).once(); - - EasyMock.replay(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); - PowerMock.replayAll(); - - // 1个 - Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem"); - Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem"); - - - // 2个 - Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem\ncontext-2Fine-Core_Plugin_Error_BeyondSystem"); - Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem\nname-2Fine-Core_Plugin_Error_BeyondSystem"); - - EasyMock.verify(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); - PowerMock.verifyAll(); - - } - - - @Test - public void testGetPluginName() { - PluginContext pluginContext = EasyMock.mock(PluginContext.class); - EasyMock.expect(pluginContext.getName()).andReturn("pluginContext").once(); - - PluginMarker pluginMarker1 = PluginMarker.create("id-1", "1"); - PluginMarker pluginMarker2 = PluginMarkerAdapter.create("id-2", "2", "name-2"); - - EasyMock.replay(pluginContext); - - Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, null).get(), ""); - Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", pluginContext, pluginMarker1).get(), "pluginContext"); - Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker1).get(), "id-1"); - Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker2).get(), "name-2"); - - EasyMock.verify(pluginContext); - } - - @Test - public void testUpdateMarker2Online() { - - try { - PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); - String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; - JSONObject object = new JSONObject(pluginJson); - - PowerMock.mockStatic(PluginUtils.class); - EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); - EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andThrow(new NullPointerException()).once(); - - PowerMock.replayAll(); - - PluginMarker marker1 = PluginOperateUtils.updateMarker2Online(pluginMarker); - PluginMarker marker2 = PluginOperateUtils.updateMarker2Online(pluginMarker); - - Assert.assertTrue(marker1 instanceof PluginMarkerAdapter); - Assert.assertEquals(marker1.getPluginID(), "plugin-1"); - Assert.assertEquals(marker1.getVersion(), "1.0"); - Assert.assertEquals(((PluginMarkerAdapter) marker1).getPluginName(), "图表(新特性)"); - Assert.assertEquals(marker2, pluginMarker); - - PowerMock.verifyAll(); - } catch (Exception e) { - Assert.fail(); - } - - } - - - @Test - public void testUpdatePluginOnline() { - try { - PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); - String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; - JSONObject object = new JSONObject(pluginJson); - - PowerMock.mockStatic(PluginUtils.class); - EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); - EasyMock.expect(PluginUtils.getInstalledPluginMarkerByID("plugin-1")).andReturn(pluginMarker).once(); - - PowerMock.replayAll(); - - PluginOperateUtils.updatePluginOnline(pluginMarker, null); - - PowerMock.verifyAll(); - } catch (Exception e) { - Assert.fail(); - } - } - -} +//package com.fr.design.extra; +// +//import com.fr.invoke.Reflect; +//import com.fr.json.JSONObject; +//import com.fr.plugin.context.PluginContext; +//import com.fr.plugin.context.PluginMarker; +//import com.fr.plugin.context.PluginMarkerAdapter; +//import com.fr.plugin.error.PluginErrorCode; +//import com.fr.plugin.manage.PluginManager; +//import com.fr.plugin.manage.control.PluginTask; +//import com.fr.plugin.manage.control.PluginTaskResult; +//import org.easymock.EasyMock; +//import org.junit.Assert; +//import org.junit.Test; +//import org.junit.runner.RunWith; +//import org.powermock.api.easymock.PowerMock; +//import org.powermock.core.classloader.annotations.PrepareForTest; +//import org.powermock.modules.junit4.PowerMockRunner; +// +//import java.util.ArrayList; +//import java.util.List; +// +///** +// * @author Lucian.Chen +// * @version 10.0 +// * Created by Lucian.Chen on 2020/12/17 +// */ +//@RunWith(PowerMockRunner.class) +//@PrepareForTest({PluginManager.class, PluginUtils.class}) +//public class PluginOperateUtilsTest { +// +// @Test +// public void testGetSuccessInfo() { +// PluginTaskResult pluginTaskResult = EasyMock.mock(PluginTaskResult.class); +// PluginTaskResult pluginTaskResult1 = EasyMock.mock(PluginTaskResult.class); +// PluginTaskResult pluginTaskResult2 = EasyMock.mock(PluginTaskResult.class); +// +// List pluginTaskResults1 = new ArrayList<>(); +// pluginTaskResults1.add(pluginTaskResult1); +// List pluginTaskResults2 = new ArrayList<>(); +// pluginTaskResults2.add(pluginTaskResult1); +// pluginTaskResults2.add(pluginTaskResult2); +// +// PluginMarker pluginMarker1 = PluginMarker.create("plugin-1", "1.0"); +// PluginMarker pluginMarker2 = PluginMarkerAdapter.create("plugin-2", "2.0", "name-2"); +// PluginTask pluginTask1 = PluginTask.installTask(pluginMarker1); +// PluginTask pluginTask2 = PluginTask.installTask(pluginMarker2); +// +// EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults1).times(2); +// EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults2).times(2); +// EasyMock.expect(pluginTaskResult1.getCurrentTask()).andReturn(pluginTask1).anyTimes(); +// EasyMock.expect(pluginTaskResult2.getCurrentTask()).andReturn(pluginTask2).anyTimes(); +// +// EasyMock.expect(pluginTaskResult1.errorCode()).andReturn(PluginErrorCode.BelowSystem).anyTimes(); +// EasyMock.expect(pluginTaskResult2.errorCode()).andReturn(PluginErrorCode.BeyondSystem).anyTimes(); +// +// PluginContext plugin1 = EasyMock.mock(PluginContext.class); +// PluginContext plugin2 = EasyMock.mock(PluginContext.class); +// EasyMock.expect(plugin1.getName()).andReturn("context-1").anyTimes(); +// EasyMock.expect(plugin2.getName()).andReturn("context-2").anyTimes(); +// PowerMock.mockStatic(PluginManager.class); +// EasyMock.expect(PluginManager.getContext(pluginMarker1.getPluginID())) +// .andReturn(plugin1).once().andReturn(null).once().andReturn(plugin1).once().andReturn(null).once(); +// EasyMock.expect(PluginManager.getContext(pluginMarker2.getPluginID())) +// .andReturn(plugin2).once().andReturn(null).once(); +// +// EasyMock.replay(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); +// PowerMock.replayAll(); +// +// // 1个 +// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem"); +// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem"); +// +// +// // 2个 +// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem\ncontext-2Fine-Core_Plugin_Error_BeyondSystem"); +// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem\nname-2Fine-Core_Plugin_Error_BeyondSystem"); +// +// EasyMock.verify(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); +// PowerMock.verifyAll(); +// +// } +// +// +// @Test +// public void testGetPluginName() { +// PluginContext pluginContext = EasyMock.mock(PluginContext.class); +// EasyMock.expect(pluginContext.getName()).andReturn("pluginContext").once(); +// +// PluginMarker pluginMarker1 = PluginMarker.create("id-1", "1"); +// PluginMarker pluginMarker2 = PluginMarkerAdapter.create("id-2", "2", "name-2"); +// +// EasyMock.replay(pluginContext); +// +// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, null).get(), ""); +// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", pluginContext, pluginMarker1).get(), "pluginContext"); +// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker1).get(), "id-1"); +// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker2).get(), "name-2"); +// +// EasyMock.verify(pluginContext); +// } +// +// @Test +// public void testUpdateMarker2Online() { +// +// try { +// PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); +// String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; +// JSONObject object = new JSONObject(pluginJson); +// +// PowerMock.mockStatic(PluginUtils.class); +// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); +// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andThrow(new NullPointerException()).once(); +// +// PowerMock.replayAll(); +// +// PluginMarker marker1 = PluginOperateUtils.updateMarker2Online(pluginMarker); +// PluginMarker marker2 = PluginOperateUtils.updateMarker2Online(pluginMarker); +// +// Assert.assertTrue(marker1 instanceof PluginMarkerAdapter); +// Assert.assertEquals(marker1.getPluginID(), "plugin-1"); +// Assert.assertEquals(marker1.getVersion(), "1.0"); +// Assert.assertEquals(((PluginMarkerAdapter) marker1).getPluginName(), "图表(新特性)"); +// Assert.assertEquals(marker2, pluginMarker); +// +// PowerMock.verifyAll(); +// } catch (Exception e) { +// Assert.fail(); +// } +// +// } +// +// +// @Test +// public void testUpdatePluginOnline() { +// try { +// PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); +// String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; +// JSONObject object = new JSONObject(pluginJson); +// +// PowerMock.mockStatic(PluginUtils.class); +// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); +// EasyMock.expect(PluginUtils.getInstalledPluginMarkerByID("plugin-1")).andReturn(pluginMarker).once(); +// +// PowerMock.replayAll(); +// +// PluginOperateUtils.updatePluginOnline(pluginMarker, null); +// +// PowerMock.verifyAll(); +// } catch (Exception e) { +// Assert.fail(); +// } +// } +// +//} From 5d34cb788006ea47ba43214b330608739a4aaedc Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 28 Dec 2020 09:53:58 +0800 Subject: [PATCH 033/147] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../richText/VanChartFieldAttrPane.java | 20 +++-- .../richText/VanChartFieldListPane.java | 5 +- .../richText/VanChartRichEditorModel.java | 11 +++ .../richText/VanChartRichEditorPane.java | 74 +++++++++---------- .../com/fr/design/editor/rich_editor.html | 31 +++++++- 5 files changed, 86 insertions(+), 55 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java index cc99a2ce1..89c3cd73e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java @@ -16,7 +16,6 @@ import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionListener; -import java.awt.event.MouseListener; import java.text.Format; public class VanChartFieldAttrPane extends JPanel { @@ -27,6 +26,15 @@ public class VanChartFieldAttrPane extends JPanel { private JPanel fieldFunctionPane; public VanChartFieldAttrPane() { + initComponents(); + + this.setLayout(new BorderLayout()); + this.add(fieldFormatPane, BorderLayout.NORTH); + this.add(fieldFunctionPane, BorderLayout.CENTER); + this.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); + } + + private void initComponents() { double p = TableLayout.PREFERRED; double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; @@ -35,10 +43,6 @@ public class VanChartFieldAttrPane extends JPanel { protected JPanel createContentPane(Component[][] components) { return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, new double[]{d, e}); } - - public void addActionListener(ActionListener listener) { - - } }; fieldDataFunction = new CalculateComboBox(); @@ -49,11 +53,6 @@ public class VanChartFieldAttrPane extends JPanel { }; fieldFunctionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{d, e}); - - this.setLayout(new BorderLayout()); - this.add(fieldFormatPane, BorderLayout.NORTH); - this.add(fieldFunctionPane, BorderLayout.CENTER); - this.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); } public void registerFunctionListener(ActionListener listener) { @@ -67,7 +66,6 @@ public class VanChartFieldAttrPane extends JPanel { public void populate(Format format, AbstractDataFunction dataFunction, boolean showDataFunction) { fieldFormatPane.populateBean(format); fieldDataFunction.populateBean(dataFunction); - fieldFunctionPane.setVisible(showDataFunction); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index aa3dbd17b..c4039c691 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -194,9 +194,8 @@ public class VanChartFieldListPane extends JPanel { public void addSelectedField(String fieldName, String fieldId) { VanChartRichEditorModel model = richEditorPane.update(); - String content = model.getContent() + getFieldRichText(fieldName, fieldId); - model.setContent(content); - VanChartRichEditorPane.createRichEditorPane(model); + model.setAddition(fieldName); + VanChartRichEditorPane.richEditorAddField(model); } public void populateFieldFormatPane() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java index 245eaa951..83df27c0f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java @@ -10,6 +10,7 @@ public class VanChartRichEditorModel { private String params = StringUtils.EMPTY; private String initParams = StringUtils.EMPTY; private String align = TextAlign.LEFT.getAlign(); + private String addition = StringUtils.EMPTY; public VanChartRichEditorModel() { } @@ -20,6 +21,7 @@ public class VanChartRichEditorModel { this.params = params; this.initParams = initParams; this.align = align; + this.addition = StringUtils.EMPTY; } public String getContent() { @@ -61,4 +63,13 @@ public class VanChartRichEditorModel { public void setAlign(String align) { this.align = align; } + + public String getAddition() { + return addition; + } + + public void setAddition(String addition) { + this.addition = addition; + } + } 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 99afba30e..87710da55 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 @@ -1,10 +1,8 @@ package com.fr.van.chart.designer.component.richText; -import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; import com.fr.design.ui.ModernUIPane; import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.type.TextAlign; import com.fr.stable.StringUtils; @@ -15,38 +13,20 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import java.util.Locale; import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; public class VanChartRichEditorPane { - private static final String namespace = "Pool"; - private static final String variable = "data"; - private static final String richEditorPath = "/com/fr/design/editor/rich_editor.html"; - private static final String expression = "dispatch()"; + private static final String NAME_SPACE = "Pool"; + private static final String VARIABLE = "data"; + + private static final String RICH_EDITOR_HTML = "/com/fr/design/editor/rich_editor.html"; + + private static final String REFRESH = "refresh()"; + private static final String ADD_FIELD = "addField()"; private static ModernUIPane richEditorPane; private static Browser browser; - public static void initRichEditorPane() { - ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor(new NamedThreadFactory("VanChartRichEditor")); - - try { - singleThreadExecutor.submit(new Runnable() { - @Override - public void run() { - try { - richEditorPane = initPane(new VanChartRichEditorModel()); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - }); - } finally { - singleThreadExecutor.shutdown(); - } - } - public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { VanChartRichEditorModel model = getRichEditorModel(richEditor); return createRichEditorPane(model); @@ -55,13 +35,25 @@ public class VanChartRichEditorPane { public static ModernUIPane createRichEditorPane(VanChartRichEditorModel model) { if (richEditorPane == null) { richEditorPane = initPane(model); - } else if (browser != null) { - updatePane(browser, model); + } else { + richEditorRefresh(model); } return richEditorPane; } + public static void richEditorRefresh(VanChartRichEditorModel model) { + if (richEditorPane != null && browser != null) { + refresh(browser, model); + } + } + + public static void richEditorAddField(VanChartRichEditorModel model) { + if (richEditorPane != null && browser != null) { + addField(browser, model); + } + } + public static ModernUIPane initPane(VanChartRichEditorModel model) { return new ModernUIPane.Builder() .prepare(new ScriptContextAdapter() { @@ -74,18 +66,26 @@ public class VanChartRichEditorPane { browser.executeJavaScript(generateTransformI18nJS()); browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/web/ui/materials.min.js")); - JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace); - ns.asObject().setProperty(variable, model); + JSValue ns = browser.executeJavaScriptAndReturnValue("window." + NAME_SPACE); + ns.asObject().setProperty(VARIABLE, model); } }) - .withEMB(richEditorPath) - .namespace(namespace).build(); + .withEMB(RICH_EDITOR_HTML) + .namespace(NAME_SPACE).build(); + } + + public static void refresh(Browser browser, VanChartRichEditorModel model) { + stateChange(browser, model, REFRESH); + } + + public static void addField(Browser browser, VanChartRichEditorModel model) { + stateChange(browser, model, ADD_FIELD); } - public static void updatePane(Browser browser, VanChartRichEditorModel model) { - JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace); - ns.asObject().setProperty(variable, model); - browser.executeJavaScript("window." + namespace + "." + expression); + public static void stateChange(Browser browser, VanChartRichEditorModel model, String trigger) { + JSValue ns = browser.executeJavaScriptAndReturnValue("window." + NAME_SPACE); + ns.asObject().setProperty(VARIABLE, model); + browser.executeJavaScript("window." + NAME_SPACE + "." + trigger); } public static VanChartRichEditorModel getRichEditorModel(AttrTooltipRichText richText) { diff --git a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html index e6c769f0a..f62d7dbb2 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html +++ b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html @@ -88,8 +88,7 @@ {type: "bi.rich_editor_color_chooser"}, {type: "bi.rich_editor_align_left_button"}, {type: "bi.rich_editor_align_center_button"}, - {type: "bi.rich_editor_align_right_button"}, - {type: "bi.design.chart.common.editor.insert_param"} + {type: "bi.rich_editor_align_right_button"} ] }, ref: function (_ref) { @@ -97,7 +96,7 @@ } }); - Pool.dispatch = function () { + Pool.refresh = function () { var content = Pool.data.getContent(); var isAuto = Pool.data.isAuto(); var params = Pool.data.getParams(); @@ -117,7 +116,31 @@ }); rich_editor.setFocus(); - } + }; + + Pool.addField = function () { + var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); + + var content = Pool.data.getContent(); + var isAuto = Pool.data.isAuto(); + var params = Pool.data.getParams(); + var addition = Pool.data.getAddition(); + + if (addition) { + // todo 暂时先处理成在content后加一行 + content += '

' + editorService.getEditorParamImage(addition) + '

'; + } + + rich_editor.editor.bindToolbar(rich_editor.bar); + + rich_editor.setValue({ + content: content, + isAuto: isAuto, + dimensionIds: getDimensionIds(params) + }); + + rich_editor.setFocus(); + }; Pool.update = function () { var {content, isAuto} = rich_editor.getValue(); From 9760575f9fe1878be67abe2d0acc79c6c80e093a Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 28 Dec 2020 17:34:37 +0800 Subject: [PATCH 034/147] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 2 +- .../richText/VanChartFieldButton.java | 23 +++- .../richText/VanChartFieldListPane.java | 109 +++++++++--------- .../richText/VanChartRichTextPane.java | 26 +---- 4 files changed, 79 insertions(+), 81 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 9700e4faa..89a627518 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -439,7 +439,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - VanChartRichTextPane richTextPane = new VanChartRichTextPane(parent, getTableFieldNames(), richEditorPane); + VanChartRichTextPane richTextPane = new VanChartRichTextPane(getTableFieldNames(), richEditorPane); BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); // 更新字段格式和汇总方式 diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java index 9c0c20d11..a3ccc2a47 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java @@ -6,6 +6,8 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.Icon; @@ -28,19 +30,20 @@ public class VanChartFieldButton extends JPanel { private final String fieldName; private final String fieldId; + private final AttrTooltipFormat tooltipFormat; private final boolean showDataFunction; private UIToggleButton fieldButton; private UIButton addButton; - private Format format; private DataFunction dataFunction; - public VanChartFieldButton(String fieldName, String fieldId, boolean showSummary, VanChartFieldListener listener) { + public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, VanChartFieldListener listener) { this.fieldName = fieldName; - this.fieldId = fieldId; + this.tooltipFormat = format; + this.showDataFunction = showDataFunction; - this.showDataFunction = showSummary; + this.fieldId = format == null ? StringUtils.EMPTY : format.getFormatJSONKey(); initComponents(fieldName, listener); @@ -52,12 +55,20 @@ public class VanChartFieldButton extends JPanel { return fieldName; } + public boolean isEnable() { + return this.tooltipFormat.isEnable(); + } + + public void setEnable(boolean enable) { + this.tooltipFormat.setEnable(enable); + } + public Format getFormat() { - return format; + return tooltipFormat.getFormat(); } public void setFormat(Format format) { - this.format = format; + this.tooltipFormat.setFormat(format); } public DataFunction getDataFunction() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index c4039c691..f7fb81d0c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -7,6 +7,7 @@ import com.fr.design.ui.ModernUIPane; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; @@ -49,6 +50,8 @@ public class VanChartFieldListPane extends JPanel { this.richEditorPane = richEditorPane; initFieldListListener(); + initDefaultFieldButton(); + registerAttrListener(); this.setLayout(new BorderLayout()); @@ -58,58 +61,37 @@ public class VanChartFieldListPane extends JPanel { } private JPanel createDefaultFieldPane() { - JPanel defaultField = new JPanel(); + JPanel fieldPane = new JPanel(); - defaultField.setLayout(new GridLayout(0, 1, 1, 0)); - createDefaultButtonGroup(defaultField); + fieldPane.setLayout(new GridLayout(0, 1, 1, 0)); - List defaultFieldButtonList = getDefaultFieldButtonList(); + addDefaultFieldButton(fieldPane); - defaultField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldButtonList.size() * FIELD_ADD_H)); - defaultField.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); + fieldPane.setPreferredSize(new Dimension(FIELD_ADD_W, getDefaultFieldButtonList().size() * FIELD_ADD_H)); + fieldPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); - return defaultField; + return fieldPane; } - protected void createDefaultButtonGroup(JPanel field) { - categoryNameButton = createCategoryFieldButton(); - seriesNameButton = createSeriesFieldButton(); - valueButton = createValueFieldButton(); - percentButton = createPercentFieldButton(); + protected void initDefaultFieldButton() { + categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + new AttrTooltipCategoryFormat(), false, fieldListener); - field.add(categoryNameButton); - field.add(seriesNameButton); - field.add(valueButton); - field.add(percentButton); - } + seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + new AttrTooltipSeriesFormat(), false, fieldListener); - // 不同图表的name和id不一样 - protected VanChartFieldButton createCategoryFieldButton() { - String name = Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"); - String id = new AttrTooltipCategoryFormat().getFormatJSONKey(); + valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + new AttrTooltipValueFormat(), false, fieldListener); - return new VanChartFieldButton(name, id, false, fieldListener); + percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); } - protected VanChartFieldButton createSeriesFieldButton() { - String name = Toolkit.i18nText("Fine-Design_Chart_Series_Name"); - String id = new AttrTooltipSeriesFormat().getFormatJSONKey(); - - return new VanChartFieldButton(name, id, false, fieldListener); - } - - protected VanChartFieldButton createValueFieldButton() { - String name = Toolkit.i18nText("Fine-Design_Chart_Use_Value"); - String id = new AttrTooltipValueFormat().getFormatJSONKey(); - - return new VanChartFieldButton(name, id, false, fieldListener); - } - - protected VanChartFieldButton createPercentFieldButton() { - String name = Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); - String id = new AttrTooltipPercentFormat().getFormatJSONKey(); - - return new VanChartFieldButton(name, id, false, fieldListener); + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(categoryNameButton); + fieldPane.add(seriesNameButton); + fieldPane.add(valueButton); + fieldPane.add(percentButton); } private JPanel createTableFieldPane() { @@ -122,7 +104,7 @@ public class VanChartFieldListPane extends JPanel { tableField.setLayout(new GridLayout(0, 1, 1, 0)); for (String name : tableFieldNameList) { - VanChartFieldButton fieldButton = new VanChartFieldButton(name, name, true, fieldListener); + VanChartFieldButton fieldButton = new VanChartFieldButton(name, getTableTooltipFormat(name), true, fieldListener); tableField.add(fieldButton); tableFieldButtonList.add(fieldButton); @@ -133,6 +115,11 @@ public class VanChartFieldListPane extends JPanel { return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); } + // 生成新增字段对应的format + private AttrTooltipFormat getTableTooltipFormat(String fieldName) { + return new AttrTooltipCategoryFormat(); + } + protected List getDefaultFieldButtonList() { List defaultFieldButtonList = new ArrayList<>(); @@ -252,10 +239,6 @@ public class VanChartFieldListPane extends JPanel { } } - private String getFieldRichText(String fieldName, String fieldId) { - return "

" + fieldName + "

"; - } - public void populate(AttrTooltipContent tooltipContent) { populateDefaultField(tooltipContent); populateTableField(tooltipContent); @@ -265,10 +248,19 @@ public class VanChartFieldListPane extends JPanel { } public void populateDefaultField(AttrTooltipContent tooltipContent) { - categoryNameButton.setFormat(tooltipContent.getRichTextCategoryFormat().getFormat()); - seriesNameButton.setFormat(tooltipContent.getRichTextSeriesFormat().getFormat()); - valueButton.setFormat(tooltipContent.getRichTextValueFormat().getFormat()); - percentButton.setFormat(tooltipContent.getRichTextPercentFormat().getFormat()); + populateButtonFormat(categoryNameButton, tooltipContent.getRichTextCategoryFormat()); + populateButtonFormat(seriesNameButton, tooltipContent.getRichTextSeriesFormat()); + populateButtonFormat(valueButton, tooltipContent.getRichTextValueFormat()); + populateButtonFormat(percentButton, tooltipContent.getRichTextPercentFormat()); + } + + public void populateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) { + if (button == null || format == null) { + return; + } + + button.setEnable(format.isEnable()); + button.setFormat(format.getFormat()); } public void populateTableField(AttrTooltipContent tooltipContent) { @@ -281,13 +273,22 @@ public class VanChartFieldListPane extends JPanel { } public void updateDefaultField(AttrTooltipContent tooltipContent) { - tooltipContent.getRichTextCategoryFormat().setFormat(categoryNameButton.getFormat()); - tooltipContent.getRichTextSeriesFormat().setFormat(seriesNameButton.getFormat()); - tooltipContent.getRichTextValueFormat().setFormat(valueButton.getFormat()); - tooltipContent.getRichTextPercentFormat().setFormat(percentButton.getFormat()); + updateButtonFormat(categoryNameButton, tooltipContent.getRichTextCategoryFormat()); + updateButtonFormat(seriesNameButton, tooltipContent.getRichTextSeriesFormat()); + updateButtonFormat(valueButton, tooltipContent.getRichTextValueFormat()); + updateButtonFormat(percentButton, tooltipContent.getRichTextPercentFormat()); } public void updateTableField(AttrTooltipContent tooltipContent) { } + + public void updateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) { + if (button == null || format == null) { + return; + } + + format.setEnable(button.isEnable()); + format.setFormat(button.getFormat()); + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java index e48050619..7ee3f3df6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -5,7 +5,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.stable.StringUtils; -import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -26,27 +25,14 @@ public class VanChartRichTextPane extends BasicBeanPane { private VanChartFieldListPane fieldListPane; private VanChartFieldAttrPane fieldAttrPane; - private VanChartStylePane parent; + public VanChartRichTextPane(List tableFieldNames, ModernUIPane richEditor) { - private List tableFieldsFormat; - - private ModernUIPane richEditor; - - public VanChartRichTextPane(VanChartStylePane parent, List tableFieldsFormat, ModernUIPane richEditor) { - this.parent = parent; - this.tableFieldsFormat = tableFieldsFormat; - this.richEditor = richEditor; - - initFieldContent(); + fieldAttrPane = new VanChartFieldAttrPane(); + fieldListPane = new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); this.setLayout(new BorderLayout()); this.add(createFieldContentPane(), BorderLayout.CENTER); - this.add(createRichEditorPane(), BorderLayout.SOUTH); - } - - private void initFieldContent() { - fieldAttrPane = new VanChartFieldAttrPane(); - fieldListPane = new VanChartFieldListPane(tableFieldsFormat, fieldAttrPane, richEditor); + this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH); } private JPanel createFieldContentPane() { @@ -73,12 +59,12 @@ public class VanChartRichTextPane extends BasicBeanPane { return fieldPane; } - private JPanel createRichEditorPane() { + private JPanel createRichEditorPane(JPanel richEditor) { JPanel richEditorPane = new JPanel(); richEditorPane.setLayout(new BorderLayout()); richEditorPane.setPreferredSize(new Dimension(RICH_EDITOR_W, RICH_EDITOR_H)); - richEditorPane.add(this.richEditor, BorderLayout.CENTER); + richEditorPane.add(richEditor, BorderLayout.CENTER); return richEditorPane; } From 04756947ee2cbdad4cf8daf7afd883f261e6d576 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Tue, 29 Dec 2020 09:56:19 +0800 Subject: [PATCH 035/147] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 12 ++--- .../designer/style/VanChartStylePane.java | 54 +++++++++++++++++++ 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 89a627518..b9472dd86 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -49,7 +49,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.ArrayList; import java.util.List; /** @@ -475,14 +474,11 @@ public class VanChartTooltipContentPane extends BasicBeanPane getTableFieldNames() { - List fieldNames = new ArrayList<>(); - - fieldNames.add("字段A"); - fieldNames.add("字段B"); - fieldNames.add("字段C"); - fieldNames.add("字段D"); + if (parent == null) { + return null; + } - return fieldNames; + return parent.getDataModelColumnNames(); } private JPanel createHtmlPane() { 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 32a4f8e54..f9d0720dc 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 @@ -1,9 +1,20 @@ package com.fr.van.chart.designer.style; +import com.fr.base.TableData; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; 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.design.DesignModelAdapter; +import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.van.chart.designer.style.axis.VanChartAxisPane; import com.fr.van.chart.designer.style.background.VanChartAreaPane; @@ -75,4 +86,47 @@ public class VanChartStylePane extends ChartStylePane { protected void addVanChartTooltipPane(List paneList) { paneList.add(new VanChartTooltipPane(VanChartStylePane.this)); } + + public List getDataModelColumnNames() { + Chart chart = getChart(); + + if (chart == null) { + return null; + } + + TopDefinitionProvider definition = chart.getFilterDefinition(); + + if (definition == null) { + return null; + } + + DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); + TableDataSource tableDataSource = adapter == null ? null : adapter.getBook(); + + TableData tableData = null; + + if (ComparatorUtils.equals(definition.getDataDefinitionType(), OneValueCDDefinition.DEFINITION_TYPE)) { + OneValueCDDefinition oneValueCDDefinition = (OneValueCDDefinition) definition; + tableData = oneValueCDDefinition.getTableData(); + } + + if (ComparatorUtils.equals(definition.getDataDefinitionType(), MoreNameCDDefinition.DEFINITION_TYPE)) { + MoreNameCDDefinition moreNameCDDefinition = (MoreNameCDDefinition) definition; + tableData = moreNameCDDefinition.getTableData(); + } + + if (tableData == null) { + return null; + } + + try { + EmbeddedTableData embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataSource, + tableData, TableData.RESULT_NOT_NEED, false); + + return DesignTableDataManager.getColumnNamesByTableData(embeddedTableData); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return null; + } + } } \ No newline at end of file From f6c353ae7f023b19f0fa2661358a4d49dd2a5afa Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Tue, 29 Dec 2020 11:22:22 +0800 Subject: [PATCH 036/147] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../richText/VanChartFieldButton.java | 3 +- .../richText/VanChartFieldListPane.java | 60 ++++++++++++++++--- 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java index a3ccc2a47..4e75b9feb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java @@ -2,6 +2,7 @@ package com.fr.van.chart.designer.component.richText; import com.fr.base.BaseUtils; import com.fr.data.util.function.DataFunction; +import com.fr.data.util.function.NoneFunction; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.layout.TableLayout; @@ -36,7 +37,7 @@ public class VanChartFieldButton extends JPanel { private UIToggleButton fieldButton; private UIButton addButton; - private DataFunction dataFunction; + private DataFunction dataFunction = new NoneFunction(); public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, VanChartFieldListener listener) { this.fieldName = fieldName; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index f7fb81d0c..e88937a6a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -1,12 +1,17 @@ package com.fr.van.chart.designer.component.richText; import com.fr.data.util.function.AbstractDataFunction; +import com.fr.data.util.function.DataFunction; import com.fr.design.event.UIObserverListener; import com.fr.design.i18n.Toolkit; import com.fr.design.ui.ModernUIPane; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.TableFieldCollection; +import com.fr.plugin.chart.base.TableFieldDefinition; import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFieldFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; @@ -23,6 +28,7 @@ import java.awt.event.ActionListener; import java.text.Format; import java.util.ArrayList; import java.util.List; +import java.util.Map; public class VanChartFieldListPane extends JPanel { @@ -38,13 +44,14 @@ public class VanChartFieldListPane extends JPanel { private ModernUIPane richEditorPane; private List tableFieldNameList; private List tableFieldButtonList = new ArrayList<>(); + private TableFieldCollection tableFieldCollection = new TableFieldCollection(); private VanChartFieldListener fieldListener; public VanChartFieldListPane(List tableFieldNameList, VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { - this.tableFieldNameList = tableFieldNameList; + this.tableFieldNameList = tableFieldNameList == null ? new ArrayList<>() : tableFieldNameList; this.fieldAttrPane = fieldAttrPane; this.richEditorPane = richEditorPane; @@ -104,7 +111,7 @@ public class VanChartFieldListPane extends JPanel { tableField.setLayout(new GridLayout(0, 1, 1, 0)); for (String name : tableFieldNameList) { - VanChartFieldButton fieldButton = new VanChartFieldButton(name, getTableTooltipFormat(name), true, fieldListener); + VanChartFieldButton fieldButton = new VanChartFieldButton(name, new AttrTooltipFieldFormat(name), true, fieldListener); tableField.add(fieldButton); tableFieldButtonList.add(fieldButton); @@ -115,11 +122,6 @@ public class VanChartFieldListPane extends JPanel { return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); } - // 生成新增字段对应的format - private AttrTooltipFormat getTableTooltipFormat(String fieldName) { - return new AttrTooltipCategoryFormat(); - } - protected List getDefaultFieldButtonList() { List defaultFieldButtonList = new ArrayList<>(); @@ -180,6 +182,16 @@ public class VanChartFieldListPane extends JPanel { } public void addSelectedField(String fieldName, String fieldId) { + if (tableFieldNameList.contains(fieldName)) { + int index = tableFieldNameList.indexOf(fieldName); + + VanChartFieldButton fieldButton = tableFieldButtonList.get(index); + Format fieldFormat = fieldButton.getFormat(); + DataFunction dataFunction = fieldButton.getDataFunction(); + + tableFieldCollection.addFieldDefinition(fieldName, new TableFieldDefinition(fieldName, fieldFormat, dataFunction)); + } + VanChartRichEditorModel model = richEditorPane.update(); model.setAddition(fieldName); VanChartRichEditorPane.richEditorAddField(model); @@ -264,7 +276,35 @@ public class VanChartFieldListPane extends JPanel { } public void populateTableField(AttrTooltipContent tooltipContent) { + TableFieldCollection fieldCollection = tooltipContent.getFieldCollection(); + if (fieldCollection == null) { + return; + } + + Map fieldDefinitionGroup = fieldCollection.getFieldNameFormulaMap(); + + if (fieldDefinitionGroup == null || fieldDefinitionGroup.isEmpty()) { + return; + } + + this.tableFieldCollection = new TableFieldCollection(); + + for (int i = 0, len = tableFieldNameList.size(); i < len; i++) { + String fieldName = tableFieldNameList.get(i); + VanChartFieldButton fieldButton = tableFieldButtonList.get(i); + TableFieldDefinition fieldDefinition = fieldDefinitionGroup.get(fieldName); + + if (fieldDefinitionGroup.containsKey(fieldName)) { + Format fieldFormat = fieldDefinition.getFormat(); + DataFunction dataFunction = fieldDefinition.getDataFunction(); + + fieldButton.setFormat(fieldFormat); + fieldButton.setDataFunction(dataFunction); + + this.tableFieldCollection.addFieldDefinition(fieldName, new TableFieldDefinition(fieldName, fieldFormat, dataFunction)); + } + } } public void update(AttrTooltipContent tooltipContent) { @@ -280,7 +320,11 @@ public class VanChartFieldListPane extends JPanel { } public void updateTableField(AttrTooltipContent tooltipContent) { - + try { + tooltipContent.setFieldCollection(this.tableFieldCollection); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } } public void updateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) { From d798bd90480f43a88465b8795660cddf30c10a79 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Tue, 29 Dec 2020 13:55:09 +0800 Subject: [PATCH 037/147] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=AF=8C=E6=96=87=E6=9C=AC=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 13 +++++++++---- .../component/richText/VanChartFieldListPane.java | 15 +++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index b9472dd86..ba6a55cb8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -15,6 +15,7 @@ import com.fr.design.ui.ModernUIPane; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipRichText; +import com.fr.plugin.chart.base.TableFieldCollection; import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -449,15 +450,19 @@ public class VanChartTooltipContentPane extends BasicBeanPane Date: Tue, 29 Dec 2020 17:00:14 +0800 Subject: [PATCH 038/147] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=8F=82=E6=95=B0=E6=9B=B4=E6=96=B0=E7=9A=84=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 56 ++++++++++++++++--- .../richText/VanChartFieldButton.java | 4 ++ .../richText/VanChartFieldListPane.java | 20 +++++++ .../richText/VanChartRichTextPane.java | 7 ++- 4 files changed, 78 insertions(+), 9 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index ba6a55cb8..66f04a3d3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -16,7 +16,11 @@ import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.TableFieldCollection; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +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.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; @@ -50,7 +54,9 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 数据点提示内容界面,含有通用设置、富文本编辑器、自定义JS界面 @@ -436,15 +442,14 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - VanChartRichTextPane richTextPane = new VanChartRichTextPane(getTableFieldNames(), richEditorPane); + VanChartRichTextPane richTextPane = this.createRichTextPane(getTableFieldNames(), richEditorPane); + BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); - // 更新字段格式和汇总方式 richTextPane.populateBean(this.richTextTooltipContent); - // 更新富文本编辑器内容 richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); richTextDialog.addDialogActionListener(new DialogActionAdapter() { @@ -486,6 +491,42 @@ public class VanChartTooltipContentPane extends BasicBeanPane tableFieldNames, ModernUIPane richEditorPane) { + return new VanChartRichTextPane(tableFieldNames, richEditorPane); + } + + protected void refreshRichTextFormat(AttrTooltipRichText richText) { + String[] fieldNames = new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + + AttrTooltipFormat[] fieldFormats = new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; + + Map params = new HashMap<>(); + + for (int i = 0, len = fieldNames.length; i < len; i++) { + params.put(fieldNames[i], fieldFormats[i].getJs()); + } + + List tableFieldNames = this.getTableFieldNames(); + + if (tableFieldNames != null) { + for (String fieldName : tableFieldNames) { + params.put(fieldName, fieldName); + } + } + + richText.setParams(params); + } + private JPanel createHtmlPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -734,11 +775,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane { public VanChartRichTextPane(List tableFieldNames, ModernUIPane richEditor) { fieldAttrPane = new VanChartFieldAttrPane(); - fieldListPane = new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + fieldListPane = createFieldListPane(tableFieldNames, fieldAttrPane, richEditor); this.setLayout(new BorderLayout()); this.add(createFieldContentPane(), BorderLayout.CENTER); @@ -59,6 +59,11 @@ public class VanChartRichTextPane extends BasicBeanPane { return fieldPane; } + protected VanChartFieldListPane createFieldListPane(List tableFieldNames, VanChartFieldAttrPane fieldAttrPane, + ModernUIPane richEditor) { + return new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + } + private JPanel createRichEditorPane(JPanel richEditor) { JPanel richEditorPane = new JPanel(); From 18b843beb522834f76515c53cf151748875db5aa Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 31 Dec 2020 11:36:49 +0800 Subject: [PATCH 039/147] =?UTF-8?q?=E6=97=A0=E4=BB=BB=E5=8A=A1=20=E8=A7=A3?= =?UTF-8?q?=E5=86=B3WidgetBoundsPaneFactory=E6=96=87=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d91f89b89..9b6e7b5c8 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 @@ -28,7 +28,7 @@ public class WidgetBoundsPaneFactory { private String positionName; private String sizeName; - + NameAttribute(String positionName, String sizeName) { this.positionName = positionName; this.sizeName = sizeName; From 9fa14e369f1c787ba5ceeba4c96bbace54e7d5ef Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 31 Dec 2020 15:56:38 +0800 Subject: [PATCH 040/147] =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5=E5=90=8D?= =?UTF-8?q?=E7=9A=84=E7=B1=BB=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChartOtherPane.java | 8 ++- .../component/VanChartTooltipContentPane.java | 44 +++----------- .../richText/VanChartFieldListPane.java | 7 ++- .../richText/VanChartRichEditorPane.java | 60 +++++++++++++++++++ .../richText/VanChartRichTextPane.java | 11 ++-- .../designer/style/VanChartStylePane.java | 55 +---------------- 6 files changed, 85 insertions(+), 100 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java index 9b494a1a4..54c010119 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java @@ -13,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.other.ChartConditionAttrPane; import com.fr.design.mainframe.chart.gui.other.ChartInteractivePane; import com.fr.design.mainframe.chart.gui.type.ChartTabPane; import com.fr.design.mainframe.chart.info.ChartInfoCollector; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import javax.swing.JPanel; import java.util.ArrayList; @@ -76,11 +77,11 @@ public class ChartOtherPane extends AbstractChartAttrPane { public String title4PopupWindow() { return PaneTitleConstants.CHART_OTHER_TITLE; } - + private boolean isHaveCondition() { return hasCondition; } - + /** * 设置选中的界面id */ @@ -110,6 +111,7 @@ public class ChartOtherPane extends AbstractChartAttrPane { public void populateBean(Chart chart) { interactivePane.populateBean(chart); if (ChartOtherPane.this.isHaveCondition()) { + VanChartRichEditorPane.refreshFieldNames(chart); conditionAttrPane.populateBean(chart); } } @@ -126,7 +128,7 @@ public class ChartOtherPane extends AbstractChartAttrPane { //特效埋点 ChartInfoCollector.getInstance().updateChartConfig(chart, ConfigType.EFFECT, chart.getBuryingPointEffectConfig()); } - + /** * 注册 切换按钮的切换事件. * @param currentChartEditPane 当前编辑的图表编辑界面. diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 66f04a3d3..544bd3825 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -36,7 +36,6 @@ import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutChe import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import com.fr.van.chart.designer.component.richText.VanChartRichTextDialog; @@ -445,7 +444,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - VanChartRichTextPane richTextPane = this.createRichTextPane(getTableFieldNames(), richEditorPane); + VanChartRichTextPane richTextPane = this.createRichTextPane(richEditorPane); BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); @@ -483,19 +482,11 @@ public class VanChartTooltipContentPane extends BasicBeanPane getTableFieldNames() { - if (parent == null) { - return null; - } - - return parent.getDataModelColumnNames(); - } - - protected VanChartRichTextPane createRichTextPane(List tableFieldNames, ModernUIPane richEditorPane) { - return new VanChartRichTextPane(tableFieldNames, richEditorPane); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + return new VanChartRichTextPane(richEditorPane); } - protected void refreshRichTextFormat(AttrTooltipRichText richText) { + protected void refreshRichTextParams(AttrTooltipRichText richText) { String[] fieldNames = new String[]{ Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), Toolkit.i18nText("Fine-Design_Chart_Series_Name"), @@ -516,7 +507,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane tableFieldNames = this.getTableFieldNames(); + List tableFieldNames = VanChartRichEditorPane.getFieldNames(); if (tableFieldNames != null) { for (String fieldName : tableFieldNames) { @@ -757,30 +748,13 @@ public class VanChartTooltipContentPane extends BasicBeanPane tableFieldNameList, VanChartFieldAttrPane fieldAttrPane, - ModernUIPane richEditorPane) { + public VanChartFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { - this.tableFieldNameList = tableFieldNameList == null ? new ArrayList<>() : tableFieldNameList; + List richEditorFieldNames = VanChartRichEditorPane.getFieldNames(); + + this.tableFieldNameList = richEditorFieldNames == null ? new ArrayList<>() : richEditorFieldNames; this.fieldAttrPane = fieldAttrPane; this.richEditorPane = richEditorPane; 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 87710da55..dcec83deb 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 @@ -1,8 +1,19 @@ package com.fr.van.chart.designer.component.richText; +import com.fr.base.TableData; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; +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.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.type.TextAlign; import com.fr.stable.StringUtils; @@ -11,6 +22,7 @@ import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; +import java.util.List; import java.util.Locale; import java.util.Map; @@ -26,6 +38,54 @@ public class VanChartRichEditorPane { private static ModernUIPane richEditorPane; private static Browser browser; + private static List fieldNames; + + public static List getFieldNames() { + return fieldNames; + } + + public static void refreshFieldNames(Chart chart) { + VanChartRichEditorPane.fieldNames = null; + + if (chart == null) { + return; + } + + TopDefinitionProvider definition = chart.getFilterDefinition(); + + if (definition == null) { + return; + } + + DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); + TableDataSource tableDataSource = adapter == null ? null : adapter.getBook(); + + TableData tableData = null; + + if (ComparatorUtils.equals(definition.getDataDefinitionType(), OneValueCDDefinition.DEFINITION_TYPE)) { + OneValueCDDefinition oneValueCDDefinition = (OneValueCDDefinition) definition; + tableData = oneValueCDDefinition.getTableData(); + } + + if (ComparatorUtils.equals(definition.getDataDefinitionType(), MoreNameCDDefinition.DEFINITION_TYPE)) { + MoreNameCDDefinition moreNameCDDefinition = (MoreNameCDDefinition) definition; + tableData = moreNameCDDefinition.getTableData(); + } + + if (tableData == null) { + 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); + } + } public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { VanChartRichEditorModel model = getRichEditorModel(richEditor); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java index 83ef4853e..93fb9048a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -11,7 +11,6 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import java.awt.BorderLayout; import java.awt.Dimension; -import java.util.List; // 标签提示中的富文本面板,包含字段设置和富文本编辑器 public class VanChartRichTextPane extends BasicBeanPane { @@ -25,10 +24,9 @@ public class VanChartRichTextPane extends BasicBeanPane { private VanChartFieldListPane fieldListPane; private VanChartFieldAttrPane fieldAttrPane; - public VanChartRichTextPane(List tableFieldNames, ModernUIPane richEditor) { - + public VanChartRichTextPane(ModernUIPane richEditor) { fieldAttrPane = new VanChartFieldAttrPane(); - fieldListPane = createFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + fieldListPane = createFieldListPane(fieldAttrPane, richEditor); this.setLayout(new BorderLayout()); this.add(createFieldContentPane(), BorderLayout.CENTER); @@ -59,9 +57,8 @@ public class VanChartRichTextPane extends BasicBeanPane { return fieldPane; } - protected VanChartFieldListPane createFieldListPane(List tableFieldNames, VanChartFieldAttrPane fieldAttrPane, - ModernUIPane richEditor) { - return new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartFieldListPane(fieldAttrPane, richEditor); } private JPanel createRichEditorPane(JPanel richEditor) { 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 f9d0720dc..bb8df99fd 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 @@ -1,21 +1,11 @@ package com.fr.van.chart.designer.style; -import com.fr.base.TableData; -import com.fr.base.chart.chartdata.TopDefinitionProvider; -import com.fr.chart.chartattr.Chart; 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.design.DesignModelAdapter; -import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartStylePane; -import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import com.fr.van.chart.designer.style.axis.VanChartAxisPane; import com.fr.van.chart.designer.style.background.VanChartAreaPane; import com.fr.van.chart.designer.style.datasheet.VanChartDataSheetPane; @@ -87,46 +77,7 @@ public class VanChartStylePane extends ChartStylePane { paneList.add(new VanChartTooltipPane(VanChartStylePane.this)); } - public List getDataModelColumnNames() { - Chart chart = getChart(); - - if (chart == null) { - return null; - } - - TopDefinitionProvider definition = chart.getFilterDefinition(); - - if (definition == null) { - return null; - } - - DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); - TableDataSource tableDataSource = adapter == null ? null : adapter.getBook(); - - TableData tableData = null; - - if (ComparatorUtils.equals(definition.getDataDefinitionType(), OneValueCDDefinition.DEFINITION_TYPE)) { - OneValueCDDefinition oneValueCDDefinition = (OneValueCDDefinition) definition; - tableData = oneValueCDDefinition.getTableData(); - } - - if (ComparatorUtils.equals(definition.getDataDefinitionType(), MoreNameCDDefinition.DEFINITION_TYPE)) { - MoreNameCDDefinition moreNameCDDefinition = (MoreNameCDDefinition) definition; - tableData = moreNameCDDefinition.getTableData(); - } - - if (tableData == null) { - return null; - } - - try { - EmbeddedTableData embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataSource, - tableData, TableData.RESULT_NOT_NEED, false); - - return DesignTableDataManager.getColumnNamesByTableData(embeddedTableData); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - return null; - } + public void refreshTableFieldNames() { + VanChartRichEditorPane.refreshFieldNames(getChart()); } } \ No newline at end of file From 51f08486e5d967821a76a247dc6648f1770c0f6b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 3 Jan 2021 22:15:28 +0800 Subject: [PATCH 041/147] =?UTF-8?q?=E6=95=A3=E7=82=B9=E5=9B=BE=E5=AF=8C?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 28 ++++- .../richText/VanChartFieldListPane.java | 16 +++ .../richText/VanChartRichTextPane.java | 10 +- ...ChartScatterRefreshTooltipContentPane.java | 9 +- .../VanChartScatterRichTextFieldListPane.java | 93 ++++++++++++++ .../VanChartScatterTooltipContentPane.java | 114 ++++++++---------- 6 files changed, 189 insertions(+), 81 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 544bd3825..0698a3291 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -115,9 +115,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane params = new HashMap<>(); @@ -874,6 +888,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane { this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH); } + public VanChartFieldListPane getFieldListPane() { + return fieldListPane; + } + private JPanel createFieldContentPane() { JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); @@ -71,12 +75,16 @@ public class VanChartRichTextPane extends BasicBeanPane { return richEditorPane; } + protected AttrTooltipContent getInitialTooltipContent() { + return new AttrTooltipContent(); + } + public void populateBean(AttrTooltipContent tooltipContent) { fieldListPane.populate(tooltipContent); } public AttrTooltipContent updateBean() { - AttrTooltipContent content = new AttrTooltipContent(); + AttrTooltipContent content = getInitialTooltipContent(); fieldListPane.update(content); return content; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java index db7ce4152..e5416b1c2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java @@ -62,14 +62,7 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo @Override protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextXFormatPane(), null}, - new Component[]{getRichTextYFormatPane(), null}, - new Component[]{getRichTextSizeFormatPane(), null}, - new Component[]{richTextChangedSizeFormatPane, null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; + return null; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java new file mode 100644 index 000000000..776d5397d --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java @@ -0,0 +1,93 @@ +package com.fr.van.chart.scatter; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipSizeFormat; +import com.fr.plugin.chart.base.format.AttrTooltipXFormat; +import com.fr.plugin.chart.base.format.AttrTooltipYFormat; +import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; + +public class VanChartScatterRichTextFieldListPane extends VanChartFieldListPane { + + private VanChartFieldButton richTextXFormatPane; + private VanChartFieldButton richTextYFormatPane; + private VanChartFieldButton richTextSizeFormatPane; + + public VanChartScatterRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + public VanChartFieldButton getRichTextXFormatPane() { + return richTextXFormatPane; + } + + public VanChartFieldButton getRichTextYFormatPane() { + return richTextYFormatPane; + } + + public VanChartFieldButton getRichTextSizeFormatPane() { + return richTextSizeFormatPane; + } + + protected void initDefaultFieldButton() { + super.initDefaultFieldButton(); + + VanChartFieldListener listener = getFieldListener(); + + richTextXFormatPane = new VanChartFieldButton("x", new AttrTooltipXFormat(), false, listener); + richTextYFormatPane = new VanChartFieldButton("y", new AttrTooltipYFormat(), false, listener); + richTextSizeFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), new AttrTooltipSizeFormat(), false, listener); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getSeriesNameButton()); + fieldPane.add(richTextXFormatPane); + fieldPane.add(richTextYFormatPane); + fieldPane.add(richTextSizeFormatPane); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(richTextXFormatPane); + fieldButtonList.add(richTextYFormatPane); + fieldButtonList.add(richTextSizeFormatPane); + + return fieldButtonList; + } + + public void populateDefaultField(AttrTooltipContent tooltipContent) { + super.populateDefaultField(tooltipContent); + + if (tooltipContent instanceof ScatterAttrTooltipContent) { + ScatterAttrTooltipContent scatter = (ScatterAttrTooltipContent) tooltipContent; + + populateButtonFormat(richTextXFormatPane, scatter.getRichTextXFormat()); + populateButtonFormat(richTextYFormatPane, scatter.getRichTextYFormat()); + populateButtonFormat(richTextSizeFormatPane, scatter.getRichTextSizeFormat()); + } + } + + public void updateDefaultField(AttrTooltipContent tooltipContent) { + super.updateDefaultField(tooltipContent); + + if (tooltipContent instanceof ScatterAttrTooltipContent) { + ScatterAttrTooltipContent scatter = (ScatterAttrTooltipContent) tooltipContent; + + updateButtonFormat(richTextXFormatPane, scatter.getRichTextXFormat()); + updateButtonFormat(richTextYFormatPane, scatter.getRichTextYFormat()); + updateButtonFormat(richTextSizeFormatPane, scatter.getRichTextSizeFormat()); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java index 39b20bedb..8e33bd5e2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java @@ -1,17 +1,22 @@ package com.fr.van.chart.scatter; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSizeFormat; +import com.fr.plugin.chart.base.format.AttrTooltipXFormat; +import com.fr.plugin.chart.base.format.AttrTooltipYFormat; import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.XFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.XFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.YFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.YFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -26,10 +31,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa private YFormatPaneWithCheckBox yFormatPane; private ValueFormatPaneWithCheckBox sizeFormatPane; - private XFormatPaneWithoutCheckBox richTextXFormatPane; - private YFormatPaneWithoutCheckBox richTextYFormatPane; - private ValueFormatPaneWithoutCheckBox richTextSizeFormatPane; - public XFormatPaneWithCheckBox getXFormatPane() { return xFormatPane; } @@ -42,18 +43,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa return sizeFormatPane; } - public XFormatPaneWithoutCheckBox getRichTextXFormatPane() { - return richTextXFormatPane; - } - - public YFormatPaneWithoutCheckBox getRichTextYFormatPane() { - return richTextYFormatPane; - } - - public ValueFormatPaneWithoutCheckBox getRichTextSizeFormatPane() { - return richTextSizeFormatPane; - } - public VanChartScatterTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){ super(parent, showOnPane); } @@ -71,13 +60,22 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa sizeFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); + protected void initRichTextTooltipContent() { + setRichTextTooltipContent(new ScatterAttrTooltipContent()); + } + + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartScatterRichTextFieldListPane(fieldAttrPane, richEditor); + } - richTextXFormatPane = new XFormatPaneWithoutCheckBox(parent, showOnPane); - richTextYFormatPane = new YFormatPaneWithoutCheckBox(parent, showOnPane); - richTextSizeFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); + protected AttrTooltipContent getInitialTooltipContent() { + return new ScatterAttrTooltipContent(); + } + }; } @Override @@ -90,16 +88,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa }; } - @Override - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{richTextXFormatPane, null}, - new Component[]{richTextYFormatPane, null}, - new Component[]{richTextSizeFormatPane, null} - }; - } - @Override protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { super.populateFormatPane(attrTooltipContent); @@ -111,30 +99,20 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa } } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - if (attrTooltipContent instanceof ScatterAttrTooltipContent) { - ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + "x", + "y", + Toolkit.i18nText("Fine-Design_Chart_Use_Value")}; + } - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextSeriesNameFormatPane(), - richTextXFormatPane, - richTextYFormatPane, - richTextSizeFormatPane - }; - - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - scatterAttrTooltipContent.getRichTextSeriesFormat(), - scatterAttrTooltipContent.getRichTextXFormat(), - scatterAttrTooltipContent.getRichTextYFormat(), - scatterAttrTooltipContent.getRichTextSizeFormat() - }; - - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); - - checkRichEditorState(attrTooltipContent); - } + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipSeriesFormat(), + new AttrTooltipXFormat(), + new AttrTooltipYFormat(), + new AttrTooltipSizeFormat()}; } @Override @@ -148,14 +126,16 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa } } - protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { - super.updateRichEditor(attrTooltipContent); + protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) { + super.updateTooltipFormat(target, source); - if (attrTooltipContent instanceof ScatterAttrTooltipContent) { - ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; - richTextXFormatPane.update(scatterAttrTooltipContent.getRichTextXFormat()); - richTextYFormatPane.update(scatterAttrTooltipContent.getRichTextYFormat()); - richTextSizeFormatPane.update(scatterAttrTooltipContent.getRichTextSizeFormat()); + if (target instanceof ScatterAttrTooltipContent && source instanceof ScatterAttrTooltipContent) { + ScatterAttrTooltipContent targetScatter = (ScatterAttrTooltipContent) target; + ScatterAttrTooltipContent sourceScatter = (ScatterAttrTooltipContent) source; + + targetScatter.setRichTextXFormat(sourceScatter.getRichTextXFormat()); + targetScatter.setRichTextYFormat(sourceScatter.getRichTextYFormat()); + targetScatter.setRichTextSizeFormat(sourceScatter.getRichTextSizeFormat()); } } From 8de94cf98e94527d828b514f6323235c7621de25 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 3 Jan 2021 23:05:11 +0800 Subject: [PATCH 042/147] =?UTF-8?q?=E8=AF=8D=E4=BA=91=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 7 +--- .../VanChartScatterTooltipContentPane.java | 6 +-- ...anChartWordCloudRichTextFieldListPane.java | 41 +++++++++++++++++++ .../VanChartWordCloudTooltipContentPane.java | 37 ++++++----------- 4 files changed, 57 insertions(+), 34 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 0698a3291..f2c566230 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -115,8 +115,9 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane) { return new VanChartRichTextPane(richEditorPane) { @@ -73,7 +69,7 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa } protected AttrTooltipContent getInitialTooltipContent() { - return new ScatterAttrTooltipContent(); + return createAttrTooltip(); } }; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java new file mode 100644 index 000000000..3394e6f05 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java @@ -0,0 +1,41 @@ +package com.fr.van.chart.wordcloud.designer.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +public class VanChartWordCloudRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartWordCloudRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener fieldListener = getFieldListener(); + + VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + new AttrTooltipCategoryFormat(), false, fieldListener); + + VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Word_Name"), + new AttrTooltipNameFormat(), false, fieldListener); + + VanChartFieldButton valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Word_Value"), + new AttrTooltipValueFormat(), false, fieldListener); + + VanChartFieldButton percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); + + setCategoryNameButton(categoryNameButton); + setSeriesNameButton(seriesNameButton); + setValueButton(valueButton); + setPercentButton(percentButton); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java index c0e9ac6c3..99b437861 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java @@ -2,17 +2,18 @@ package com.fr.van.chart.wordcloud.designer.style; import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -53,31 +54,19 @@ public class VanChartWordCloudTooltipContentPane extends VanChartTooltipContentP setPercentFormatPane(percentFormatPane); } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); - } - }; - SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Word_Name"); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartWordCloudRichTextFieldListPane(fieldAttrPane, richEditor); } - }; - ValueFormatPaneWithoutCheckBox richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Word_Value"); + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); } }; - PercentFormatPaneWithoutCheckBox richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane); - - setRichTextCategoryNameFormatPane(richTextCategoryNameFormatPane); - setRichTextSeriesNameFormatPane(richTextSeriesNameFormatPane); - setRichTextValueFormatPane(richTextValueFormatPane); - setRichTextPercentFormatPane(richTextPercentFormatPane); } - @Override protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat()); From 3c514adfb8287c229bc6028db3b1165cf60f3338 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 4 Jan 2021 16:04:46 +0800 Subject: [PATCH 043/147] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=AF=8D=E4=BA=91?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=AF=8C=E6=96=87=E6=9C=AC=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VanChartWordCloudTooltipContentPane.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java index 99b437861..0abd60ac1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java @@ -4,7 +4,11 @@ package com.fr.van.chart.wordcloud.designer.style; import com.fr.design.i18n.Toolkit; import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; @@ -67,6 +71,24 @@ public class VanChartWordCloudTooltipContentPane extends VanChartTooltipContentP }; } + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Word_Name"), + Toolkit.i18nText("Fine-Design_Chart_Word_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipNameFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; + } + protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat()); From 97517d0b073588207e3c7da4170a34c0ac86836a Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 4 Jan 2021 16:33:58 +0800 Subject: [PATCH 044/147] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E9=9D=A2=E6=9D=BF=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VanChartMapRichTextFieldListPane.java | 41 +++++++++++++++++++ .../label/VanChartMapLabelContentPane.java | 32 ++++++++++----- .../VanChartMapTooltipContentPane.java | 31 +++++++++----- 3 files changed, 84 insertions(+), 20 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java new file mode 100644 index 000000000..91e1817ef --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java @@ -0,0 +1,41 @@ +package com.fr.van.chart.map.designer.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; +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.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +public class VanChartMapRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartMapRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener fieldListener = getFieldListener(); + + VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Area_Name"), + new AttrTooltipAreaNameFormat(), false, fieldListener); + + VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + new AttrTooltipSeriesFormat(), false, fieldListener); + + VanChartFieldButton valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + new AttrTooltipValueFormat(), false, fieldListener); + + VanChartFieldButton percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); + + setCategoryNameButton(categoryNameButton); + setSeriesNameButton(seriesNameButton); + setValueButton(valueButton); + setPercentButton(percentButton); + } +} 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 084953c99..baec70ca9 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,18 +1,19 @@ package com.fr.van.chart.map.designer.style.label; +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat; +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.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -21,6 +22,7 @@ import javax.swing.JPanel; * Created by Mitisky on 16/5/20. */ public class VanChartMapLabelContentPane extends VanChartLabelContentPane { + public VanChartMapLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) { super(parent, showOnPane, inCondition); } @@ -33,12 +35,22 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new MapAreaNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipAreaNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java index 12948b14d..03f720bf7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java @@ -1,17 +1,18 @@ package com.fr.van.chart.map.designer.style.tooltip; +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat; +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.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -32,12 +33,22 @@ public class VanChartMapTooltipContentPane extends VanChartTooltipContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new MapAreaNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipAreaNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } @Override From b141d258f61e12dc131966920cf1952ffac53a82 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 5 Jan 2021 19:58:01 +0800 Subject: [PATCH 045/147] =?UTF-8?q?REPORT-44410=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E6=95=B0=E6=8D=AE=E9=9B=86=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=8D=A1=E9=A1=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignModelAdapter.java | 86 ++++++++++++++++++- .../data/datapane/TableDataTreePane.java | 4 +- .../fr/design/mainframe/FormModelAdapter.java | 23 ++++- .../mainframe/WorkBookModelAdapter.java | 35 +++++++- 4 files changed, 143 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java index 24dd31484..02396cd5c 100644 --- a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java @@ -1,8 +1,11 @@ package com.fr.design; import com.fr.base.Parameter; +import com.fr.base.ParameterConfig; +import com.fr.base.TableData; import com.fr.base.io.BaseBook; import com.fr.data.TableDataSource; +import com.fr.data.operator.DataOperator; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; @@ -11,9 +14,14 @@ import com.fr.form.ui.DataControl; import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.Filter; +import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; import com.fr.stable.js.WidgetName; +import com.fr.util.ParameterApplyHelper; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -40,7 +48,7 @@ public abstract class DesignModelAdapter tableDataParametersMap = new HashMap<>(); + + public DesignModelAdapter(S jTemplate) { this.jTemplate = jTemplate; @@ -241,6 +255,71 @@ public abstract class DesignModelAdapter map, Filter filter) { + Iterator it = this.getBook().getTableDataNameIterator(); + try { + // 清空下缓存 + tableDataParametersMap.clear(); + while (it.hasNext()) { + String name = it.next(); + TableData tableData = this.getBook().getTableData(name); + ParameterProvider[] parameterProviders = DataOperator.getInstance().getTableDataParameters(tableData); + if (filter != null) { + ParameterApplyHelper.addPara2Map(map, parameterProviders, filter); + } else { + ParameterApplyHelper.addPara2Map(map, parameterProviders); + } + tableDataParametersMap.put(name, parameterProviders); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + protected void updateTableDataParameters(String oldName, + String tdName, + TableData tableData, + Map map, + Filter filter) { + // 更新下缓存名称 替换下数据集名称 + ParameterProvider[] providers = tableDataParametersMap.remove(oldName); + if (providers != null) { + tableDataParametersMap.put(tdName, providers); + } + + try { + for (Map.Entry entry : tableDataParametersMap.entrySet()) { + ParameterProvider[] parameterProviders; + if (ComparatorUtils.equals(entry.getKey(), tdName)) { + parameterProviders = DataOperator.getInstance().getTableDataParameters(tableData); + // 用来更新缓存 + providers = parameterProviders; + } else { + parameterProviders = entry.getValue(); + } + + if (filter != null) { + ParameterApplyHelper.addPara2Map(map, parameterProviders, filter); + } else { + ParameterApplyHelper.addPara2Map(map, parameterProviders); + } + + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + + // 更新缓存 + tableDataParametersMap.put(tdName, providers); + } + + protected void addGlobalParameters(Map map) { + // 添加全局参数 + Parameter[] glbParas = ParameterConfig.getInstance().getGlobalParameters(); + ParameterApplyHelper.addPara2Map(map, glbParas); + + } + /** * 环境改变. */ @@ -251,6 +330,11 @@ public abstract class DesignModelAdapter> { @@ -42,6 +46,16 @@ public class FormModelAdapter extends DesignModelAdapter> jTemplate.populateParameter(); } + @Override + public void tableDataParametersChanged(String oldName, String tdName, TableData tableData) { + Map map = new HashMap<>(); + addGlobalParameters(map); + updateTableDataParameters(oldName, tdName, tableData, map, parameterProvider -> !EmbParaFilter.isFRLayerTypePara(parameterProvider)); + ParameterApplyHelper.addPara2Map(map, this.getBook().getTemplateParameters()); + parameters = map.values().toArray(new Parameter[0]); + jTemplate.populateParameter(); + } + /** * 控件配置改变. */ @@ -135,6 +149,13 @@ public class FormModelAdapter extends DesignModelAdapter> @Override protected Parameter[] getLatestParameters() { - return this.getBook().getParameters(); + Map map = new HashMap<>(); + addGlobalParameters(map); + + addTableDataParameters(map, parameterProvider -> !EmbParaFilter.isFRLayerTypePara(parameterProvider)); + + ParameterApplyHelper.addPara2Map(map, this.getBook().getTemplateParameters()); + + return map.values().toArray(new Parameter[0]); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java index 1a4f20c3d..87391a5a0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java @@ -18,9 +18,12 @@ import com.fr.stable.StringUtils; import com.fr.stable.bridge.StableFactory; import com.fr.stable.js.WidgetName; +import com.fr.util.ParameterApplyHelper; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; /** * @author zhou @@ -72,6 +75,18 @@ public class WorkBookModelAdapter extends DesignModelAdapter map = new HashMap<>(); + addGlobalParameters(map); + updateTableDataParameters(oldName, tdName, tableData, map, null); + addReportParameters(map); + parameters = map.values().toArray(new Parameter[0]); + jTemplate.updateReportParameterAttr(); + jTemplate.populateReportParameterAttr(); + + } + /** * 控件改变. */ @@ -107,9 +122,27 @@ public class WorkBookModelAdapter extends DesignModelAdapter map = new HashMap<>(); + addGlobalParameters(map); + + addTableDataParameters(map, null); + + addReportParameters(map); + + return map.values().toArray(new Parameter[0]); + } + + private void addReportParameters(Map map) { + // 添加模板参数 + ReportParameterAttr parameterAttr = this.getBook().getReportParameterAttr(); + if (parameterAttr != null) { + ParameterApplyHelper.addPara2Map(map, parameterAttr.getParameters()); + } } + + + /** * 返回控件的名字 * From 9f45188d6e89e48748e5686ec5d06bcc468de462 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 6 Jan 2021 09:24:34 +0800 Subject: [PATCH 046/147] =?UTF-8?q?REPORT-44410=20=E5=8A=A0=E4=B8=AA?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignModelAdapter.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java index 02396cd5c..e5930ee91 100644 --- a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java @@ -281,12 +281,18 @@ public abstract class DesignModelAdapter map, Filter filter) { - // 更新下缓存名称 替换下数据集名称 - ParameterProvider[] providers = tableDataParametersMap.remove(oldName); - if (providers != null) { - tableDataParametersMap.put(tdName, providers); + + ParameterProvider[] providers = null; + + if (!ComparatorUtils.equals(oldName, tdName)) { + // 更新下缓存名称 替换下数据集名称 + providers = tableDataParametersMap.remove(oldName); + if (providers != null) { + tableDataParametersMap.put(tdName, providers); + } } + try { for (Map.Entry entry : tableDataParametersMap.entrySet()) { ParameterProvider[] parameterProviders; @@ -309,8 +315,10 @@ public abstract class DesignModelAdapter map) { From 04007d7e046678c58bbfd9d5286f19d7788f260c Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 6 Jan 2021 11:33:39 +0800 Subject: [PATCH 047/147] =?UTF-8?q?REPORT-32210=20Tab=E5=9D=97=E6=8B=96?= =?UTF-8?q?=E5=8A=A8=E6=B7=BB=E5=8A=A0=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/beans/LayoutAdapter.java | 14 ++++++++++++- .../layout/AbstractLayoutAdapter.java | 21 +++++++++++++++++-- .../layout/FRTabFitLayoutAdapter.java | 6 +++--- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java index c087d78fe..b961aaee0 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java @@ -42,6 +42,18 @@ public interface LayoutAdapter { */ boolean addBean(XCreator creator, int x, int y); + /** + * 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 + * addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 + * + * @param creator 被添加的新组件 + * @param x 添加的位置x,该位置是相对于container的 + * @param y 添加的位置y,该位置是相对于container的 + * @param accept 是否添加新组件 + * @return 是否添加成功,成功返回true,否则false + */ + boolean addBean(XCreator creator, int x, int y, boolean accept); + /** * 返回该布局管理适配器的Painter,为容器提供放置位置的标识。 */ @@ -91,4 +103,4 @@ public interface LayoutAdapter { * @param initHeight 组件之前高度 */ void removeBean(XCreator creator, int initWidth, int initHeight); -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java index 493dd02aa..e9851a7e8 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java @@ -78,7 +78,23 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { */ @Override public boolean addBean(XCreator creator, int x, int y) { - if (!accept(creator, x, y)) { + boolean accept = accept(creator, x, y); + return addBean(creator, x, y, accept); + } + + /** + * 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 + * addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 + * + * @param creator 被添加的新组件 + * @param x 添加的位置x,该位置是相对于container的 + * @param y 添加的位置y,该位置是相对于container的 + * @param accept 是否添加新组件 + * @return 是否添加成功,成功返回true,否则false + */ + @Override + public boolean addBean(XCreator creator, int x, int y, boolean accept) { + if (!accept) { return false; } addComp(creator, x, y); @@ -86,6 +102,7 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { return true; } + /** * 删除组件 * @@ -186,4 +203,4 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { public XLayoutContainer getContainer() { return this.container; } -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java index d5a680b61..2b33159e8 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java @@ -18,7 +18,8 @@ import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.general.ComparatorUtils; import com.fr.general.act.BorderPacker; -import java.awt.*; +import java.awt.Rectangle; + /** * tab布局tabFit适配器 @@ -73,8 +74,7 @@ public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter { y = adjustY(y, tabLayout); } //这时候应该要用计算后的父fit布局添加 - this.container.getLayoutAdapter().addBean(creator, x, y); - ((XWidgetCreator) creator).recalculateChildrenSize(); + this.container.getLayoutAdapter().addBean(creator, x, y, true); return true; } // 如果不在边缘,容器为本自适应布局,增加组件的位置就是相对于容器的位置 From 1e0126bc7e770c1626ff77227731cc3c9b103136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Thu, 7 Jan 2021 10:28:54 +0800 Subject: [PATCH 048/147] =?UTF-8?q?CHART-15837=20=20=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=B1=87=E6=80=BB=E6=96=B9=E5=BC=8F=E6=8E=A7=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractCustomFieldComboBoxPane.java | 6 +- .../chart/gui/data/CalculateComboBox.java | 102 +++++++++--------- .../table/SeriesNameUseFieldNamePane.java | 2 +- 3 files changed, 57 insertions(+), 53 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java index 16f983c75..562393699 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java @@ -23,13 +23,13 @@ import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import java.util.ArrayList; +import java.util.List; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.ArrayList; -import java.util.List; /** * Created by shine on 2018/9/12. @@ -253,7 +253,7 @@ public abstract class AbstractCustomFieldComboBoxPane extends BasicBeanPane= 0 && selectIndex < CLASS_ARRAY.length) { - return (AbstractDataFunction)CLASS_ARRAY[selectIndex].newInstance(); - } - } catch (InstantiationException e) { - FineLoggerFactory.getLogger().error("Function Error"); - return null; - } catch (IllegalAccessException e) { - FineLoggerFactory.getLogger().error("Function Error"); - return null; - } - - return null; - } + public static final String[] CALCULATE_ARRAY = {Toolkit.i18nText("Fine-Design_Chart_Data_Function_First"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Last"), + Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Average"), + Toolkit.i18nText("Fine-Design_Chart_Data_Function_Max"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Min"), + Toolkit.i18nText("Fine-Design_Chart_Data_Function_Count")}; + public static final Class[] CLASS_ARRAY = {FirstFunction.class, NoneFunction.class, SumFunction.class, AverageFunction.class, + MaxFunction.class, MinFunction.class, CountFunction.class}; + + public CalculateComboBox() { + super(CALCULATE_ARRAY); + setSelectedIndex(2); + } + + public void reset() { + this.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum")); + } + + /** + * 更新公式选择. + */ + public void populateBean(AbstractDataFunction function) { + for (int i = 0; i < CLASS_ARRAY.length; i++) { + if (function != null && ComparatorUtils.equals(function.getClass(), CLASS_ARRAY[i])) { + setSelectedIndex(i); + break; + } + } + } + + /** + * 返回当前选择的公式 + */ + public AbstractDataFunction updateBean() { + try { + int selectIndex = getSelectedIndex(); + if (selectIndex >= 0 && selectIndex < CLASS_ARRAY.length) { + return (AbstractDataFunction) CLASS_ARRAY[selectIndex].newInstance(); + } + } catch (InstantiationException e) { + FineLoggerFactory.getLogger().error("Function Error"); + return null; + } catch (IllegalAccessException e) { + FineLoggerFactory.getLogger().error("Function Error"); + return null; + } + + return null; + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java index 3f5f70aae..9783c0577 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java @@ -70,7 +70,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane Date: Fri, 8 Jan 2021 17:42:19 +0800 Subject: [PATCH 049/147] =?UTF-8?q?REPORT-46779REPORT-46779=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E4=B8=BA=E8=B4=9F=E5=AF=BC=E8=87=B4=E5=89=8D=E7=AB=AF=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/icontainer/UIModeControlContainer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java index a589b0c87..73bfa0ef7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java @@ -166,6 +166,9 @@ public class UIModeControlContainer extends JLayeredPane { } // 拖动的距离,为正值表示往下拖动,为负值表示往上拖动 int deltaY = e.getY(); + if (toolPaneY < 0) { + toolPaneY = 0; + } toolPaneY += deltaY; onResize(toolPaneY); refreshContainer(); From 98b7590a589432807c0cc426b0eb1d51afeef7ea Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 11 Jan 2021 17:20:23 +0800 Subject: [PATCH 050/147] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E7=9A=84=E6=96=B9=E6=B3=95=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=90=88=E5=B9=B6=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/designer/beans/LayoutAdapter.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java index fded86cbe..e2aa7f152 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java @@ -43,18 +43,6 @@ public interface LayoutAdapter { boolean addBean(XCreator creator, int x, int y); - /** - * 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 - * addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 - * - * @param creator 被添加的新组件 - * @param x 添加的位置x,该位置是相对于container的 - * @param y 添加的位置y,该位置是相对于container的 - * @param accept 是否添加新组件 - * @return 是否添加成功,成功返回true,否则false - */ - boolean addBean(XCreator creator, int x, int y, boolean accept); - /** * 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 * addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 From 48bdcb79932b6961c53e890906742ea15e3c5bbf Mon Sep 17 00:00:00 2001 From: rinoux Date: Tue, 12 Jan 2021 14:47:09 +0800 Subject: [PATCH 051/147] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=AD=BE=E5=90=8D=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/designer/beans/LayoutAdapter.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java index fded86cbe..0a4416410 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java @@ -55,17 +55,6 @@ public interface LayoutAdapter { */ boolean addBean(XCreator creator, int x, int y, boolean accept); - /** - * 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 - * addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 - * - * @param creator 被添加的新组件 - * @param x 添加的位置x,该位置是相对于container的 - * @param y 添加的位置y,该位置是相对于container的 - * @param accept 是否添加新组件 - * @return 是否添加成功,成功返回true,否则false - */ - boolean addBean(XCreator creator, int x, int y, boolean accept); /** * 返回该布局管理适配器的Painter,为容器提供放置位置的标识。 From cc782b339261b3e5e37691e0e89947af7ba2b7da Mon Sep 17 00:00:00 2001 From: rinoux Date: Tue, 12 Jan 2021 17:51:00 +0800 Subject: [PATCH 052/147] =?UTF-8?q?REPORT-46915=20=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/DesignerStrategyConfigUtils.java | 154 ++++ .../data/datapane/ESDStrategyConfigPane.java | 225 +++++ .../data/datapane/TableDataTreePane.java | 768 ++++++++++++++---- .../tabledatapane/DBTableDataPane.java | 508 +++++++++--- .../design/images/control/batch_esd_off.png | Bin 0 -> 1286 bytes .../fr/design/images/control/batch_esd_on.png | Bin 0 -> 1275 bytes 6 files changed, 1364 insertions(+), 291 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java create mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/batch_esd_off.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/batch_esd_on.png diff --git a/designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java b/designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java new file mode 100644 index 000000000..8bc5f3644 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java @@ -0,0 +1,154 @@ +package com.fr.design.data; + +import com.fr.base.io.IOFile; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.JTemplate; +import com.fr.esd.core.strategy.config.StrategyConfig; +import com.fr.esd.core.strategy.config.StrategyConfigHelper; +import com.fr.esd.core.strategy.persistence.StrategyConfigsAttr; +import com.fr.esd.event.DSMapping; +import com.fr.esd.event.DsNameTarget; +import com.fr.esd.event.StrategyEventsNotifier; +import com.fr.esd.event.xml.XMLSavedHook; +import com.fr.file.FILE; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; +import com.fr.workspace.WorkContext; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * @author rinoux + * @version 10.0 + * Created by rinoux on 2020/10/28 + */ +public class DesignerStrategyConfigUtils { + + /** + * 获取当前编辑模版的数据集缓存配置属性 + * + * @return + */ + private static StrategyConfigsAttr getStrategyConfigsAttr() { + StrategyConfigsAttr attr; + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (jTemplate != null) { + IOFile ioFile = (IOFile) jTemplate.getTarget(); + + attr = ioFile.getAttrMark(StrategyConfigsAttr.ATTR_MARK); + if (attr == null) { + attr = new StrategyConfigsAttr(); + ioFile.addAttrMark(attr); + } + + //新建模版此时不存在,不需要注册钩子 + if (attr.getXmlSavedHook() == null && WorkContext.getWorkResource().exist(jTemplate.getPath())) { + attr.setXmlSavedHook(new StrategyConfigsAttrSavedHook(jTemplate.getPath(), attr)); + } + return attr; + } else { + throw new IllegalStateException("[ESD]No editing template found."); + } + } + + + /** + * 当前编辑的模版是否被批量开启 + * + * @return + */ + public static boolean isEditingTemplateRecommended() { + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + + if (jTemplate != null) { + FILE file = jTemplate.getEditingFILE(); + if (file != null) { + String path = file.getPath(); + return StrategyConfigHelper.recommended(path); + } + } + return false; + } + + + /** + * 获取模版数据集配置 + * + * @param dsName + * @return + */ + public static StrategyConfig getStrategyConfig(String dsName) { + + return getStrategyConfigsAttr().getStrategyConfig(dsName); + } + + /** + * 移除模版数据集配置 + * + * @param dsName + * @return + */ + public static StrategyConfig removeStrategyConfig(String dsName) { + + return getStrategyConfigsAttr().removeStrategyConfig(dsName); + } + + /** + * 添加模版数据集配置 + * + * @param strategyConfig + */ + public static void addStrategyConfig(StrategyConfig strategyConfig) { + + getStrategyConfigsAttr().addStrategyConfig(strategyConfig); + } + + + private static class StrategyConfigsAttrSavedHook implements XMLSavedHook { + + private static final long serialVersionUID = -8843201977112289321L; + + private final String tplPath; + private final Map origStrategyConfigs; + + public StrategyConfigsAttrSavedHook(String tplPath, StrategyConfigsAttr raw) { + this.tplPath = tplPath; + this.origStrategyConfigs = new HashMap<>(); + this.initOrigStrategyConfigs(raw); + } + + + private void initOrigStrategyConfigs(StrategyConfigsAttr raw) { + origStrategyConfigs.clear(); + raw.getStrategyConfigs().forEach((k, v) -> { + try { + origStrategyConfigs.put(k, v.clone()); + } catch (CloneNotSupportedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + }); + } + + @Override + public void doAfterSaved(StrategyConfigsAttr saved) { + + FineLoggerFactory.getLogger().info("[ESD]Write StrategyConfigsAttr done, now check change."); + Set dsNames = new HashSet<>(); + dsNames.addAll(origStrategyConfigs.keySet()); + dsNames.addAll(saved.getStrategyConfigs().keySet()); + + if (StringUtils.isNotEmpty(tplPath)) { + dsNames.forEach(dsName -> { + if (StringUtils.isNotEmpty(dsName)) { + StrategyEventsNotifier.compareAndFireConfigEvents(origStrategyConfigs.get(dsName), saved.getStrategyConfig(dsName), new DSMapping(tplPath, new DsNameTarget(dsName))); + } + }); + } + + initOrigStrategyConfigs(saved); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java new file mode 100644 index 000000000..6f50e6ba2 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java @@ -0,0 +1,225 @@ +package com.fr.design.data.datapane; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.ActionLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.esd.common.CacheConstants; +import com.fr.esd.core.strategy.config.StrategyConfig; +import com.fr.esd.core.strategy.config.StrategyConfigHelper; +import com.fr.esd.util.Utils; +import com.fr.locale.InterProviderFactory; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; + +import javax.swing.AbstractAction; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Desktop; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.net.URI; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * @author rinoux + * @version 10.0 + * Created by rinoux on 2020/7/22 + */ +public class ESDStrategyConfigPane extends BasicBeanPane { + private UIRadioButton selectAutoUpdate; + private UIRadioButton selectBySchema; + private UICheckBox shouldEvolve; + private UILabel updateIntervalCheckTips; + private UITextField updateInterval; + private UITextField schemaTime; + private ActionLabel actionLabel; + private UILabel schemaTimeCheckTips; + private final boolean global; + private StrategyConfig strategyConfig; + + private static final String CRON_HELP_URL = "http://help.fanruan.com/finereport/doc-view-693.html"; + + public ESDStrategyConfigPane(boolean global) { + this.global = global; + init(); + } + + private void init() { + setLayout(FRGUIPaneFactory.createM_BorderLayout()); + + this.selectAutoUpdate = new UIRadioButton(InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Every-Interval")); + + this.updateInterval = new UITextField(4); + this.shouldEvolve = new UICheckBox(InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Auto-Evolved-Strategy"), false); + this.shouldEvolve.setEnabled(false); + this.updateIntervalCheckTips = new UILabel(InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Error-Interval-Format")); + this.updateIntervalCheckTips.setForeground(Color.RED); + this.updateIntervalCheckTips.setVisible(false); + + this.selectBySchema = new UIRadioButton(InterProviderFactory.getProvider().getLocText("ESD_Config-pane-Cron")); + this.schemaTime = new UITextField(10); + this.schemaTimeCheckTips = new UILabel(InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Error-Time-Format")); + this.schemaTimeCheckTips.setVisible(false); + this.schemaTimeCheckTips.setForeground(Color.RED); + + + this.selectAutoUpdate.addActionListener(new AbstractAction() { + public void actionPerformed(ActionEvent e) { + ESDStrategyConfigPane.this.selectBySchema.setSelected(!ESDStrategyConfigPane.this.selectAutoUpdate.isSelected()); + ESDStrategyConfigPane.this.schemaTime.setEnabled(false); + ESDStrategyConfigPane.this.updateInterval.setEnabled(true); + ESDStrategyConfigPane.this.shouldEvolve.setEnabled(true); + } + }); + + this.selectBySchema.addActionListener(new AbstractAction() { + public void actionPerformed(ActionEvent e) { + ESDStrategyConfigPane.this.selectAutoUpdate.setSelected(!ESDStrategyConfigPane.this.selectBySchema.isSelected()); + ESDStrategyConfigPane.this.schemaTime.setEnabled(true); + ESDStrategyConfigPane.this.updateInterval.setEnabled(false); + ESDStrategyConfigPane.this.shouldEvolve.setEnabled(false); + } + }); + + JPanel pane = FRGUIPaneFactory.createVerticalTitledBorderPane(InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Cache-Update-Strategy")); + add(pane, BorderLayout.NORTH); + + JPanel row1 = GUICoreUtils.createFlowPane(new Component[]{ + this.selectAutoUpdate, + this.updateInterval, + new UILabel(InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Minute-Update-Cache")), + this.shouldEvolve, + this.updateIntervalCheckTips + }, 0, 5); + pane.add(row1); + + ActionLabel actionLabel = new ActionLabel(InterProviderFactory.getProvider().getLocText("ESD_config-pane-Cron-Help")); + actionLabel.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + try { + Desktop.getDesktop().browse(new URI(CRON_HELP_URL)); + } catch (Exception exp) { + FineLoggerFactory.getLogger().error(exp.getMessage(), e); + } + } + }); + + JPanel row2 = GUICoreUtils.createFlowPane(new Component[]{ + this.selectBySchema, + this.schemaTime, + actionLabel, + this.schemaTimeCheckTips + }, 0, 5); + pane.add(row2); + } + + + public void populateBean(StrategyConfig ob) { + + if (ob == null && !global) { + ob = StrategyConfigHelper.createStrategyConfig(true, false, true); + } + this.strategyConfig = ob; + + this.updateInterval.setText(ob.getUpdateInterval() <= 0 ? "0" : String.valueOf(ob.getUpdateInterval() / (double) CacheConstants.MILLIS_OF_MINUTE)); + this.schemaTime.setText(StringUtils.join(",", ob.getUpdateSchema().toArray(new String[0]))); + this.shouldEvolve.setSelected(ob.shouldEvolve()); + this.selectBySchema.setSelected(ob.isScheduleBySchema()); + this.selectAutoUpdate.setSelected(!ob.isScheduleBySchema()); + + if (global) { + //使用全局配置,禁用面板编辑 + disablePane(); + } else { + setSchemaEnable(!this.selectAutoUpdate.isSelected()); + } + } + + + private void disablePane() { + this.selectAutoUpdate.setEnabled(false); + this.updateInterval.setEnabled(false); + this.shouldEvolve.setEnabled(false); + + this.selectBySchema.setEnabled(false); + this.schemaTime.setEnabled(false); + } + + private void setSchemaEnable(boolean enable) { + this.updateInterval.setEnabled(!enable); + this.shouldEvolve.setEnabled(!enable); + + this.schemaTime.setEnabled(enable); + } + + + public StrategyConfig updateBean() { + StrategyConfig config = null; + if (!this.global) { + try { + //这里是new的config + config = this.strategyConfig.clone(); + + if (this.selectBySchema.isSelected()) { + List schemaTimes = new ArrayList<>(); + String text = this.schemaTime.getText(); + + if (Utils.checkUpdateTimeSchema(text)) { + if (Utils.isCronExpression(text)) { + schemaTimes.add(text); + } else { + Collections.addAll(schemaTimes, text.split(",")); + } + } else { + this.schemaTimeCheckTips.setVisible(true); + throw new IllegalArgumentException("update schema time format error."); + } + config.setScheduleBySchema(true); + config.setUpdateSchema(schemaTimes); + } else { + String interval = this.updateInterval.getText(); + if (checkUpdateInterval(interval)) { + long intervalMillis = StringUtils.isEmpty(interval) ? 0 : (long) (Double.parseDouble(interval) * CacheConstants.MILLIS_OF_MINUTE); + config.setUpdateInterval(intervalMillis); + } else { + this.updateIntervalCheckTips.setVisible(true); + throw new IllegalArgumentException("Error update interval format."); + } + + config.setShouldEvolve(this.shouldEvolve.isSelected()); + config.setScheduleBySchema(false); + } + } catch (CloneNotSupportedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + return config; + } + + + private boolean checkUpdateInterval(String intervalValue) { + try { + return !StringUtils.isEmpty(intervalValue) && !(Double.parseDouble(intervalValue) <= 0); + } catch (NumberFormatException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + + return false; + } + + + protected String title4PopupWindow() { + return InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Cache-Strategy-Config-Title"); + } +} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 5ce42c5c6..8cb580b5d 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -2,6 +2,7 @@ package com.fr.design.data.datapane; import com.fr.base.TableData; import com.fr.data.TableDataSource; +import com.fr.data.impl.DBTableData; import com.fr.data.impl.TableDataSourceDependent; import com.fr.design.DesignModelAdapter; import com.fr.design.ExtraDesignClassManager; @@ -10,52 +11,74 @@ import com.fr.design.constants.UIConstants; import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.data.BasicTableDataUtils; import com.fr.design.data.DesignTableDataManager; +import com.fr.design.data.DesignerStrategyConfigUtils; +import com.fr.design.data.datapane.TableDataCreatorProducer; +import com.fr.design.data.datapane.TableDataNameObjectCreator; +import com.fr.design.data.datapane.TableDataSourceOP; +import com.fr.design.data.datapane.TableDataTree; +import com.fr.design.data.datapane.TableDataTreeDragSource; import com.fr.design.data.tabledata.StoreProcedureWorkerListener; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; +import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane; import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; +import com.fr.design.i18n.Toolkit; import com.fr.design.icon.IconPathConstants; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.WestRegionContainerPane; +import com.fr.design.menu.LineSeparator; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; +import com.fr.esd.core.strategy.config.StrategyConfig; +import com.fr.esd.core.strategy.config.StrategyConfigHelper; +import com.fr.esd.event.DSMapping; +import com.fr.esd.event.DsNameTarget; +import com.fr.esd.event.StrategyEventsNotifier; import com.fr.general.ComparatorUtils; -import com.fr.general.GeneralContext; +import com.fr.general.IOUtils; import com.fr.general.NameObject; -import com.fr.plugin.context.PluginContext; -import com.fr.plugin.injectable.PluginModule; -import com.fr.plugin.manage.PluginFilter; -import com.fr.plugin.observer.PluginEvent; -import com.fr.plugin.observer.PluginEventListener; +import com.fr.log.FineLoggerFactory; import com.fr.stable.core.PropertyChangeAdapter; +import org.jetbrains.annotations.NotNull; import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.SwingUtilities; +import javax.swing.SwingWorker; import javax.swing.ToolTipManager; +import javax.swing.tree.TreePath; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.dnd.DnDConstants; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; +import java.util.concurrent.ExecutionException; public class TableDataTreePane extends BasicTableDataTreePane { - private static TableDataTreePane singleton = new TableDataTreePane(); + private static final TableDataTreePane singleton = new TableDataTreePane(); public static final int PLUGIN_LISTENER_PRIORITY = 1; @@ -77,31 +100,42 @@ public class TableDataTreePane extends BasicTableDataTreePane { } private TableDataSourceOP op; - private TableDataTree dataTree; + private TableDataTree tableDataTree; private EditAction editAction; private RemoveAction removeAction; + private EsdOnAction esdAction; + private EsdOffAction esdOffAction; private PreviewTableDataAction previewTableDataAction; private TableDataTreePane() { + initPane(); + } + + private void initPane() { this.setLayout(new BorderLayout(4, 0)); this.setBorder(null); - dataTree = new TableDataTree(); - ToolTipManager.sharedInstance().registerComponent(dataTree); + + //TableDataTree + tableDataTree = new TableDataTree(); + ToolTipManager.sharedInstance().registerComponent(tableDataTree); ToolTipManager.sharedInstance().setDismissDelay(3000); ToolTipManager.sharedInstance().setInitialDelay(0); - addMenuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Add")); - addMenuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH); + + addMenuDef = new MenuDef(Toolkit.i18nText("Fine-Design_Basic_Action_Add")); + addMenuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH); createAddMenuDef(); - // 创建插件监听 - createPluginListener(); editAction = new EditAction(); removeAction = new RemoveAction(); - previewTableDataAction = new PreviewTableDataAction(dataTree); + previewTableDataAction = new PreviewTableDataAction(tableDataTree); connectionTableAction = new ConnectionTableAction(); + esdAction = new EsdOnAction(); + esdOffAction = new EsdOffAction(); + + ToolBarDef toolbarDef = new ToolBarDef(); - toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction, SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction); + toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction, SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction, esdAction, esdOffAction); UIToolbar toolBar = ToolBarDef.createJToolBar(); toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); toolBar.setBorderPainted(true); @@ -111,115 +145,152 @@ public class TableDataTreePane extends BasicTableDataTreePane { toolbarPane.add(toolBar, BorderLayout.CENTER); this.add(toolbarPane, BorderLayout.NORTH); - UIScrollPane scrollPane = new UIScrollPane(dataTree); + UIScrollPane scrollPane = new UIScrollPane(tableDataTree); scrollPane.setBorder(null); - initbuttonGroup(); + initButtonGroup(); JPanel jPanel = new JPanel(new BorderLayout(0, 0)); JPanel buttonPane = new JPanel(new GridLayout()); buttonPane.add(buttonGroup, BorderLayout.CENTER); jPanel.add(buttonPane, BorderLayout.NORTH); jPanel.add(scrollPane, BorderLayout.CENTER); this.add(jPanel, BorderLayout.CENTER); - dataTree.addMouseListener(new MouseAdapter() { + tableDataTree.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { checkButtonEnabled(); } }); - dataTree.addKeyListener(getTableTreeNodeListener(editAction, previewTableDataAction, removeAction, op, dataTree)); + tableDataTree.addKeyListener(getTableTreeNodeListener(editAction, previewTableDataAction, removeAction, op, tableDataTree)); // TreeCellEditor - dataTree.setEditable(true); - TableDataTreeCellEditor treeCellEditor = new TableDataTreeCellEditor(new UITextField(), dataTree, this); + tableDataTree.setEditable(true); + TableDataTreeCellEditor treeCellEditor = new TableDataTreeCellEditor(new UITextField(), tableDataTree, this); treeCellEditor.addCellEditorListener(treeCellEditor); - dataTree.setCellEditor(treeCellEditor); - new TableDataTreeDragSource(dataTree, DnDConstants.ACTION_COPY); + tableDataTree.setCellEditor(treeCellEditor); + new TableDataTreeDragSource(tableDataTree, DnDConstants.ACTION_COPY); checkButtonEnabled(); } - private void createPluginListener() { - - //菜单栏监听 - GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) { - - @Override - public void on(PluginEvent event) { - - addMenuDef.clearShortCuts(); - createAddMenuDef(); - } - }, new PluginFilter() { - - @Override - public boolean accept(PluginContext context) { - - return context.contain(PluginModule.ExtraDesign); - } - }); - } - - - protected void checkButtonEnabled() { - super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, dataTree); - } - /** * 刷新 */ + @Override public void refreshDockingView() { populate(new TableDataSourceOP(tc)); this.checkButtonEnabled(); } - protected void initbuttonGroup() { -// Icon[] iconArray = {BaseUtils.readIcon("/com/fr/design/images/data/datasource.png"), BaseUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase.png")}; - final Integer[] modeArray = {TEMPLATE_TABLE_DATA, SERVER_TABLE_DATA}; - String[] textArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Source_Type_Template"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData")}; - buttonGroup = new UIHeadGroup(textArray) { - public void tabChanged(int index) { - if (op != null) { - op.setDataMode(modeArray[buttonGroup.getSelectedIndex()]); - addMenuDef.setEnabled(modeArray[buttonGroup.getSelectedIndex()] == TEMPLATE_TABLE_DATA ? true : false); - refreshDockingView(); - } + + @Override + public final void createAddMenuDef() { + TableDataNameObjectCreator[] creators = TableDataCreatorProducer.getInstance().createReportTableDataCreator(); + for (final TableDataNameObjectCreator creator : creators) { + if (creator.shouldInsertSeparator()) { + addMenuDef.addShortCut(new LineSeparator()); } - }; - buttonGroup.setNeedLeftRightOutLine(false); + + addMenuDef.addShortCut(new AddAction() { + @Override + protected String getTDName() { + return creator.menuName(); + } + + @Override + protected Icon getTDIcon() { + return creator.menuIcon(); + } + + @Override + protected String getNamePrefix() { + return creator.getPrefix(); + } + + @Override + protected TemplateTableDataWrapper getTableDataInstance() { + TableData tableData = (TableData) creator.createObject(); + + //新建的DBTableData单独换为DBTableData + if (tableData instanceof DBTableData) { + tableData = new DBTableData(); + String dsName = createDsName(creator.getPrefix()); + ((DBTableData) tableData).setDsName(dsName); + } else { + // TODO: 2020/11/10 后期支持其它数据集,这里转化可以不用侵入修改TableDataCreatorProducer + } + return new TemplateTableDataWrapper(tableData); + } + }); + } } /** * 编辑面板 * - * @param uPanel 面板 - * @param originalName 原始名字 + * @param tableDataPane 面板 + * @param originalName 原始名字 */ - public void dgEdit(final AbstractTableDataPane uPanel, String originalName, boolean isUpdate) { - uPanel.addStoreProcedureWorkerListener(new StoreProcedureWorkerListener() { + @Override + public void dgEdit(final AbstractTableDataPane tableDataPane, String originalName, boolean isUpdate) { + tableDataPane.addStoreProcedureWorkerListener(new StoreProcedureWorkerListener() { public void fireDoneAction() { - if (dataTree.getSelectionPath() == null) { - dataTree.refresh(); + if (tableDataTree.getSelectionPath() == null) { + tableDataTree.refresh(); } else { - Object object = dataTree.getSelectionPath().getLastPathComponent(); - int[] rows = dataTree.getSelectionRows(); - dataTree.refreshChildByName(object.toString()); - dataTree.setSelectionRows(rows); + Object object = tableDataTree.getSelectionPath().getLastPathComponent(); + int[] rows = tableDataTree.getSelectionRows(); + tableDataTree.refreshChildByName(object.toString()); + tableDataTree.setSelectionRows(rows); } } }); - final BasicPane.NamePane nPanel = uPanel.asNamePane(); - nPanel.setObjectName(originalName); + final NamePane tdNamePanel = tableDataPane.asNamePane(); + tdNamePanel.setObjectName(originalName); + final String oldName = originalName; - final BasicDialog dg; allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); - dg = nPanel.showLargeWindow(SwingUtilities.getWindowAncestor(TableDataTreePane.this), new DialogActionAdapter() { + + final BasicDialog dg = tdNamePanel.showLargeWindow(SwingUtilities.getWindowAncestor(TableDataTreePane.this), new DialogActionAdapter() { + @Override public void doOk() { DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); - tc.renameTableData(oldName, nPanel.getObjectName(), false); + tc.renameTableData(oldName, tdNamePanel.getObjectName(), false); TableDataSource tds = tc.getBook(); - TableData td = uPanel.updateBean(); + TableData td = tableDataPane.updateBean(); if (td instanceof TableDataSourceDependent) { ((TableDataSourceDependent) td).setTableDataSource(tds); } - String tdName = nPanel.getObjectName(); + String tdName = tdNamePanel.getObjectName(); + + + //模版还没保存的时候不知道后缀,不能设置到策略配置里面 + if (tableDataPane instanceof DBTableDataPane) { + StrategyConfig editingConfig = ((DBTableDataPane) tableDataPane).updateStrategyConfig(); + if (editingConfig != null) { + editingConfig.setDsName(tdName); + if (!ComparatorUtils.equals(oldName, tdName)) { + //重命名 + DesignerStrategyConfigUtils.removeStrategyConfig(oldName); + } + + DesignerStrategyConfigUtils.addStrategyConfig(editingConfig); + } + ((DBTableData) td).setDsName(tdName); + } + + + //服务器数据集不会走这里,入口不一样 + /*if (tableDataPane instanceof ServerDBTableDataPane) { + StrategyConfig editingConfig = ((ServerDBTableDataPane) tableDataPane).updateStrategyConfig(); + if (editingConfig != null) { + editingConfig.setDsName(tdName); + if (!ComparatorUtils.equals(oldName, tdName)) { + //重命名 + DesignerStrategyConfigUtils.removeServerStrategyConfig(oldName); + } + + DesignerStrategyConfigUtils.addServerStrategyConfig(editingConfig); + } + }*/ + tds.putTableData(tdName, td); Map map = new HashMap(); if (!ComparatorUtils.equals(oldName, tdName)) { @@ -228,81 +299,34 @@ public class TableDataTreePane extends BasicTableDataTreePane { fireDSChanged(map); tc.fireTargetModified(); tc.parameterChanged(); - int[] rows = dataTree.getSelectionRows(); - dataTree.refreshChildByName(tdName); - dataTree.setSelectionRows(rows); + int[] rows = tableDataTree.getSelectionRows(); + tableDataTree.refreshChildByName(tdName); + tableDataTree.setSelectionRows(rows); + + + //单独编辑数据集关闭,修改缓存配置状态,刷新下一键开启/关闭按钮 + checkButtonEnabled(); + } + + @Override + public void doCancel() { + super.doCancel(); } }); - nPanel.addPropertyChangeListener(new PropertyChangeAdapter() { + tdNamePanel.addPropertyChangeListener(new PropertyChangeAdapter() { @Override public void propertyChange() { - doPropertyChange(dg, nPanel, oldName); + doPropertyChange(dg, tdNamePanel, oldName); } }); dg.setVisible(true); } - private class EditAction extends UpdateAction { - public EditAction() { - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); - this.setMnemonic('E'); - this.setSmallIcon("/com/fr/design/images/control/edit"); - } - - public void actionPerformed(ActionEvent e) { - final NameObject selectedNO = dataTree.getSelectedNameObject(); - if (selectedNO == null) { - return; - } - DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName()); - dgEdit(((AbstractTableDataWrapper) selectedNO.getObject()).creatTableDataPane(), selectedNO.getName(), false); - } - } - - private class RemoveAction extends UpdateAction { - - public RemoveAction() { - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); - this.setMnemonic('R'); - this.setSmallIcon("/com/fr/design/images/control/remove"); - } - - @Override - public void actionPerformed(ActionEvent e) { - NameObject selectedNO = dataTree.getSelectedNameObject(); - - if (selectedNO == null) { - return; - } - - int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + ":" + selectedNO.getName() + "?", - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); - if (returnVal == JOptionPane.OK_OPTION) { - // richer:这个地方为什么要在DataSourceTree里面去remove呢?多此一举吧 - op.removeAction(selectedNO.getName()); - dataTree.refresh(); - // Richie:默认最后一行获得焦点. - dataTree.requestFocus(); - dataTree.setSelectionRow(dataTree.getRowCount() - 1); - fireDSChanged(); - checkButtonEnabled(); - DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName()); - } - } - } - - private void populate(TableDataSourceOP op) { - this.op = op; - dataTree.populate(op); - checkButtonEnabled(); - } - - - /** - * @return - */ - public TableDataTree getDataTree() { - return dataTree; + @Override + public void removeTableData(String sourceName) { + TableDataSource tds = this.tc.getBook(); + tds.removeTableData(sourceName); + this.tableDataTree.refresh(); } /** @@ -311,6 +335,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { * @param srcName 数据集来源(比如报表块,就是报表块的名称) * @param tableDataSource 数据集 */ + @Override public Map addTableData(String srcName, TableDataSource tableDataSource, boolean isCover) { Map tdNameMap = new HashMap<>(); allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); @@ -329,29 +354,55 @@ public class TableDataTreePane extends BasicTableDataTreePane { } } tc.parameterChanged(); - dataTree.refresh(); + tableDataTree.refresh(); return Collections.unmodifiableMap(tdNameMap); } + /** + * 合并数据集 + * + * @param srcName 数据集来源(比如报表块,就是报表块的名称) + * @param tableDataSource 数据集 + */ @Override - public void removeTableData(String sourceName) { + public Map addTableData(String srcName, TableDataSource tableDataSource) { + Map tdNameMap = new HashMap<>(); + allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); + DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); TableDataSource tds = tc.getBook(); - tds.removeTableData(sourceName); - dataTree.refresh(); + Iterator tdIterator = tableDataSource.getTableDataNameIterator(); + while (tdIterator.hasNext()) { + String tdName = tdIterator.next(); + String oldName = tdName; + TableData td = tableDataSource.getTableData(tdName); + if (tds.getTableData(tdName) != null || isDsNameRepeaded(tdName)) { + //如果有同名的就拼上来源名称 + tdName = srcName + tdName; + } + int i = 0; + while (tds.getTableData(tdName) != null) { + i++;//如果拼上名字后依然已经存在就加编号 + tdName += i; + } + tds.putTableData(tdName, td); + if (!ComparatorUtils.equals(oldName, tdName)) { + tdNameMap.put(oldName, tdName); + } + } + tc.parameterChanged(); + tableDataTree.refresh(); + return Collections.unmodifiableMap(tdNameMap); } - - - + @Override public void addDataPane(final AbstractTableDataPane uPanel, String paneName) { final NamePane nPanel = uPanel.asNamePane(); nPanel.setObjectName(paneName); - final String oldName = paneName; allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); - tc.renameTableData(oldName, nPanel.getObjectName(), false); + tc.renameTableData(paneName, nPanel.getObjectName(), false); TableDataSource tds = tc.getBook(); TableData td = uPanel.updateBean(); if (td instanceof TableDataSourceDependent) { @@ -360,14 +411,409 @@ public class TableDataTreePane extends BasicTableDataTreePane { String tdName = nPanel.getObjectName(); tds.putTableData(tdName, td); Map map = new HashMap(); - if (!ComparatorUtils.equals(oldName, tdName)) { - map.put(oldName, tdName); + if (!ComparatorUtils.equals(paneName, tdName)) { + map.put(paneName, tdName); } fireDSChanged(map); tc.fireTargetModified(); tc.parameterChanged(); - int[] rows = dataTree.getSelectionRows(); - dataTree.refreshChildByName(tdName); - dataTree.setSelectionRows(rows); + int[] rows = tableDataTree.getSelectionRows(); + tableDataTree.refreshChildByName(tdName); + tableDataTree.setSelectionRows(rows); + } + + @Override + public TableDataTree getDataTree() { + return this.tableDataTree; + } + + private void populate(TableDataSourceOP op) { + this.op = op; + tableDataTree.populate(op); + checkButtonEnabled(); + } + + + private void resetAddMenuDef() { + this.addMenuDef.clearShortCuts(); + this.createAddMenuDef(); + } + + private void checkButtonEnabled() { + super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, tableDataTree); + this.checkESDComponentsEnabled(); + } + + + private void checkESDComponentsEnabled() { + if (buttonGroup.getSelectedIndex() == 1) { + //切换到服务器数据集的tab,禁用 + esdAction.setEnabled(false); + esdOffAction.setEnabled(false); + return; + } + + new SwingWorker() { + @Override + protected ButtonStatus doInBackground() throws Exception { + ButtonStatus btnStatus = new ButtonStatus(); + Map statusMap = checkCanBeEsdBatchEnableStatus(); + if (statusMap.size() == 0) { + //没有db数据集 + return btnStatus; + } else { + int canTurnOnCount = 0; + int canTurnOffCount = 0; + for (ESDStatus status : statusMap.values()) { + switch (status) { + case GLOBAL_ON: + case GLOBAL_OFF: + case SINGLE_OFF: + canTurnOnCount++; + break; + case SINGLE_ON: + canTurnOffCount++; + break; + default: + break; + } + } + btnStatus.setOnStatus(canTurnOnCount > 0); + btnStatus.setOffStatus(canTurnOffCount > 0); + } + return btnStatus; + } + + @Override + protected void done() { + try { + ButtonStatus buttonStatus = get(); + esdAction.setEnabled(buttonStatus.isOnStatus()); + esdOffAction.setEnabled(buttonStatus.isOffStatus()); + } catch (InterruptedException | ExecutionException e) { + FineLoggerFactory.getLogger().error("get esd status of ds error for " + e.getMessage(), e); + } + } + }.execute(); + } + + private static class ButtonStatus { + private boolean onStatus = false; + private boolean offStatus = false; + + public boolean isOnStatus() { + return onStatus; + } + + public void setOnStatus(boolean onStatus) { + this.onStatus = onStatus; + } + + public boolean isOffStatus() { + return offStatus; + } + + public void setOffStatus(boolean offStatus) { + this.offStatus = offStatus; + } + } + + //模版数据集 + private void initButtonGroup() { + final Integer[] modeArray = {TEMPLATE_TABLE_DATA, SERVER_TABLE_DATA}; + String[] textArray = {Toolkit.i18nText("Fine-Design_Basic_Tabledata_Source_Type_Template"), Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData")}; + buttonGroup = new UIHeadGroup(textArray) { + public void tabChanged(int index) { + if (op != null) { + op.setDataMode(modeArray[buttonGroup.getSelectedIndex()]); + addMenuDef.setEnabled(modeArray[buttonGroup.getSelectedIndex()] == TEMPLATE_TABLE_DATA); + refreshDockingView(); + + } + } + }; + buttonGroup.setNeedLeftRightOutLine(false); + } + + + private TableDataWrapper findTableDataWrapper(TreePath treePath) { + if (treePath != null) { + ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) treePath.getLastPathComponent(); + Object selectedUserObject = selectedTreeNode.getUserObject(); + NameObject nameObject = null; + if (selectedUserObject instanceof NameObject) { + nameObject = (NameObject) selectedUserObject; + } else { + selectedTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent(); + selectedUserObject = selectedTreeNode.getUserObject(); + if (selectedUserObject instanceof NameObject) { + nameObject = (NameObject) selectedUserObject; + } + } + if (nameObject != null && nameObject.getObject() instanceof TableDataWrapper) { + return (TableDataWrapper) nameObject.getObject(); + } + } + + return null; + } + + private String getTplPath() { + return HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getPath(); + } + + enum ESDStatus { + GLOBAL_ON, + GLOBAL_OFF, + SINGLE_ON, + SINGLE_OFF; + } + + + private Map checkCanBeEsdBatchEnableStatus() { + //<数据集, 是否可以被单独开启> + Map result = new HashMap<>(); + for (int i = 0; i < tableDataTree.getRowCount(); i++) { + TreePath treePath = tableDataTree.getPathForRow(i); + + TableDataWrapper wrapper = findTableDataWrapper(treePath); + if (wrapper.getTableData() instanceof DBTableData) { + DBTableData td = (DBTableData) wrapper.getTableData(); + + StrategyConfig config = DesignerStrategyConfigUtils.getStrategyConfig(wrapper.getTableDataName()); + if (config == null) { + result.put(td, td.isShare() ? ESDStatus.SINGLE_ON : ESDStatus.SINGLE_OFF); + } else { + if (config.isUseGlobal()) { + if (StrategyConfigHelper.recommended(getTplPath())) { + result.put(td, ESDStatus.GLOBAL_ON); + } else { + result.put(td, ESDStatus.GLOBAL_OFF); + } + } else { + if (config.enabled()) { + result.put(td, ESDStatus.SINGLE_ON); + } else { + result.put(td, ESDStatus.SINGLE_OFF); + } + } + } + } + } + + return result; + } + + + private class EsdOnAction extends AbstractESDAction { + + @Override + public String getName() { + return Toolkit.i18nText("ESD_Batch-Enable"); + } + + @Override + public Icon getIcon() { + return IOUtils.readIcon("/com/fr/design/images/control/batch_esd_on.png"); + } + + @Override + public void doWithTableDataWrapper(TableDataWrapper wrapper) { + String dsName = wrapper.getTableDataName(); + if (wrapper.getTableData() instanceof DBTableData) { + StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName); + strategyConfig.setEnable(true); + strategyConfig.setUseGlobal(false); + DesignerStrategyConfigUtils.addStrategyConfig(strategyConfig); + DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); + } + } + } + + private @NotNull StrategyConfig getOrCreateStrategyConfig(String dsName) { + StrategyConfig config = DesignerStrategyConfigUtils.getStrategyConfig(dsName); + + if (config == null) { + config = StrategyConfigHelper.createStrategyConfig(true); + config.setDsName(dsName); + } + + return config; + } + + + private String createDsName(String prefix) { + int count = 1; + allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); + while (isDsNameRepeaded(prefix + count)) { + count++; + } + return prefix + count; + } + + + private class EsdOffAction extends AbstractESDAction { + + @Override + public String getName() { + return Toolkit.i18nText("ESD_Batch-Disable"); + } + + @Override + public Icon getIcon() { + return IOUtils.readIcon("/com/fr/design/images/control/batch_esd_off.png"); + } + + @Override + public void doWithTableDataWrapper(TableDataWrapper wrapper) { + String dsName = wrapper.getTableDataName(); + if (wrapper.getTableData() instanceof DBTableData) { + ((DBTableData) wrapper.getTableData()).setShare(false); + StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName); + strategyConfig.setEnable(false); + strategyConfig.setUseGlobal(false); + DesignerStrategyConfigUtils.addStrategyConfig(strategyConfig); + DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); + } + } + } + + private abstract class AbstractESDAction extends UpdateAction { + + public abstract String getName(); + + public abstract Icon getIcon(); + + public abstract void doWithTableDataWrapper(TableDataWrapper tableDataWrapper); + + public AbstractESDAction() { + this.setName(getName()); + this.setMnemonic('R'); + this.setSmallIcon(getIcon()); + } + + @Override + public void actionPerformed(ActionEvent e) { + List tableDataWrapperList = new ArrayList<>(); + + for (int i = 0; i < tableDataTree.getRowCount(); i++) { + TreePath treePath = tableDataTree.getPathForRow(i); + TableDataWrapper wrapper = findTableDataWrapper(treePath); + if (wrapper != null) { + tableDataWrapperList.add(wrapper); + } + } + if (tableDataWrapperList.isEmpty()) { + return; + } + new SwingWorker() { + @Override + protected Void doInBackground() throws Exception { + for (TableDataWrapper tableDataWrapper : tableDataWrapperList) { + doWithTableDataWrapper(tableDataWrapper); + } + return null; + } + + @Override + protected void done() { + refreshDockingView(); + } + }.execute(); + } + } + + + /** + * 新建数据集 + *

+ * 抽象化,支持不同类型数据集创建 + */ + private abstract class AddAction extends UpdateAction { + + protected abstract String getTDName(); + + protected abstract Icon getTDIcon(); + + protected abstract String getNamePrefix(); + + protected abstract TemplateTableDataWrapper getTableDataInstance(); + + public AddAction() { + this.setName(this.getTDName()); + this.setSmallIcon(this.getTDIcon()); + } + + @Override + public void actionPerformed(ActionEvent e) { + dgEdit(getTableDataInstance().creatTableDataPane(), createDsName(getNamePrefix()), false); + } + } + + + private class EditAction extends UpdateAction { + public EditAction() { + this.setName(Toolkit.i18nText("Fine-Design_Basic_Edit")); + this.setMnemonic('E'); + this.setSmallIcon(IOUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)); + } + + @Override + public void actionPerformed(ActionEvent e) { + final NameObject selectedNO = tableDataTree.getSelectedNameObject(); + if (selectedNO == null) { + return; + } + + String dsName = selectedNO.getName(); + DesignTableDataManager.removeSelectedColumnNames(dsName); + + AbstractTableDataWrapper wrapper = (AbstractTableDataWrapper) selectedNO.getObject(); + + AbstractTableDataPane tableDataPane = wrapper.creatTableDataPane(); + + //下面创建creatTableDataPane后会直接populate,所以populate时不能用后设置的一些参数,比如name + dgEdit(tableDataPane, dsName, false); + } + } + + private class RemoveAction extends UpdateAction { + + public RemoveAction() { + this.setName(Toolkit.i18nText("Fine-Design_Basic_Remove")); + this.setMnemonic('R'); + this.setSmallIcon(IOUtils.readIcon(IconPathConstants.TD_REMOVE_ICON_PATH)); + } + + @Override + public void actionPerformed(ActionEvent e) { + NameObject selectedNO = tableDataTree.getSelectedNameObject(); + + if (selectedNO == null) { + return; + } + + int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + ":" + selectedNO.getName() + "?", + Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); + if (returnVal == JOptionPane.OK_OPTION) { + // richer:这个地方为什么要在DataSourceTree里面去remove呢?多此一举吧 + op.removeAction(selectedNO.getName()); + tableDataTree.refresh(); + // Richie:默认最后一行获得焦点. + tableDataTree.requestFocus(); + tableDataTree.setSelectionRow(tableDataTree.getRowCount() - 1); + fireDSChanged(); + checkButtonEnabled(); + + //删掉缓存配置 + DesignerStrategyConfigUtils.removeStrategyConfig(selectedNO.getName()); + + // 如果一个模版是平台开启,这个数据集的配置不会存xml,预览模版时直接从全局配置copy,这样 + // 导致删除的时候StrategyConfigsAttrSavedHook没有通过前后配置比较感知数据集被删除,因此不会发出事件让其失效 + // 这里额外发出一次数据集修改事件 + StrategyEventsNotifier.modifyDataSet(new DSMapping(getTplPath(), new DsNameTarget(selectedNO.getName()))); + DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName()); + } + } } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index 6065d0485..cd03336f9 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -1,27 +1,28 @@ package com.fr.design.data.tabledata.tabledatapane; -import com.fr.base.BaseUtils; import com.fr.base.Parameter; import com.fr.base.ParameterHelper; import com.fr.data.core.db.TableProcedure; import com.fr.data.impl.Connection; import com.fr.data.impl.DBTableData; -import com.fr.data.impl.JDBCDatabaseConnection; -import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.impl.NameDatabaseConnection; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; +import com.fr.design.data.DesignerStrategyConfigUtils; +import com.fr.design.data.datapane.ESDStrategyConfigPane; import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane; -import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane.DoubleClickSelectedNodeOnTreeListener; import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.datapane.sqlpane.SQLEditPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.DBTableDataMenuHandler; +import com.fr.design.gui.ibutton.UIButton; 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.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.UITableEditAction; @@ -29,18 +30,26 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; -import com.fr.design.utils.ParameterUtils; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.esd.core.strategy.config.StrategyConfig; +import com.fr.esd.core.strategy.config.StrategyConfigHelper; +import com.fr.esd.event.DSMapping; +import com.fr.esd.event.DsNameTarget; +import com.fr.esd.event.StrategyEventsNotifier; +import com.fr.esd.event.xml.XMLSavedHook; import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; import com.fr.general.sql.SqlUtils; import com.fr.log.FineLoggerFactory; import com.fr.script.Calculator; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; +import com.fr.workspace.WorkContext; import javax.swing.BorderFactory; import javax.swing.Box; @@ -55,6 +64,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyEvent; @@ -62,25 +72,39 @@ import java.awt.event.KeyListener; import java.util.ArrayList; import java.util.List; +/** + * @author rinoux + * @version 10.0 + * Created by rinoux on 2020/7/22 + */ public class DBTableDataPane extends AbstractTableDataPane { + private static final int BOTTOM = 6; - private static final String PREVIEW_BUTTON = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"); - private static final String REFRESH_BUTTON = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"); + private static final String PREVIEW_BUTTON = Toolkit.i18nText("Fine-Design_Basic_Preview"); + private static final String REFRESH_BUTTON = Toolkit.i18nText("Fine-Design_Basic_Refresh"); private ConnectionTableProcedurePane connectionTableProcedurePane; private UITableEditorPane editorPane; - private DBTableDataMenuHandler dbTableDataMenuHandler; private SQLEditPane sqlTextPane; - private UICheckBox isShareCheckBox; - private MaxMemRowCountPanel maxPanel; - private String pageQuery = null; + UIComboBox configFromList; + UICheckBox esdEnabled; + private UIButton esdSettingsBtn; + private UILabel barErrorTips; + private String pageQuery; private DBTableData dbTableData; + StrategyConfig strategyConfig; + + public DBTableDataPane() { + init(); + initMainSplitPane(); + } + private void init() { - this.setLayout(new BorderLayout(4, 4)); + setLayout(new BorderLayout(4, 4)); - sqlTextPane = new SQLEditPane(); - sqlTextPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); + this.sqlTextPane = new SQLEditPane(); + this.sqlTextPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); ParameterTableModel model = new ParameterTableModel() { @Override @@ -88,25 +112,27 @@ public class DBTableDataPane extends AbstractTableDataPane { return ArrayUtils.add(super.createDBTableAction(), new RefreshAction()); } }; - editorPane = new UITableEditorPane(model); + editorPane = new UITableEditorPane<>(model); - // 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table - connectionTableProcedurePane = new ConnectionTableProcedurePane() { + + this.connectionTableProcedurePane = new ConnectionTableProcedurePane() { @Override protected void filter(Connection connection, String conName, List nameList) { - - connection.addConnection(nameList, conName, new Class[]{JDBCDatabaseConnection.class, JNDIDatabaseConnection.class}); + connection.addConnection(nameList, conName, new Class[]{ + com.fr.data.impl.JDBCDatabaseConnection.class, + com.fr.data.impl.JNDIDatabaseConnection.class + }); } + @Override protected void addKeyMonitor() { - searchField.addKeyListener(new KeyListener() { - + this.searchField.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { - //do nothing } + @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { @@ -115,39 +141,39 @@ public class DBTableDataPane extends AbstractTableDataPane { } } + @Override public void keyReleased(KeyEvent e) { - //do nothing } }); } }; - connectionTableProcedurePane.addDoubleClickListener(new DoubleClickSelectedNodeOnTreeListener() { - + this.connectionTableProcedurePane.addDoubleClickListener(new ConnectionTableProcedurePane.DoubleClickSelectedNodeOnTreeListener() { @Override public void actionPerformed(TableProcedure target) { - Document document = sqlTextPane.getDocument(); + Document document = DBTableDataPane.this.sqlTextPane.getDocument(); try { - document.insertString(sqlTextPane.getCaretPosition(), target.toString(), null); + document.insertString(DBTableDataPane.this.sqlTextPane.getCaretPosition(), target.toString(), null); } catch (BadLocationException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - // 这里开始作色,本来可以给sqlTextPane添加DocumentListener来实现的, - // 后来发现insertString的时候,锁定了JTextPane,不能调用setXXX来作色,先这样了. - // sqlTextPane.syntaxTexts(); - sqlTextPane.requestFocus(); + + + DBTableDataPane.this.sqlTextPane.requestFocus(); } }); - sqlTextPane.addFocusListener(new FocusListener() { + + this.sqlTextPane.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { - // do nothing + barErrorTips.setVisible(false); } + @Override public void focusLost(FocusEvent e) { - if (isPreviewOrRefreshButton(e)) { - checkParameter(); + if (DBTableDataPane.this.isPreviewOrRefreshButton(e)) { + DBTableDataPane.this.checkParameter(); } } }); @@ -163,105 +189,194 @@ public class DBTableDataPane extends AbstractTableDataPane { northPane.add(editToolBar, BorderLayout.CENTER); northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, BOTTOM, 0)); - RTextScrollPane sqlTextScrollPane = new RTextScrollPane(sqlTextPane); + RTextScrollPane sqlTextScrollPane = new RTextScrollPane(this.sqlTextPane); sqlTextScrollPane.setLineNumbersEnabled(true); sqlTextScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); sqlTextScrollPane.setPreferredSize(new Dimension(680, 600)); JPanel paraMeanPane = new JPanel(new BorderLayout()); paraMeanPane.setPreferredSize(new Dimension(680, 90)); - UILabel paraMean = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Param_DES")); + UILabel paraMean = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Param_DES")); paraMeanPane.add(paraMean, BorderLayout.CENTER); box.add(northPane); box.add(sqlTextScrollPane); box.add(paraMeanPane); - box.add(editorPane); + box.add(this.editorPane); JPanel sqlSplitPane = new JPanel(new BorderLayout(4, 4)); sqlSplitPane.add(box, BorderLayout.CENTER); box.setMinimumSize(new Dimension(300, 400)); - // 防止数据连接名过长时影响 split pane 分割效果 - // 本界面中给MaxMemRowCountPanel留的空间太小,造成MaxMemRowCountPanel显示异常,这边减小一点最小宽度,拉长MaxMemRowCountPanel - connectionTableProcedurePane.setMinimumSize(new Dimension(230, 400)); - connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400)); - // 使用SplitPane - JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane); + + this.connectionTableProcedurePane.setMinimumSize(new Dimension(250, 400)); + this.connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400)); + + JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, this.connectionTableProcedurePane, sqlSplitPane); mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor())); mainSplitPane.setOneTouchExpandable(true); - this.add(mainSplitPane, BorderLayout.CENTER); - } - - public DBTableDataPane() { - init(); - initMainSplitPane(); + add(mainSplitPane, BorderLayout.CENTER); } private boolean isPreviewOrRefreshButton(FocusEvent e) { if (e.getOppositeComponent() != null) { String name = e.getOppositeComponent().getName(); - return ComparatorUtils.equals(name, PREVIEW_BUTTON) || ComparatorUtils.equals(name, REFRESH_BUTTON); + return (ComparatorUtils.equals(name, PREVIEW_BUTTON) || ComparatorUtils.equals(name, REFRESH_BUTTON)); } return false; } + @Override protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS-Database_Query"); + return Toolkit.i18nText("Fine-Design_Basic_DS-Database_Query"); } + private void refresh() { String[] paramTexts = new String[2]; - paramTexts[0] = SqlUtils.tryPureSqlText(sqlTextPane.getText()); - paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery); - List existParameterList = editorPane.update(); - Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[0]); - editorPane.populate(ParameterUtils.analyzeAndUnionParameters(paramTexts, ps)); + paramTexts[0] = SqlUtils.tryPureSqlText(this.sqlTextPane.getText()); + paramTexts[1] = SqlUtils.tryPureSqlText(this.pageQuery); + List existParameterList = this.editorPane.update(); + Parameter[] ps = (existParameterList == null) ? new Parameter[0] : (Parameter[]) existParameterList.toArray(new Parameter[0]); + + this.editorPane.populate(ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps)); } + private JToolBar createToolBar() { - // p:工具栏. ToolBarDef toolBarDef = new ToolBarDef(); toolBarDef.addShortCut(new PreviewAction()); toolBarDef.addShortCut(SeparatorDef.DEFAULT); toolBarDef.addShortCut(new EditPageQueryAction()); - dbTableDataMenuHandler = ExtraDesignClassManager.getInstance().getSingle(DBTableDataMenuHandler.MARK_STRING); - if (dbTableDataMenuHandler != null) { + this.dbTableDataMenuHandler = ExtraDesignClassManager.getInstance().getSingle("DBTableDataMenuHandler"); + if (this.dbTableDataMenuHandler != null) { toolBarDef.addShortCut(SeparatorDef.DEFAULT); - toolBarDef.addShortCut(dbTableDataMenuHandler.createQueryAction()); + toolBarDef.addShortCut(this.dbTableDataMenuHandler.createQueryAction()); } - isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Is_Share_DBTableData")); - isShareCheckBox.setBackground(Color.WHITE); - maxPanel = new MaxMemRowCountPanel(); - maxPanel.setBorder(null); + + UILabel esdSettingsLabel = new UILabel(Toolkit.i18nText("ESD_DBTableData-Pane-Cache-Settings")); + this.configFromList = new UIComboBox(ConfigFrom.values()); + this.esdEnabled = new UICheckBox(Toolkit.i18nText("ESD_DBTableData-Pane-Enable-Cache")); + this.barErrorTips = new UILabel(); + this.barErrorTips.setForeground(Color.RED); + this.barErrorTips.setVisible(false); + + esdSettingsBtn = new UIButton(Toolkit.i18nText("ESD_DBTableData-Pane-Strategy-Config")); + + esdSettingsBtn.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + final boolean global = (DBTableDataPane.this.configFromList.getSelectedIndex() == DBTableDataPane.ConfigFrom.GLOBAL.getIndex()); + + final ESDStrategyConfigPane strategyConfigPane = new ESDStrategyConfigPane(global); + + StrategyConfig populateStrategyConfig = null; + if (global) { + populateStrategyConfig = StrategyConfigHelper.getGlobalStrategyConfig(); + } else { + populateStrategyConfig = strategyConfig; + } + + //显示对应的配置 + strategyConfigPane.populateBean(populateStrategyConfig); + + BasicDialog dlg = strategyConfigPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + super.doOk(); + if (!global) { + //点击策略配置面板的确定,重新设置策略配置 + strategyConfig = strategyConfigPane.updateBean(); + } + } + }); + dlg.setAlwaysOnTop(true); + dlg.setVisible(true); + } + }); + + this.configFromList.setSelectedIndex(DBTableDataPane.ConfigFrom.GLOBAL.getIndex()); + this.configFromList.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + setEsdEnabled(); + } + }); + UIToolbar editToolBar = ToolBarDef.createJToolBar(); toolBarDef.updateToolBar(editToolBar); - editToolBar.add(isShareCheckBox); - editToolBar.add(maxPanel); + + editToolBar.add(esdSettingsLabel); + editToolBar.add(this.configFromList); + editToolBar.add(this.esdEnabled); + editToolBar.add(this.esdSettingsBtn); + editToolBar.add(this.barErrorTips); return editToolBar; } + + /* private void showBarError(String errorTips) { + this.barErrorTips.setText(errorTips); + this.barErrorTips.setVisible(true); + } + + private boolean checkQuery(String errorTips) { + if (StringUtils.isEmpty(this.sqlTextPane.getText())) { + showBarError(errorTips); + return false; + } + + return true; + }*/ + + + /** + * 设置是否开启 + */ + protected void setEsdEnabled() { + boolean useIndividualConfig = configFromList.getSelectedIndex() == ConfigFrom.INDIVIDUAL.getIndex(); + if (useIndividualConfig) { + if (this.strategyConfig == null) { + //新建的数据集,选择单独时,可用但是不勾选 + this.esdEnabled.setSelected(false); + this.esdEnabled.setEnabled(true); + } else { + this.esdEnabled.setSelected(!this.strategyConfig.isUseGlobal() && this.strategyConfig.enabled()); + this.esdEnabled.setEnabled(true); + } + } else { + this.esdEnabled.setSelected(DesignerStrategyConfigUtils.isEditingTemplateRecommended()); + this.esdEnabled.setEnabled(false); + } + } + + + public StrategyConfig updateStrategyConfig() { + return this.strategyConfig; + } + private void checkParameter() { String[] paramTexts = new String[2]; - paramTexts[0] = sqlTextPane.getText(); - paramTexts[1] = pageQuery; + paramTexts[0] = this.sqlTextPane.getText(); + paramTexts[1] = this.pageQuery; Parameter[] parameters = ParameterHelper.analyze4Parameters(paramTexts, false); - if (parameters.length < 1 && editorPane.update().size() < 1) { + if (parameters.length < 1 && this.editorPane.update().size() < 1) { return; } boolean isIn = true; - List list = editorPane.update(); - List name = new ArrayList(); - for (int i = 0; i < list.size(); i++) { - name.add(list.get(i).getName()); + List list = this.editorPane.update(); + List name = new ArrayList<>(); + for (ParameterProvider parameter : list) { + name.add(parameter.getName()); } - for (int i = 0; i < parameters.length; i++) { - if (!name.contains(parameters[i].getName())) { + for (Parameter parameter : parameters) { + if (!name.contains(parameter.getName())) { isIn = false; break; } @@ -269,115 +384,173 @@ public class DBTableDataPane extends AbstractTableDataPane { if (list.size() == parameters.length && isIn) { return; } - // bug:34175 删了是否刷新对话框, 均直接刷新 + refresh(); } + @Override - public void populateBean(DBTableData dbtabledata) { - this.dbTableData = dbtabledata; - if (dbTableDataMenuHandler != null) { - dbTableDataMenuHandler.populate(dbtabledata); + public void populateBean(DBTableData dbTableData) { + this.dbTableData = dbTableData; + if (this.dbTableDataMenuHandler != null) { + this.dbTableDataMenuHandler.populate(dbTableData); } - ParameterProvider[] parameters = null; + Calculator c = Calculator.createCalculator(); - parameters = dbtabledata.getParameters(c); - editorPane.populate(parameters); + ParameterProvider[] parameters = dbTableData.getParameters(c); + this.editorPane.populate(parameters); - com.fr.data.impl.Connection db = null; - String query = null; - boolean isShare = false; - int maxMemeryRow = -1; - db = dbtabledata.getDatabase(); - query = dbtabledata.getQuery(); - isShare = dbtabledata.isShare(); - maxMemeryRow = dbtabledata.getMaxMemRowCount(); - this.pageQuery = dbtabledata.getPageQuerySql(); + Connection db = dbTableData.getDatabase(); + String query = dbTableData.getQuery(); + boolean isShare = dbTableData.isShare(); + this.pageQuery = dbTableData.getPageQuerySql(); this.connectionTableProcedurePane.setSelectedDatabaseConnection(db); this.sqlTextPane.setText(query); this.sqlTextPane.requestFocus(); this.sqlTextPane.moveCaretPosition(this.sqlTextPane.getCaretPosition()); - isShareCheckBox.setSelected(isShare); - maxPanel.setValue(maxMemeryRow); + + //查找映射的配置 + this.strategyConfig = mapStrategyConfig(dbTableData); + + boolean shouldEnable = false; + ConfigFrom from = ConfigFrom.GLOBAL; + + if (this.strategyConfig != null) { + if (this.strategyConfig.enabled()) { + shouldEnable = true; + } + if (!this.strategyConfig.isUseGlobal()) { + from = ConfigFrom.INDIVIDUAL; + } + } + this.esdEnabled.setSelected(shouldEnable); + this.configFromList.setSelectedIndex(from.getIndex()); } - @Override + + protected StrategyConfig mapStrategyConfig(DBTableData dbTableData) { + //获取配置,如果是模版数据集,dbTableData实例应该是ESDBTableData,如果是服务器数据集是DBTableData + StrategyConfig strategyConfig = null; + if (dbTableData instanceof DBTableData) { + //设置保存数据集的事件检查钩子 + String tplPath = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath(); + + //新建模版此时不存在,不需要注册钩子 + if (((DBTableData) dbTableData).getXmlSavedHook() == null && WorkContext.getWorkResource().exist(tplPath)) { + ((DBTableData) dbTableData).setXmlSavedHook(new ESDBTableDataSavedHook(tplPath, (DBTableData) dbTableData)); + } + + //获取当前的缓存配置,没有就创建一份 + String dsName = ((DBTableData) this.dbTableData).getDsName(); + strategyConfig = DesignerStrategyConfigUtils.getStrategyConfig(dsName); + if (strategyConfig == null && dbTableData.isShare()) { + strategyConfig = StrategyConfigHelper.createStrategyConfig(true, false, true); + } + } + + return strategyConfig; + } + + public DBTableData updateBean() { + + updateDBTableData(); + + //这边只修改enable和useGlobal + boolean global = DBTableDataPane.this.configFromList.getSelectedIndex() == DBTableDataPane.ConfigFrom.GLOBAL.getIndex(); + boolean enable = DBTableDataPane.this.esdEnabled.isSelected(); + + + //未开启缓存的,如果选择了单独配置,需要创建配置 + if (this.strategyConfig == null && !global) { + this.strategyConfig = StrategyConfig.createDefault(); + } + + //设置配置来源和开启状态 + if (this.strategyConfig != null) { + this.strategyConfig.setEnable(enable); + this.strategyConfig.setUseGlobal(global); + } + + return this.dbTableData; + } + + + private void updateDBTableData() { String dbName = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(); if (StringUtils.isBlank(dbName) || StringUtils.isBlank(this.sqlTextPane.getText())) { try { - throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); - } catch (Exception ignore) { - // JOptionPane.showMessageDialog(DBTableDataPane.this, - // com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); + throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - // 保存前 刷新下参数列表 保证获取到最新的参数 - refresh(); - List parameterList = editorPane.update(); - Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]); + + + List parameterList = this.editorPane.update(); + ParameterProvider[] parameters = parameterList.toArray(new ParameterProvider[0]); dbTableData.setDatabase(new NameDatabaseConnection(dbName)); - // p:必须先设置Parameters数组,因为setQuery里面会自动设置的 dbTableData.setParameters(parameters); - dbTableData.setQuery(this.sqlTextPane.getText()); + dbTableData.setQuery(this.sqlTextPane.getText().trim()); - dbTableData.setShare(isShareCheckBox.isSelected()); - dbTableData.setMaxMemRowCount(maxPanel.getValue()); dbTableData.setPageQuerySql(this.pageQuery); - if (dbTableDataMenuHandler != null) { - dbTableDataMenuHandler.update(); + if (this.dbTableDataMenuHandler != null) { + this.dbTableDataMenuHandler.update(); } - return dbTableData; } protected class RefreshAction extends UITableEditAction { public RefreshAction() { - this.setName(REFRESH_BUTTON); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); + setName(REFRESH_BUTTON); + setSmallIcon(IOUtils.readIcon("/com/fr/design/images/control/refresh.png")); } + @Override public void actionPerformed(ActionEvent e) { - refresh(); + DBTableDataPane.this.refresh(); } + @Override public void checkEnabled() { - // do nothing } } - private class PreviewAction extends UpdateAction { + + private class PreviewAction + extends UpdateAction { public PreviewAction() { - this.setName(PREVIEW_BUTTON); - this.setMnemonic('P'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); + setName(PREVIEW_BUTTON); + setMnemonic('P'); + setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_file/preview.png")); } + @Override public void actionPerformed(ActionEvent evt) { - checkParameter(); + DBTableDataPane.this.checkParameter(); PreviewTablePane.previewTableData(DBTableDataPane.this.updateBean()); } } private class EditPageQueryAction extends UpdateAction { public EditPageQueryAction() { - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Page_Query")); + this.setName(Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Page_Query")); this.setMnemonic('L'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/text.png")); + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_file/text.png")); } @Override public void actionPerformed(ActionEvent e) { - final QueryPane pane = new QueryPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Define_Page_Query_SQL")); + final QueryPane pane = new QueryPane(Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Define_Page_Query_SQL")); pane.populate(pageQuery); BasicDialog dialog = pane.showWindow(DesignerContext.getDesignerFrame()); dialog.addDialogActionListener(new DialogActionAdapter() { @@ -391,9 +564,9 @@ public class DBTableDataPane extends AbstractTableDataPane { } } - private class QueryPane extends BasicPane { + private static class QueryPane extends BasicPane { private SQLEditPane pageQueryPane; - private String title; + private final String title; public QueryPane(String title) { this.title = title; @@ -410,21 +583,96 @@ public class DBTableDataPane extends AbstractTableDataPane { if (StringUtils.isBlank(text)) { return; } - pageQueryPane.setText(text); + this.pageQueryPane.setText(text); } public String update() { - String text = pageQueryPane.getText(); + String text = this.pageQueryPane.getText(); if (StringUtils.isBlank(text)) { return null; - } else { - return text; } + return text; } + @Override protected String title4PopupWindow() { - return title; + return this.title; + } + } + + + enum ConfigFrom { + GLOBAL(0, Toolkit.i18nText("ESD_DBTableData-Pane-Use-Global-Settings")), + + INDIVIDUAL(1, Toolkit.i18nText("ESD_DBTableData-Pane-Use-Individual-Settings")); + + int index; + + String displayText; + + ConfigFrom(int index, String displayText) { + this.index = index; + this.displayText = displayText; + } + + + static int parse(StrategyConfig config) { + return (config == null || config.isUseGlobal()) ? ConfigFrom.GLOBAL.getIndex() : ConfigFrom.INDIVIDUAL.getIndex(); + } + + public int getIndex() { + return this.index; + } + + + public String getDisplayText() { + return this.displayText; + } + + + public String toString() { + return getDisplayText(); + } + } + + + private static class ESDBTableDataSavedHook implements XMLSavedHook { + + private static final long serialVersionUID = 4925391747683335372L; + + private final String tplPath; + private String origName; + + private String origConnection; + + private String origQuery; + + public ESDBTableDataSavedHook(String tplPath, DBTableData origESDBTableData) { + this.tplPath = tplPath; + this.origName = origESDBTableData.getDsName(); + this.origConnection = origESDBTableData.getDatabase().toString(); + this.origQuery = origESDBTableData.getQuery(); + } + + @Override + public void doAfterSaved(DBTableData saved) { + String dsName = saved.getDsName(); + String conn = saved.getDatabase().toString(); + String query = saved.getQuery(); + + + //检查数据集名称、数据链接和sql是否修改,如果修改需要触发缓存监听事件 + if (!dsName.equals(origName) || !conn.equals(origConnection) || !query.equals(origQuery)) { + if (StringUtils.isNotEmpty(tplPath) && StringUtils.isNotEmpty(origName)) { + //新建数据集的origName为null,不用触发 + StrategyEventsNotifier.modifyDataSet(new DSMapping(tplPath, new DsNameTarget(origName))); + } + } + + this.origName = dsName; + this.origConnection = conn; + this.origQuery = query; } } } diff --git a/designer-base/src/main/resources/com/fr/design/images/control/batch_esd_off.png b/designer-base/src/main/resources/com/fr/design/images/control/batch_esd_off.png new file mode 100644 index 0000000000000000000000000000000000000000..0e8dce8ef46af092cfcda164b98272aea1af7078 GIT binary patch literal 1286 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6-PsS%!O zzP=1vKsE;hE29ttGmymygba*Q3?LOi7K0a~G@Kp8r~y^O#K6#=$-n|t69uF}zypXu zdLT5@0w%Z$fd$M6Hb`m5@+r|?L9&C18K8MsJ85o%Md%8G=SP1$CpY;w26xko2&z4?tDrjb!+u8zk-ZShX zTxyONgSQcUttTcK&$g{^ zEdH-`Mdpgd56(@>Pt@yXKS<3!`q}I0=c0tRg|Q0r&)YZDg>xKS!~1HhCI2CfS;qI( zCwxm>8M4cL>Pm*wPmB2Glxkk}T)WkqZ`0%KkBhrbgm|?IerA5OvS{ZUPp(zhU#m^@ zSo33_ZM)N7j!8})6MlHR8%@wWGNtu_dBX$kr&@nEm4N4GZW{cG!lvI6-PsS%!O zzP=1vKsE;hE29ttGmymygba*Q3?LOi7K0a~G@Kp8r~y^O#K6#=$-n|t69uF}zypXu zdLT5@0w%Z$fd$M6Hb`m5@+r|?L9&C18K8MsJ85o$hc)B=-SO~@jduIqcO5B@y_f3+}+O2^(J#SUJgrqWs z0;DfaesFN|H>D;yo2qW{rT4C6JFb^wt)8gG(InTZvbEA=3Y)&2##EQ3QSzRfPrf_z z7kNy*@QWTTX9d--h0wVHt-co^33XLT6yK8 zaL>ue8JRPFZ+xd{AGGiBXUS|=&3{XxYBw*rTfoC;H1kaCjp8}Q&YHdEF*E%Z=cIXf zs$AV$w6kXR1kM8<%P%vs%wCq+`*Yv@r3^m}*|OyY)pbu7P58`v`=i&=M>D5f$uV;^ zk&2xb7TselNAjzcHGJli^_=RQafJ*IA>Jl*Hqp4eF3nyVt4Z@%%n{`Q|sf$(QRxv+p!e-7=;IcQch z|E+GNW3kR7Ts*MV88g5;)r4uu}sgVTV{Kw1Y2%2dduDF z#MdKs_410VS@r@Ehi-2@CE&@(kRE7KFg?iTn@yR93|}LseH-^YZpHZ%f3V~RT)t73 zAo+do@tvMK+zfOtBzc`=cz7d{rVeTIxDPqJTO^6 zn@`rSk(I?*{(-{9`ESdrQ?txA72fnc!yVQ9_U!^`zVgcqm7KcQ4({pUDVb-)#Q1oz zUw9U`xa_;HRqK~6PhV!Uerww8b9rYKF6mG6Ka}WWbWES=g%v|GgR}Q*!)KLpQ$PJV z<&`L#zuEH~K`o$l Date: Wed, 13 Jan 2021 09:27:42 +0800 Subject: [PATCH 053/147] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E7=9A=84=E6=96=B9=E6=B3=95=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=90=88=E5=B9=B6=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/designer/beans/LayoutAdapter.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java index fded86cbe..e2aa7f152 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java @@ -43,18 +43,6 @@ public interface LayoutAdapter { boolean addBean(XCreator creator, int x, int y); - /** - * 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 - * addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 - * - * @param creator 被添加的新组件 - * @param x 添加的位置x,该位置是相对于container的 - * @param y 添加的位置y,该位置是相对于container的 - * @param accept 是否添加新组件 - * @return 是否添加成功,成功返回true,否则false - */ - boolean addBean(XCreator creator, int x, int y, boolean accept); - /** * 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 * addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 From e2dd63a1026c7558b8420df151c07b12419f74f5 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 13 Jan 2021 10:56:26 +0800 Subject: [PATCH 054/147] =?UTF-8?q?REPORT-46971=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF-=E6=99=AE=E9=80=9A=E6=8A=A5=E8=A1=A8&?= =?UTF-8?q?=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8-=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF-=E6=8F=92=E4=BB=B6=E7=B1=BB=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E5=8F=B3=E4=BE=A7=E7=AC=AC=E5=9B=9B=E4=B8=AAtab?= =?UTF-8?q?=E9=A1=B5=E6=82=AC=E6=B5=AE=E6=97=B6=E5=92=8C=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=B8=8A=E6=96=B9=E5=9D=87=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E2=80=9C=E7=BB=84=E4=BB=B6=E8=AE=BE=E7=BD=AE=E2=80=9D=EF=BC=8C?= =?UTF-8?q?=E5=BA=94=E2=80=9C=E6=8E=A7=E4=BB=B6=E8=AE=BE=E7=BD=AE=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/widget/ui/FormWidgetCardPane.java | 14 ++++++++++++++ .../ui/WidgetBasicPropertyPaneFactory.java | 16 ---------------- 2 files changed, 14 insertions(+), 16 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 8267c53b8..4ab3fdb74 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,13 +14,16 @@ 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.HistoryTemplateListCache; 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.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.JForm; import com.fr.design.widget.DataModify; import com.fr.design.widget.FormWidgetDefinePaneFactoryBase; import com.fr.design.widget.Operator; @@ -147,6 +150,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { } }; + freshPropertyMode(innerCreator); if (isExtraWidget) { return; } @@ -159,6 +163,16 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { } + private static void freshPropertyMode(XCreator xCreator) { + if (!(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() instanceof JForm)) { + if (xCreator instanceof XWParameterLayout) { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA); + } else { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA_WIDGET); + } + } + } + private void initDefinePane() { currentEditorDefinePane = null; XCreator creator = getXCreatorDedicated(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java index a3a34a061..081ca1476 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java @@ -1,10 +1,6 @@ package com.fr.design.mainframe.widget.ui; import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XWParameterLayout; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.mainframe.EastRegionContainerPane; -import com.fr.design.mainframe.JForm; /** * Created by kerry on 2017/9/30. @@ -12,7 +8,6 @@ import com.fr.design.mainframe.JForm; public class WidgetBasicPropertyPaneFactory { public static FormBasicPropertyPane createBasicPropertyPane(XCreator xCreator) { - freshPropertyMode(xCreator); if (xCreator.supportSetVisible() && xCreator.supportSetEnable()) { return new FormBasicWidgetPropertyPane(); } @@ -23,15 +18,4 @@ public class WidgetBasicPropertyPaneFactory { } } - - private static void freshPropertyMode(XCreator xCreator) { - if (!(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() instanceof JForm)) { - if (xCreator instanceof XWParameterLayout) { - EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA); - } else { - EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA_WIDGET); - } - } - } - } From 41ec46537ce98f80f38f5103cb63004532306eb6 Mon Sep 17 00:00:00 2001 From: lucian Date: Wed, 13 Jan 2021 14:32:40 +0800 Subject: [PATCH 055/147] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95=E8=AF=AF=E5=B1=8F?= =?UTF-8?q?=E8=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/extra/PluginOperateUtilsTest.java | 310 +++++++++--------- 1 file changed, 155 insertions(+), 155 deletions(-) diff --git a/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java b/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java index edcde5d11..bc81cb2c3 100644 --- a/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java +++ b/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java @@ -1,155 +1,155 @@ -//package com.fr.design.extra; -// -//import com.fr.invoke.Reflect; -//import com.fr.json.JSONObject; -//import com.fr.plugin.context.PluginContext; -//import com.fr.plugin.context.PluginMarker; -//import com.fr.plugin.context.PluginMarkerAdapter; -//import com.fr.plugin.error.PluginErrorCode; -//import com.fr.plugin.manage.PluginManager; -//import com.fr.plugin.manage.control.PluginTask; -//import com.fr.plugin.manage.control.PluginTaskResult; -//import org.easymock.EasyMock; -//import org.junit.Assert; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -// -//import java.util.ArrayList; -//import java.util.List; -// -///** -// * @author Lucian.Chen -// * @version 10.0 -// * Created by Lucian.Chen on 2020/12/17 -// */ -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({PluginManager.class, PluginUtils.class}) -//public class PluginOperateUtilsTest { -// -// @Test -// public void testGetSuccessInfo() { -// PluginTaskResult pluginTaskResult = EasyMock.mock(PluginTaskResult.class); -// PluginTaskResult pluginTaskResult1 = EasyMock.mock(PluginTaskResult.class); -// PluginTaskResult pluginTaskResult2 = EasyMock.mock(PluginTaskResult.class); -// -// List pluginTaskResults1 = new ArrayList<>(); -// pluginTaskResults1.add(pluginTaskResult1); -// List pluginTaskResults2 = new ArrayList<>(); -// pluginTaskResults2.add(pluginTaskResult1); -// pluginTaskResults2.add(pluginTaskResult2); -// -// PluginMarker pluginMarker1 = PluginMarker.create("plugin-1", "1.0"); -// PluginMarker pluginMarker2 = PluginMarkerAdapter.create("plugin-2", "2.0", "name-2"); -// PluginTask pluginTask1 = PluginTask.installTask(pluginMarker1); -// PluginTask pluginTask2 = PluginTask.installTask(pluginMarker2); -// -// EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults1).times(2); -// EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults2).times(2); -// EasyMock.expect(pluginTaskResult1.getCurrentTask()).andReturn(pluginTask1).anyTimes(); -// EasyMock.expect(pluginTaskResult2.getCurrentTask()).andReturn(pluginTask2).anyTimes(); -// -// EasyMock.expect(pluginTaskResult1.errorCode()).andReturn(PluginErrorCode.BelowSystem).anyTimes(); -// EasyMock.expect(pluginTaskResult2.errorCode()).andReturn(PluginErrorCode.BeyondSystem).anyTimes(); -// -// PluginContext plugin1 = EasyMock.mock(PluginContext.class); -// PluginContext plugin2 = EasyMock.mock(PluginContext.class); -// EasyMock.expect(plugin1.getName()).andReturn("context-1").anyTimes(); -// EasyMock.expect(plugin2.getName()).andReturn("context-2").anyTimes(); -// PowerMock.mockStatic(PluginManager.class); -// EasyMock.expect(PluginManager.getContext(pluginMarker1.getPluginID())) -// .andReturn(plugin1).once().andReturn(null).once().andReturn(plugin1).once().andReturn(null).once(); -// EasyMock.expect(PluginManager.getContext(pluginMarker2.getPluginID())) -// .andReturn(plugin2).once().andReturn(null).once(); -// -// EasyMock.replay(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); -// PowerMock.replayAll(); -// -// // 1个 -// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem"); -// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem"); -// -// -// // 2个 -// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem\ncontext-2Fine-Core_Plugin_Error_BeyondSystem"); -// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem\nname-2Fine-Core_Plugin_Error_BeyondSystem"); -// -// EasyMock.verify(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); -// PowerMock.verifyAll(); -// -// } -// -// -// @Test -// public void testGetPluginName() { -// PluginContext pluginContext = EasyMock.mock(PluginContext.class); -// EasyMock.expect(pluginContext.getName()).andReturn("pluginContext").once(); -// -// PluginMarker pluginMarker1 = PluginMarker.create("id-1", "1"); -// PluginMarker pluginMarker2 = PluginMarkerAdapter.create("id-2", "2", "name-2"); -// -// EasyMock.replay(pluginContext); -// -// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, null).get(), ""); -// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", pluginContext, pluginMarker1).get(), "pluginContext"); -// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker1).get(), "id-1"); -// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker2).get(), "name-2"); -// -// EasyMock.verify(pluginContext); -// } -// -// @Test -// public void testUpdateMarker2Online() { -// -// try { -// PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); -// String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; -// JSONObject object = new JSONObject(pluginJson); -// -// PowerMock.mockStatic(PluginUtils.class); -// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); -// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andThrow(new NullPointerException()).once(); -// -// PowerMock.replayAll(); -// -// PluginMarker marker1 = PluginOperateUtils.updateMarker2Online(pluginMarker); -// PluginMarker marker2 = PluginOperateUtils.updateMarker2Online(pluginMarker); -// -// Assert.assertTrue(marker1 instanceof PluginMarkerAdapter); -// Assert.assertEquals(marker1.getPluginID(), "plugin-1"); -// Assert.assertEquals(marker1.getVersion(), "1.0"); -// Assert.assertEquals(((PluginMarkerAdapter) marker1).getPluginName(), "图表(新特性)"); -// Assert.assertEquals(marker2, pluginMarker); -// -// PowerMock.verifyAll(); -// } catch (Exception e) { -// Assert.fail(); -// } -// -// } -// -// -// @Test -// public void testUpdatePluginOnline() { -// try { -// PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); -// String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; -// JSONObject object = new JSONObject(pluginJson); -// -// PowerMock.mockStatic(PluginUtils.class); -// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); -// EasyMock.expect(PluginUtils.getInstalledPluginMarkerByID("plugin-1")).andReturn(pluginMarker).once(); -// -// PowerMock.replayAll(); -// -// PluginOperateUtils.updatePluginOnline(pluginMarker, null); -// -// PowerMock.verifyAll(); -// } catch (Exception e) { -// Assert.fail(); -// } -// } -// -//} +package com.fr.design.extra; + +import com.fr.invoke.Reflect; +import com.fr.json.JSONObject; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.context.PluginMarker; +import com.fr.plugin.context.PluginMarkerAdapter; +import com.fr.plugin.error.PluginErrorCode; +import com.fr.plugin.manage.PluginManager; +import com.fr.plugin.manage.control.PluginTask; +import com.fr.plugin.manage.control.PluginTaskResult; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2020/12/17 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest({PluginManager.class, PluginUtils.class}) +public class PluginOperateUtilsTest { + + @Test + public void testGetSuccessInfo() { + PluginTaskResult pluginTaskResult = EasyMock.mock(PluginTaskResult.class); + PluginTaskResult pluginTaskResult1 = EasyMock.mock(PluginTaskResult.class); + PluginTaskResult pluginTaskResult2 = EasyMock.mock(PluginTaskResult.class); + + List pluginTaskResults1 = new ArrayList<>(); + pluginTaskResults1.add(pluginTaskResult1); + List pluginTaskResults2 = new ArrayList<>(); + pluginTaskResults2.add(pluginTaskResult1); + pluginTaskResults2.add(pluginTaskResult2); + + PluginMarker pluginMarker1 = PluginMarker.create("plugin-1", "1.0"); + PluginMarker pluginMarker2 = PluginMarkerAdapter.create("plugin-2", "2.0", "name-2"); + PluginTask pluginTask1 = PluginTask.installTask(pluginMarker1); + PluginTask pluginTask2 = PluginTask.installTask(pluginMarker2); + + EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults1).times(2); + EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults2).times(2); + EasyMock.expect(pluginTaskResult1.getCurrentTask()).andReturn(pluginTask1).anyTimes(); + EasyMock.expect(pluginTaskResult2.getCurrentTask()).andReturn(pluginTask2).anyTimes(); + + EasyMock.expect(pluginTaskResult1.errorCode()).andReturn(PluginErrorCode.BelowSystem).anyTimes(); + EasyMock.expect(pluginTaskResult2.errorCode()).andReturn(PluginErrorCode.BeyondSystem).anyTimes(); + + PluginContext plugin1 = EasyMock.mock(PluginContext.class); + PluginContext plugin2 = EasyMock.mock(PluginContext.class); + EasyMock.expect(plugin1.getName()).andReturn("context-1").anyTimes(); + EasyMock.expect(plugin2.getName()).andReturn("context-2").anyTimes(); + PowerMock.mockStatic(PluginManager.class); + EasyMock.expect(PluginManager.getContext(pluginMarker1.getPluginID())) + .andReturn(plugin1).once().andReturn(null).once().andReturn(plugin1).once().andReturn(null).once(); + EasyMock.expect(PluginManager.getContext(pluginMarker2.getPluginID())) + .andReturn(plugin2).once().andReturn(null).once(); + + EasyMock.replay(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); + PowerMock.replayAll(); + + // 1个 + Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem"); + Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem"); + + + // 2个 + Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem\ncontext-2Fine-Core_Plugin_Error_BeyondSystem"); + Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem\nname-2Fine-Core_Plugin_Error_BeyondSystem"); + + EasyMock.verify(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); + PowerMock.verifyAll(); + + } + + + @Test + public void testGetPluginName() { + PluginContext pluginContext = EasyMock.mock(PluginContext.class); + EasyMock.expect(pluginContext.getName()).andReturn("pluginContext").once(); + + PluginMarker pluginMarker1 = PluginMarker.create("id-1", "1"); + PluginMarker pluginMarker2 = PluginMarkerAdapter.create("id-2", "2", "name-2"); + + EasyMock.replay(pluginContext); + + Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, null).get(), ""); + Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", pluginContext, pluginMarker1).get(), "pluginContext"); + Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker1).get(), "id-1"); + Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker2).get(), "name-2"); + + EasyMock.verify(pluginContext); + } + + @Test + public void testUpdateMarker2Online() { + + try { + PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); + String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; + JSONObject object = new JSONObject(pluginJson); + + PowerMock.mockStatic(PluginUtils.class); + EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); + EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andThrow(new NullPointerException()).once(); + + PowerMock.replayAll(); + + PluginMarker marker1 = PluginOperateUtils.updateMarker2Online(pluginMarker); + PluginMarker marker2 = PluginOperateUtils.updateMarker2Online(pluginMarker); + + Assert.assertTrue(marker1 instanceof PluginMarkerAdapter); + Assert.assertEquals(marker1.getPluginID(), "plugin-1"); + Assert.assertEquals(marker1.getVersion(), "1.0"); + Assert.assertEquals(((PluginMarkerAdapter) marker1).getPluginName(), "图表(新特性)"); + Assert.assertEquals(marker2, pluginMarker); + + PowerMock.verifyAll(); + } catch (Exception e) { + Assert.fail(); + } + + } + + + @Test + public void testUpdatePluginOnline() { + try { + PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); + String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; + JSONObject object = new JSONObject(pluginJson); + + PowerMock.mockStatic(PluginUtils.class); + EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); + EasyMock.expect(PluginUtils.getInstalledPluginMarkerByID("plugin-1")).andReturn(pluginMarker).once(); + + PowerMock.replayAll(); + + PluginOperateUtils.updatePluginOnline(pluginMarker, null); + + PowerMock.verifyAll(); + } catch (Exception e) { + Assert.fail(); + } + } + +} From 34176eda19142873551c92b73a1ef3d6fe194404 Mon Sep 17 00:00:00 2001 From: Lanlan Date: Thu, 14 Jan 2021 09:36:22 +0800 Subject: [PATCH 056/147] =?UTF-8?q?REPORT-46953=20GeneralXMLTools=20?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/module/DesignerActivator.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 495252e38..3f1aa2663 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -99,7 +99,6 @@ import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.CellImagePainter; import com.fr.stable.ArrayUtils; -import com.fr.stable.EssentialUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; import com.fr.stable.os.support.OSBasedAction; @@ -192,8 +191,8 @@ public class DesignerActivator extends Activator { justStartModules4Designer(); CalculatorProviderContext.setValueConverter(valueConverter()); - EssentialUtils.Object_Tokenizer = startXMLReadObjectTokenizer(); - EssentialUtils.Object_XML_Writer_Finder = startObjectXMLWriterFinder(); + GeneralXMLTools.Object_Tokenizer = startXMLReadObjectTokenizer(); + GeneralXMLTools.Object_XML_Writer_Finder = startObjectXMLWriterFinder(); addAdapterForPlate(); designerRegister(); From 6a3c3604cac33c8d128e8b2a66535191e6e7fc88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Fri, 15 Jan 2021 13:36:54 +0800 Subject: [PATCH 057/147] =?UTF-8?q?CHART-15837=20feature=E2=86=92release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractCustomFieldComboBoxPane.java | 6 +- .../chart/gui/data/CalculateComboBox.java | 102 +++++++++--------- .../table/SeriesNameUseFieldNamePane.java | 2 +- 3 files changed, 57 insertions(+), 53 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java index 16f983c75..562393699 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java @@ -23,13 +23,13 @@ import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import java.util.ArrayList; +import java.util.List; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.ArrayList; -import java.util.List; /** * Created by shine on 2018/9/12. @@ -253,7 +253,7 @@ public abstract class AbstractCustomFieldComboBoxPane extends BasicBeanPane= 0 && selectIndex < CLASS_ARRAY.length) { - return (AbstractDataFunction)CLASS_ARRAY[selectIndex].newInstance(); - } - } catch (InstantiationException e) { - FineLoggerFactory.getLogger().error("Function Error"); - return null; - } catch (IllegalAccessException e) { - FineLoggerFactory.getLogger().error("Function Error"); - return null; - } - - return null; - } + public static final String[] CALCULATE_ARRAY = {Toolkit.i18nText("Fine-Design_Chart_Data_Function_First"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Last"), + Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Average"), + Toolkit.i18nText("Fine-Design_Chart_Data_Function_Max"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Min"), + Toolkit.i18nText("Fine-Design_Chart_Data_Function_Count")}; + public static final Class[] CLASS_ARRAY = {FirstFunction.class, NoneFunction.class, SumFunction.class, AverageFunction.class, + MaxFunction.class, MinFunction.class, CountFunction.class}; + + public CalculateComboBox() { + super(CALCULATE_ARRAY); + setSelectedIndex(2); + } + + public void reset() { + this.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum")); + } + + /** + * 更新公式选择. + */ + public void populateBean(AbstractDataFunction function) { + for (int i = 0; i < CLASS_ARRAY.length; i++) { + if (function != null && ComparatorUtils.equals(function.getClass(), CLASS_ARRAY[i])) { + setSelectedIndex(i); + break; + } + } + } + + /** + * 返回当前选择的公式 + */ + public AbstractDataFunction updateBean() { + try { + int selectIndex = getSelectedIndex(); + if (selectIndex >= 0 && selectIndex < CLASS_ARRAY.length) { + return (AbstractDataFunction) CLASS_ARRAY[selectIndex].newInstance(); + } + } catch (InstantiationException e) { + FineLoggerFactory.getLogger().error("Function Error"); + return null; + } catch (IllegalAccessException e) { + FineLoggerFactory.getLogger().error("Function Error"); + return null; + } + + return null; + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java index 3f5f70aae..9783c0577 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java @@ -70,7 +70,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane Date: Mon, 18 Jan 2021 14:33:46 +0800 Subject: [PATCH 058/147] =?UTF-8?q?=09CHART-17941=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/designer/style/series/VanChartMapAnchorMarkerPane.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java index 745c3a79a..c7ddda38b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java @@ -10,6 +10,7 @@ import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.marker.type.MarkerType; import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; @@ -35,6 +36,7 @@ public class VanChartMapAnchorMarkerPane extends BasicBeanPane Date: Mon, 21 Dec 2020 09:56:30 +0800 Subject: [PATCH 059/147] =?UTF-8?q?=E5=BC=80=E5=8F=91=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=AD=97=E6=AE=B5=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 44 +++++- .../richText/VanChartFieldAddPane.java | 124 +++++++++++++++ .../richText/VanChartFieldGroupPane.java | 115 ++++++++++++++ .../richText/VanChartFieldListener.java | 15 ++ .../VanChartRichEditorPane.java | 2 +- .../VanChartRichTextDialog.java} | 8 +- .../richText/VanChartRichTextPane.java | 144 ++++++++++++++++++ 7 files changed, 441 insertions(+), 11 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAddPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java rename designer-chart/src/main/java/com/fr/van/chart/designer/component/{ => richText}/VanChartRichEditorPane.java (99%) rename designer-chart/src/main/java/com/fr/van/chart/designer/component/{VanChartRichEditorDialog.java => richText/VanChartRichTextDialog.java} (73%) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index b5f03a728..b6e768e34 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -2,6 +2,7 @@ package com.fr.van.chart.designer.component; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -32,7 +33,11 @@ import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; +import com.fr.van.chart.designer.component.richText.VanChartRichTextDialog; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; +import org.nfunk.jep.function.Str; import javax.swing.JComponent; import javax.swing.JPanel; @@ -45,6 +50,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; /** * 数据点提示内容界面,含有通用设置、富文本编辑器、自定义JS界面 @@ -437,24 +444,27 @@ public class VanChartTooltipContentPane extends BasicBeanPane pane = VanChartRichEditorPane.createRichEditorPane(richText); - BasicDialog dialog = new VanChartRichEditorDialog(DesignerContext.getDesignerFrame(), pane); + final ModernUIPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - pane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); + BasicPane panel = new VanChartRichTextPane(parent, getDefaultFieldNames(), getTableFieldNames(), richEditorPane); + + BasicDialog dialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), panel); + + richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); dialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { - VanChartRichEditorPane.RichEditorModel model = pane.update(); + VanChartRichEditorPane.RichEditorModel model = richEditorPane.update(); String content = model.getContent(); updateLocalRichText(content, model.isAuto()); - SwingUtilities.getWindowAncestor(pane).setVisible(false); + SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false); } public void doCancel() { - SwingUtilities.getWindowAncestor(pane).setVisible(false); + SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false); } }); @@ -465,6 +475,28 @@ public class VanChartTooltipContentPane extends BasicBeanPane getDefaultFieldNames() { + List fieldNames = new ArrayList<>(); + + fieldNames.add("分类"); + fieldNames.add("系列"); + fieldNames.add("值"); + fieldNames.add("百分比"); + + return fieldNames; + } + + private List getTableFieldNames() { + List fieldNames = new ArrayList<>(); + + fieldNames.add("字段A"); + fieldNames.add("字段B"); + fieldNames.add("字段C"); + fieldNames.add("字段D"); + + return fieldNames; + } + private JPanel createHtmlPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAddPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAddPane.java new file mode 100644 index 000000000..dd34a2a7f --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAddPane.java @@ -0,0 +1,124 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.base.BaseUtils; +import com.fr.data.util.function.DataFunction; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.Icon; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.text.Format; + +public class VanChartFieldAddPane extends JPanel { + + private static final Icon ADD_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"); + + private static final int W = 200; + private static final int H = 28; + + private UIToggleButton fieldButton; + private UIButton addButton; + + private Format format; + private DataFunction dataFunction; + + private String fieldName; + private boolean showSummary; + + public VanChartFieldAddPane(String fieldName, VanChartFieldListener listener) { + this(fieldName, false, listener); + } + + public VanChartFieldAddPane(String fieldName, boolean showSummary, VanChartFieldListener listener) { + this.fieldName = fieldName; + this.showSummary = showSummary; + + initComponents(fieldName, listener); + + this.setLayout(new BorderLayout()); + this.add(getContentPane(), BorderLayout.CENTER); + } + + public String getFieldName() { + return fieldName; + } + + public Format getFormat() { + return format; + } + + public void setFormat(Format format) { + this.format = format; + } + + public DataFunction getDataFunction() { + return dataFunction; + } + + public void setDataFunction(DataFunction dataFunction) { + this.dataFunction = dataFunction; + } + + public boolean isShowSummary() { + return showSummary; + } + + private void initComponents(String fieldName, VanChartFieldListener listener) { + fieldButton = new UIToggleButton(fieldName) { + + protected MouseListener getMouseListener() { + + return new MouseAdapter() { + public void mousePressed(MouseEvent e) { + setSelected(true); + + listener.refreshSelectedField(fieldName); + listener.setGlobalName(fieldName); + } + }; + } + }; + + addButton = new UIButton(ADD_ICON); + + addButton.addMouseListener(new MouseAdapter() { + + public void mousePressed(MouseEvent e) { + super.mousePressed(e); + + listener.addSelectedField(fieldName); + } + }); + } + + private JPanel getContentPane() { + Component[][] components = new Component[][]{ + new Component[]{fieldButton, addButton} + }; + + double p = TableLayout.PREFERRED; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; + + double[] rowSize = {p}; + double[] columnSize = {e, d}; + + JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 5, 0); + content.setPreferredSize(new Dimension(W, H)); + + return content; + } + + public void setSelectedState(boolean selected) { + fieldButton.setSelected(selected); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java new file mode 100644 index 000000000..5e80aa78c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java @@ -0,0 +1,115 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.general.ComparatorUtils; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.util.ArrayList; +import java.util.List; + +public class VanChartFieldGroupPane extends JPanel { + + private static final int FIELD_ADD_W = 400; + private static final int FIELD_ADD_H = 28; + + private List defaultFieldNameList; + private List tableFieldNameList; + + private List defaultFieldPaneList = new ArrayList<>(); + private List tableFieldPaneList = new ArrayList<>(); + + private VanChartFieldListener fieldListener; + + public VanChartFieldGroupPane(List defaultFieldNameList, List tableFieldNameList) { + this.defaultFieldNameList = defaultFieldNameList; + this.tableFieldNameList = tableFieldNameList; + + initFieldListener(); + + this.setLayout(new BorderLayout()); + + this.add(createDefaultFieldPane(), BorderLayout.CENTER); + this.add(createTableFieldPane(), BorderLayout.SOUTH); + } + + private JPanel createDefaultFieldPane() { + JPanel defaultField = new JPanel(); + + defaultField.setLayout(new GridLayout(0, 1, 1, 0)); + + for (String title : defaultFieldNameList) { + VanChartFieldAddPane fieldAddPane = new VanChartFieldAddPane(title, fieldListener); + + defaultField.add(fieldAddPane); + defaultFieldPaneList.add(fieldAddPane); + } + + defaultField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldNameList.size() * FIELD_ADD_H)); + defaultField.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); + + return defaultField; + } + + private JPanel createTableFieldPane() { + JPanel tableField = new JPanel(); + + tableField.setLayout(new GridLayout(0, 1, 1, 0)); + + for (String title : tableFieldNameList) { + VanChartFieldAddPane fieldAddPane = new VanChartFieldAddPane(title, fieldListener); + + tableField.add(fieldAddPane); + tableFieldPaneList.add(fieldAddPane); + } + + tableField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldNameList.size() * FIELD_ADD_H)); + + return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); + } + + private void initFieldListener() { + + fieldListener = new VanChartFieldListener() { + + private String fieldName; + + public void setGlobalName(String fieldName) { + this.fieldName = fieldName; + } + + public String getGlobalName() { + return this.fieldName; + } + + public void refreshSelectedField(String fieldName) { + if (ComparatorUtils.equals(fieldName, this.fieldName)) { + return; + } + + for (VanChartFieldAddPane fieldAddPane : defaultFieldPaneList) { + fieldAddPane.setSelectedState(ComparatorUtils.equals(fieldAddPane.getFieldName(), fieldName)); + } + + for (VanChartFieldAddPane fieldAddPane : tableFieldPaneList) { + fieldAddPane.setSelectedState(ComparatorUtils.equals(fieldAddPane.getFieldName(), fieldName)); + } + } + + public void addSelectedField(String fieldName) { + System.out.println(fieldName); + } + + public void populateFieldFormatPane() { + + } + + public void updateFieldFormatPane() { + + } + }; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java new file mode 100644 index 000000000..738492d67 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java @@ -0,0 +1,15 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.design.event.GlobalNameListener; + +public interface VanChartFieldListener extends GlobalNameListener { + + public void refreshSelectedField(String fieldName); + + public void addSelectedField(String fieldName); + + public void populateFieldFormatPane(); + + public void updateFieldFormatPane(); + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java similarity index 99% rename from designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java rename to designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java index 6f308ad43..66453a157 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java @@ -1,4 +1,4 @@ -package com.fr.van.chart.designer.component; +package com.fr.van.chart.designer.component.richText; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java similarity index 73% rename from designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java rename to designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java index a13208df5..2cf7050dc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java @@ -1,4 +1,4 @@ -package com.fr.van.chart.designer.component; +package com.fr.van.chart.designer.component.richText; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; @@ -8,17 +8,17 @@ import com.fr.design.utils.gui.GUICoreUtils; import java.awt.Dimension; import java.awt.Frame; -public class VanChartRichEditorDialog extends BasicDialog { +public class VanChartRichTextDialog extends BasicDialog { public static final Dimension DEFAULT = new Dimension(960, 600); - public VanChartRichEditorDialog(Frame parent, BasicPane pane) { + public VanChartRichTextDialog(Frame parent, BasicPane pane) { super(parent, pane); this.setTitle(Toolkit.i18nText("Fine-Design_Report_RichTextEditor")); this.setBasicDialogSize(DEFAULT); GUICoreUtils.centerWindow(this); - this.setResizable(true); + this.setResizable(false); this.setModal(true); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java new file mode 100644 index 000000000..927fbdaae --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -0,0 +1,144 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.style.FormatPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.stable.StringUtils; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.util.List; + +// 标签提示中的富文本面板,包含字段设置和富文本编辑器 +public class VanChartRichTextPane extends BasicBeanPane { + + private static final int FIELD_PANE_W = 470; + private static final int FIELD_PANE_H = 270; + + private static final int RICH_EDITOR_W = 940; + private static final int RICH_EDITOR_H = 260; + + private static final double P = TableLayout.PREFERRED; + private static final double D = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; + private static final double E = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + + private JScrollPane fieldContentPane; + private JScrollPane fieldPropsPane; + + private FormatPane fieldFormatPane; + private JPanel fieldSummaryPane; + + private UIComboBox fieldSummaryBox; + + private VanChartStylePane parent; + + private List defaultFieldsFormat; + private List tableFieldsFormat; + + public VanChartRichTextPane(VanChartStylePane parent, List defaultFieldsFormat, List tableFieldsFormat, JPanel richEditor) { + this.parent = parent; + + this.defaultFieldsFormat = defaultFieldsFormat; + this.tableFieldsFormat = tableFieldsFormat; + + initFieldContentPane(); + initFieldPropsPane(); + + this.setLayout(new BorderLayout()); + this.add(createFieldDetailPane(), BorderLayout.CENTER); + this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH); + } + + private void initFieldContentPane() { + JPanel content = new JPanel(); + content.setLayout(new BorderLayout()); + content.add(createDefaultContentPane(), BorderLayout.NORTH); + content.add(createTableFieldsPane(), BorderLayout.CENTER); + + fieldContentPane = new JScrollPane(content); + fieldContentPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); + fieldContentPane.setHorizontalScrollBar(null); + fieldContentPane.setBorder(BorderFactory.createTitledBorder("添加字段")); + } + + private void initFieldPropsPane() { + fieldFormatPane = new FormatPaneWithOutFont() { + protected JPanel createContentPane(Component[][] components) { + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{P, P, P}, new double[]{D, E}); + } + }; + + fieldSummaryBox = new CalculateComboBox(); + + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), fieldSummaryBox} + }; + + fieldSummaryPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{P, P}, new double[]{D, E}); + + JPanel props = new JPanel(); + props.setLayout(new BorderLayout()); + props.add(fieldFormatPane, BorderLayout.NORTH); + props.add(fieldSummaryPane, BorderLayout.CENTER); + props.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); + + fieldPropsPane = new JScrollPane(props); + fieldPropsPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); + fieldPropsPane.setBorder(BorderFactory.createTitledBorder("字段设置")); + } + + private JPanel createDefaultContentPane() { + + return new VanChartFieldGroupPane(defaultFieldsFormat, tableFieldsFormat); + } + + private JPanel createTableFieldsPane() { + return new JPanel(); + } + + private JPanel createFieldDetailPane() { + JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + + fieldPane.add(fieldContentPane); + fieldPane.add(fieldPropsPane); + + return fieldPane; + } + + private JPanel createRichEditorPane(JPanel richEditor) { + JPanel richEditorPane = new JPanel(); + + richEditorPane.setLayout(new BorderLayout()); + richEditorPane.setPreferredSize(new Dimension(RICH_EDITOR_W, RICH_EDITOR_H)); + richEditorPane.add(richEditor, BorderLayout.CENTER); + + return richEditorPane; + } + + public void populateBean(AttrTooltipContent ob) { + + } + + public AttrTooltipContent updateBean() { + return null; + } + + protected String title4PopupWindow() { + return StringUtils.EMPTY; + } +} From edcfd2c70d88fab526583de31af93a890fdc32e8 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 24 Dec 2020 17:29:03 +0800 Subject: [PATCH 060/147] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E7=95=8C=E9=9D=A2=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/style/FormatPane.java | 6 + .../component/VanChartTooltipContentPane.java | 91 +++--- .../richText/VanChartFieldAttrPane.java | 81 +++++ ...dAddPane.java => VanChartFieldButton.java} | 29 +- .../richText/VanChartFieldGroupPane.java | 115 ------- .../richText/VanChartFieldListPane.java | 294 ++++++++++++++++++ .../richText/VanChartFieldListener.java | 6 +- .../richText/VanChartRichEditorModel.java | 64 ++++ .../richText/VanChartRichEditorPane.java | 80 +---- .../richText/VanChartRichTextPane.java | 117 +++---- .../com/fr/design/editor/script/editor.js | 1 + 11 files changed, 563 insertions(+), 321 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java rename designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/{VanChartFieldAddPane.java => VanChartFieldButton.java} (82%) delete mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldGroupPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java diff --git a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java index 0b33b7adf..ba68ab36f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java @@ -6,6 +6,7 @@ import com.fr.base.Style; import com.fr.base.TextFormat; import com.fr.data.core.FormatField; import com.fr.data.core.FormatField.FormatContents; +import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit; import com.fr.design.border.UIRoundedBorder; @@ -469,6 +470,11 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse globalNameListener = listener; } + public void registerChangeListener(UIObserverListener listener) { + typeComboBox.registerChangeListener(listener); + textField.registerChangeListener(listener); + } + @Override public boolean shouldResponseNameListener() { return false; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index b6e768e34..9700e4faa 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -2,7 +2,6 @@ package com.fr.van.chart.designer.component; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -33,11 +32,11 @@ import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import com.fr.van.chart.designer.component.richText.VanChartRichTextDialog; import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; -import org.nfunk.jep.function.Str; import javax.swing.JComponent; import javax.swing.JPanel; @@ -99,7 +98,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - - BasicPane panel = new VanChartRichTextPane(parent, getDefaultFieldNames(), getTableFieldNames(), richEditorPane); - BasicDialog dialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), panel); + AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr(); + ModernUIPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); + VanChartRichTextPane richTextPane = new VanChartRichTextPane(parent, getTableFieldNames(), richEditorPane); + BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); + // 更新字段格式和汇总方式 + richTextPane.populateBean(this.richTextTooltipContent); + // 更新富文本编辑器内容 richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); - dialog.addDialogActionListener(new DialogActionAdapter() { + richTextDialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { - VanChartRichEditorPane.RichEditorModel model = richEditorPane.update(); + + // 收集字段格式和汇总方式 + updateTooltipFormat(richTextTooltipContent, richTextPane.updateBean()); + VanChartRichEditorModel model = richEditorPane.update(); String content = model.getContent(); + // 收集编辑后的富文本内容 updateLocalRichText(content, model.isAuto()); SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false); @@ -468,24 +467,13 @@ public class VanChartTooltipContentPane extends BasicBeanPane getDefaultFieldNames() { - List fieldNames = new ArrayList<>(); - - fieldNames.add("分类"); - fieldNames.add("系列"); - fieldNames.add("值"); - fieldNames.add("百分比"); - - return fieldNames; - } - private List getTableFieldNames() { List fieldNames = new ArrayList<>(); @@ -745,8 +733,11 @@ public class VanChartTooltipContentPane extends BasicBeanPane defaultFieldNameList; - private List tableFieldNameList; - - private List defaultFieldPaneList = new ArrayList<>(); - private List tableFieldPaneList = new ArrayList<>(); - - private VanChartFieldListener fieldListener; - - public VanChartFieldGroupPane(List defaultFieldNameList, List tableFieldNameList) { - this.defaultFieldNameList = defaultFieldNameList; - this.tableFieldNameList = tableFieldNameList; - - initFieldListener(); - - this.setLayout(new BorderLayout()); - - this.add(createDefaultFieldPane(), BorderLayout.CENTER); - this.add(createTableFieldPane(), BorderLayout.SOUTH); - } - - private JPanel createDefaultFieldPane() { - JPanel defaultField = new JPanel(); - - defaultField.setLayout(new GridLayout(0, 1, 1, 0)); - - for (String title : defaultFieldNameList) { - VanChartFieldAddPane fieldAddPane = new VanChartFieldAddPane(title, fieldListener); - - defaultField.add(fieldAddPane); - defaultFieldPaneList.add(fieldAddPane); - } - - defaultField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldNameList.size() * FIELD_ADD_H)); - defaultField.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); - - return defaultField; - } - - private JPanel createTableFieldPane() { - JPanel tableField = new JPanel(); - - tableField.setLayout(new GridLayout(0, 1, 1, 0)); - - for (String title : tableFieldNameList) { - VanChartFieldAddPane fieldAddPane = new VanChartFieldAddPane(title, fieldListener); - - tableField.add(fieldAddPane); - tableFieldPaneList.add(fieldAddPane); - } - - tableField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldNameList.size() * FIELD_ADD_H)); - - return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); - } - - private void initFieldListener() { - - fieldListener = new VanChartFieldListener() { - - private String fieldName; - - public void setGlobalName(String fieldName) { - this.fieldName = fieldName; - } - - public String getGlobalName() { - return this.fieldName; - } - - public void refreshSelectedField(String fieldName) { - if (ComparatorUtils.equals(fieldName, this.fieldName)) { - return; - } - - for (VanChartFieldAddPane fieldAddPane : defaultFieldPaneList) { - fieldAddPane.setSelectedState(ComparatorUtils.equals(fieldAddPane.getFieldName(), fieldName)); - } - - for (VanChartFieldAddPane fieldAddPane : tableFieldPaneList) { - fieldAddPane.setSelectedState(ComparatorUtils.equals(fieldAddPane.getFieldName(), fieldName)); - } - } - - public void addSelectedField(String fieldName) { - System.out.println(fieldName); - } - - public void populateFieldFormatPane() { - - } - - public void updateFieldFormatPane() { - - } - }; - } -} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java new file mode 100644 index 000000000..aa3dbd17b --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -0,0 +1,294 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.data.util.function.AbstractDataFunction; +import com.fr.design.event.UIObserverListener; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +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.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.Format; +import java.util.ArrayList; +import java.util.List; + +public class VanChartFieldListPane extends JPanel { + + private static final int FIELD_ADD_W = 400; + private static final int FIELD_ADD_H = 28; + + private VanChartFieldButton categoryNameButton; + private VanChartFieldButton seriesNameButton; + private VanChartFieldButton valueButton; + private VanChartFieldButton percentButton; + + private VanChartFieldAttrPane fieldAttrPane; + private ModernUIPane richEditorPane; + private List tableFieldNameList; + private List tableFieldButtonList = new ArrayList<>(); + + private VanChartFieldListener fieldListener; + + public VanChartFieldListPane(List tableFieldNameList, VanChartFieldAttrPane fieldAttrPane, + ModernUIPane richEditorPane) { + + this.tableFieldNameList = tableFieldNameList; + + this.fieldAttrPane = fieldAttrPane; + this.richEditorPane = richEditorPane; + + initFieldListListener(); + registerAttrListener(); + + this.setLayout(new BorderLayout()); + + this.add(createDefaultFieldPane(), BorderLayout.CENTER); + this.add(createTableFieldPane(), BorderLayout.SOUTH); + } + + private JPanel createDefaultFieldPane() { + JPanel defaultField = new JPanel(); + + defaultField.setLayout(new GridLayout(0, 1, 1, 0)); + createDefaultButtonGroup(defaultField); + + List defaultFieldButtonList = getDefaultFieldButtonList(); + + defaultField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldButtonList.size() * FIELD_ADD_H)); + defaultField.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); + + return defaultField; + } + + protected void createDefaultButtonGroup(JPanel field) { + categoryNameButton = createCategoryFieldButton(); + seriesNameButton = createSeriesFieldButton(); + valueButton = createValueFieldButton(); + percentButton = createPercentFieldButton(); + + field.add(categoryNameButton); + field.add(seriesNameButton); + field.add(valueButton); + field.add(percentButton); + } + + // 不同图表的name和id不一样 + protected VanChartFieldButton createCategoryFieldButton() { + String name = Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"); + String id = new AttrTooltipCategoryFormat().getFormatJSONKey(); + + return new VanChartFieldButton(name, id, false, fieldListener); + } + + protected VanChartFieldButton createSeriesFieldButton() { + String name = Toolkit.i18nText("Fine-Design_Chart_Series_Name"); + String id = new AttrTooltipSeriesFormat().getFormatJSONKey(); + + return new VanChartFieldButton(name, id, false, fieldListener); + } + + protected VanChartFieldButton createValueFieldButton() { + String name = Toolkit.i18nText("Fine-Design_Chart_Use_Value"); + String id = new AttrTooltipValueFormat().getFormatJSONKey(); + + return new VanChartFieldButton(name, id, false, fieldListener); + } + + protected VanChartFieldButton createPercentFieldButton() { + String name = Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); + String id = new AttrTooltipPercentFormat().getFormatJSONKey(); + + return new VanChartFieldButton(name, id, false, fieldListener); + } + + private JPanel createTableFieldPane() { + if (tableFieldNameList == null || tableFieldNameList.isEmpty()) { + return new JPanel(); + } + + JPanel tableField = new JPanel(); + + tableField.setLayout(new GridLayout(0, 1, 1, 0)); + + for (String name : tableFieldNameList) { + VanChartFieldButton fieldButton = new VanChartFieldButton(name, name, true, fieldListener); + + tableField.add(fieldButton); + tableFieldButtonList.add(fieldButton); + } + + tableField.setPreferredSize(new Dimension(FIELD_ADD_W, tableFieldNameList.size() * FIELD_ADD_H)); + + return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); + } + + protected List getDefaultFieldButtonList() { + List defaultFieldButtonList = new ArrayList<>(); + + defaultFieldButtonList.add(categoryNameButton); + defaultFieldButtonList.add(seriesNameButton); + defaultFieldButtonList.add(valueButton); + defaultFieldButtonList.add(percentButton); + + return defaultFieldButtonList; + } + + private void initFieldListListener() { + + fieldListener = new VanChartFieldListener() { + + private String fieldName; + + public void setGlobalName(String fieldName) { + this.fieldName = fieldName; + } + + public String getGlobalName() { + return this.fieldName; + } + + public VanChartFieldButton getSelectedField() { + List defaultFieldButtonList = getDefaultFieldButtonList(); + + for (VanChartFieldButton fieldButton : defaultFieldButtonList) { + if (ComparatorUtils.equals(fieldButton.getFieldName(), this.fieldName)) { + return fieldButton; + } + } + + for (VanChartFieldButton fieldButton : tableFieldButtonList) { + if (ComparatorUtils.equals(fieldButton.getFieldName(), this.fieldName)) { + return fieldButton; + } + } + + return null; + } + + public void refreshSelectedPane(String fieldName) { + if (ComparatorUtils.equals(fieldName, this.fieldName)) { + return; + } + + List defaultFieldButtonList = getDefaultFieldButtonList(); + + for (VanChartFieldButton fieldButton : defaultFieldButtonList) { + fieldButton.setSelectedState(ComparatorUtils.equals(fieldButton.getFieldName(), fieldName)); + } + + for (VanChartFieldButton fieldButton : tableFieldButtonList) { + fieldButton.setSelectedState(ComparatorUtils.equals(fieldButton.getFieldName(), fieldName)); + } + } + + public void addSelectedField(String fieldName, String fieldId) { + VanChartRichEditorModel model = richEditorPane.update(); + String content = model.getContent() + getFieldRichText(fieldName, fieldId); + model.setContent(content); + VanChartRichEditorPane.createRichEditorPane(model); + } + + public void populateFieldFormatPane() { + VanChartFieldButton fieldButton = this.getSelectedField(); + + if (fieldButton == null) { + return; + } + + Format format = fieldButton.getFormat(); + AbstractDataFunction dataFunction = (AbstractDataFunction) fieldButton.getDataFunction(); + boolean showDataFunction = fieldButton.isShowDataFunction(); + + fieldAttrPane.populate(format, dataFunction, showDataFunction); + } + + public void updateFieldFormatPane() { + VanChartFieldButton fieldButton = this.getSelectedField(); + + if (fieldButton == null) { + return; + } + + fieldButton.setFormat(fieldAttrPane.updateFormat()); + fieldButton.setDataFunction(fieldAttrPane.updateDataFunction()); + } + }; + } + + private void registerAttrListener() { + + fieldAttrPane.registerFunctionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + fieldListener.updateFieldFormatPane(); + } + }); + + fieldAttrPane.registerChangeListener(new UIObserverListener() { + public void doChange() { + fieldListener.updateFieldFormatPane(); + } + }); + } + + private void checkFieldListSelected() { + List defaultFieldButtonList = getDefaultFieldButtonList(); + + if (defaultFieldButtonList != null && defaultFieldButtonList.size() > 0) { + String selected = defaultFieldButtonList.get(0).getFieldName(); + + fieldListener.refreshSelectedPane(selected); + fieldListener.setGlobalName(selected); + fieldListener.populateFieldFormatPane(); + } + } + + private String getFieldRichText(String fieldName, String fieldId) { + return "

" + fieldName + "

"; + } + + public void populate(AttrTooltipContent tooltipContent) { + populateDefaultField(tooltipContent); + populateTableField(tooltipContent); + + // 初次打开富文本界面选中第一个 + checkFieldListSelected(); + } + + public void populateDefaultField(AttrTooltipContent tooltipContent) { + categoryNameButton.setFormat(tooltipContent.getRichTextCategoryFormat().getFormat()); + seriesNameButton.setFormat(tooltipContent.getRichTextSeriesFormat().getFormat()); + valueButton.setFormat(tooltipContent.getRichTextValueFormat().getFormat()); + percentButton.setFormat(tooltipContent.getRichTextPercentFormat().getFormat()); + } + + public void populateTableField(AttrTooltipContent tooltipContent) { + + } + + public void update(AttrTooltipContent tooltipContent) { + updateDefaultField(tooltipContent); + updateTableField(tooltipContent); + } + + public void updateDefaultField(AttrTooltipContent tooltipContent) { + tooltipContent.getRichTextCategoryFormat().setFormat(categoryNameButton.getFormat()); + tooltipContent.getRichTextSeriesFormat().setFormat(seriesNameButton.getFormat()); + tooltipContent.getRichTextValueFormat().setFormat(valueButton.getFormat()); + tooltipContent.getRichTextPercentFormat().setFormat(percentButton.getFormat()); + } + + public void updateTableField(AttrTooltipContent tooltipContent) { + + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java index 738492d67..62f096663 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java @@ -4,9 +4,11 @@ import com.fr.design.event.GlobalNameListener; public interface VanChartFieldListener extends GlobalNameListener { - public void refreshSelectedField(String fieldName); + public VanChartFieldButton getSelectedField(); - public void addSelectedField(String fieldName); + public void refreshSelectedPane(String fieldName); + + public void addSelectedField(String fieldName, String fieldId); public void populateFieldFormatPane(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java new file mode 100644 index 000000000..245eaa951 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java @@ -0,0 +1,64 @@ +package com.fr.van.chart.designer.component.richText; + +import com.fr.plugin.chart.type.TextAlign; +import com.fr.stable.StringUtils; + +public class VanChartRichEditorModel { + + private String content = StringUtils.EMPTY; + private boolean auto = true; + private String params = StringUtils.EMPTY; + private String initParams = StringUtils.EMPTY; + private String align = TextAlign.LEFT.getAlign(); + + public VanChartRichEditorModel() { + } + + public VanChartRichEditorModel(String content, boolean auto, String params, String initParams, String align) { + this.content = content; + this.auto = auto; + this.params = params; + this.initParams = initParams; + this.align = align; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public boolean isAuto() { + return auto; + } + + public void setAuto(boolean auto) { + this.auto = auto; + } + + public String getParams() { + return params; + } + + public void setParams(String params) { + this.params = params; + } + + public String getInitParams() { + return initParams; + } + + public void setInitParams(String initParams) { + this.initParams = initParams; + } + + public String getAlign() { + return align; + } + + public void setAlign(String align) { + this.align = align; + } +} 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 66453a157..99afba30e 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 @@ -25,7 +25,7 @@ public class VanChartRichEditorPane { private static final String richEditorPath = "/com/fr/design/editor/rich_editor.html"; private static final String expression = "dispatch()"; - private static ModernUIPane richEditorPane; + private static ModernUIPane richEditorPane; private static Browser browser; public static void initRichEditorPane() { @@ -36,7 +36,7 @@ public class VanChartRichEditorPane { @Override public void run() { try { - richEditorPane = initPane(new RichEditorModel()); + richEditorPane = initPane(new VanChartRichEditorModel()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -47,9 +47,12 @@ public class VanChartRichEditorPane { } } - public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { - RichEditorModel model = getRichEditorModel(richEditor); + public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { + VanChartRichEditorModel model = getRichEditorModel(richEditor); + return createRichEditorPane(model); + } + public static ModernUIPane createRichEditorPane(VanChartRichEditorModel model) { if (richEditorPane == null) { richEditorPane = initPane(model); } else if (browser != null) { @@ -59,8 +62,8 @@ public class VanChartRichEditorPane { return richEditorPane; } - public static ModernUIPane initPane(RichEditorModel model) { - return new ModernUIPane.Builder() + public static ModernUIPane initPane(VanChartRichEditorModel model) { + return new ModernUIPane.Builder() .prepare(new ScriptContextAdapter() { public void onScriptContextCreated(ScriptContextEvent event) { browser = event.getBrowser(); @@ -79,13 +82,13 @@ public class VanChartRichEditorPane { .namespace(namespace).build(); } - public static void updatePane(Browser browser, RichEditorModel model) { + public static void updatePane(Browser browser, VanChartRichEditorModel model) { JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace); ns.asObject().setProperty(variable, model); browser.executeJavaScript("window." + namespace + "." + expression); } - public static RichEditorModel getRichEditorModel(AttrTooltipRichText richText) { + public static VanChartRichEditorModel getRichEditorModel(AttrTooltipRichText richText) { Map paramsMap = richText.getParams(); StringBuilder paramsStr = new StringBuilder(StringUtils.EMPTY); @@ -115,7 +118,7 @@ public class VanChartRichEditorPane { align = content.contains(left) ? left : center; } - return new RichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams, align); + return new VanChartRichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams, align); } public static String generateTransformI18nJS() { @@ -129,63 +132,4 @@ public class VanChartRichEditorPane { return "!(function () { window.transformI18n && window.transformI18n('" + language + "' || 'zh_CN'); }());"; } - - public static class RichEditorModel { - private String content = StringUtils.EMPTY; - private boolean auto = true; - private String params = StringUtils.EMPTY; - private String initParams = StringUtils.EMPTY; - private String align = TextAlign.LEFT.getAlign(); - - public RichEditorModel() { - } - - public RichEditorModel(String content, boolean auto, String params, String initParams, String align) { - this.content = content; - this.auto = auto; - this.params = params; - this.initParams = initParams; - this.align = align; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public boolean isAuto() { - return auto; - } - - public void setAuto(boolean auto) { - this.auto = auto; - } - - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } - - public String getInitParams() { - return initParams; - } - - public void setInitParams(String initParams) { - this.initParams = initParams; - } - - public String getAlign() { - return align; - } - - public void setAlign(String align) { - this.align = align; - } - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java index 927fbdaae..e48050619 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -1,25 +1,16 @@ package com.fr.van.chart.designer.component.richText; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.style.FormatPane; -import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.stable.StringUtils; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.SwingConstants; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Dimension; import java.util.List; @@ -32,110 +23,74 @@ public class VanChartRichTextPane extends BasicBeanPane { private static final int RICH_EDITOR_W = 940; private static final int RICH_EDITOR_H = 260; - private static final double P = TableLayout.PREFERRED; - private static final double D = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; - private static final double E = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - - private JScrollPane fieldContentPane; - private JScrollPane fieldPropsPane; - - private FormatPane fieldFormatPane; - private JPanel fieldSummaryPane; - - private UIComboBox fieldSummaryBox; + private VanChartFieldListPane fieldListPane; + private VanChartFieldAttrPane fieldAttrPane; private VanChartStylePane parent; - private List defaultFieldsFormat; private List tableFieldsFormat; - public VanChartRichTextPane(VanChartStylePane parent, List defaultFieldsFormat, List tableFieldsFormat, JPanel richEditor) { - this.parent = parent; + private ModernUIPane richEditor; - this.defaultFieldsFormat = defaultFieldsFormat; + public VanChartRichTextPane(VanChartStylePane parent, List tableFieldsFormat, ModernUIPane richEditor) { + this.parent = parent; this.tableFieldsFormat = tableFieldsFormat; + this.richEditor = richEditor; - initFieldContentPane(); - initFieldPropsPane(); + initFieldContent(); this.setLayout(new BorderLayout()); - this.add(createFieldDetailPane(), BorderLayout.CENTER); - this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH); + this.add(createFieldContentPane(), BorderLayout.CENTER); + this.add(createRichEditorPane(), BorderLayout.SOUTH); } - private void initFieldContentPane() { - JPanel content = new JPanel(); - content.setLayout(new BorderLayout()); - content.add(createDefaultContentPane(), BorderLayout.NORTH); - content.add(createTableFieldsPane(), BorderLayout.CENTER); - - fieldContentPane = new JScrollPane(content); - fieldContentPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); - fieldContentPane.setHorizontalScrollBar(null); - fieldContentPane.setBorder(BorderFactory.createTitledBorder("添加字段")); - } - - private void initFieldPropsPane() { - fieldFormatPane = new FormatPaneWithOutFont() { - protected JPanel createContentPane(Component[][] components) { - return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{P, P, P}, new double[]{D, E}); - } - }; - - fieldSummaryBox = new CalculateComboBox(); - - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), fieldSummaryBox} - }; - - fieldSummaryPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{P, P}, new double[]{D, E}); - - JPanel props = new JPanel(); - props.setLayout(new BorderLayout()); - props.add(fieldFormatPane, BorderLayout.NORTH); - props.add(fieldSummaryPane, BorderLayout.CENTER); - props.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); - - fieldPropsPane = new JScrollPane(props); - fieldPropsPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); - fieldPropsPane.setBorder(BorderFactory.createTitledBorder("字段设置")); + private void initFieldContent() { + fieldAttrPane = new VanChartFieldAttrPane(); + fieldListPane = new VanChartFieldListPane(tableFieldsFormat, fieldAttrPane, richEditor); } - private JPanel createDefaultContentPane() { + private JPanel createFieldContentPane() { + JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - return new VanChartFieldGroupPane(defaultFieldsFormat, tableFieldsFormat); - } + // 新增字段目录 + JPanel fieldListContent = new JPanel(); + fieldListContent.setLayout(new BorderLayout()); + fieldListContent.add(fieldListPane, BorderLayout.NORTH); - private JPanel createTableFieldsPane() { - return new JPanel(); - } + JScrollPane fieldListScrollPane = new JScrollPane(fieldListContent); + fieldListScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); + fieldListScrollPane.setHorizontalScrollBar(null); + fieldListScrollPane.setBorder(BorderFactory.createTitledBorder("添加字段")); - private JPanel createFieldDetailPane() { - JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + // 字段格式和汇总 + JScrollPane fieldAttrScrollPane = new JScrollPane(fieldAttrPane); + fieldAttrScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); + fieldAttrScrollPane.setBorder(BorderFactory.createTitledBorder("字段设置")); - fieldPane.add(fieldContentPane); - fieldPane.add(fieldPropsPane); + fieldPane.add(fieldListScrollPane); + fieldPane.add(fieldAttrScrollPane); return fieldPane; } - private JPanel createRichEditorPane(JPanel richEditor) { + private JPanel createRichEditorPane() { JPanel richEditorPane = new JPanel(); richEditorPane.setLayout(new BorderLayout()); richEditorPane.setPreferredSize(new Dimension(RICH_EDITOR_W, RICH_EDITOR_H)); - richEditorPane.add(richEditor, BorderLayout.CENTER); + richEditorPane.add(this.richEditor, BorderLayout.CENTER); return richEditorPane; } - public void populateBean(AttrTooltipContent ob) { - + public void populateBean(AttrTooltipContent tooltipContent) { + fieldListPane.populate(tooltipContent); } public AttrTooltipContent updateBean() { - return null; + AttrTooltipContent content = new AttrTooltipContent(); + fieldListPane.update(content); + return content; } protected String title4PopupWindow() { diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js index f3e053679..a2b5dd6a7 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js @@ -50,6 +50,7 @@ }, items: [{ type: "bi.htape", + tgap: 5, items: [{ type: "bi.label", text: BI.i18nText("BI-Design_Font_Style") + ": ", From 8950771cede13a46c10d1960730fe1a90944f559 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 28 Dec 2020 09:53:58 +0800 Subject: [PATCH 061/147] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../richText/VanChartFieldAttrPane.java | 20 +++-- .../richText/VanChartFieldListPane.java | 5 +- .../richText/VanChartRichEditorModel.java | 11 +++ .../richText/VanChartRichEditorPane.java | 74 +++++++++---------- .../com/fr/design/editor/rich_editor.html | 31 +++++++- 5 files changed, 86 insertions(+), 55 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java index cc99a2ce1..89c3cd73e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java @@ -16,7 +16,6 @@ import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionListener; -import java.awt.event.MouseListener; import java.text.Format; public class VanChartFieldAttrPane extends JPanel { @@ -27,6 +26,15 @@ public class VanChartFieldAttrPane extends JPanel { private JPanel fieldFunctionPane; public VanChartFieldAttrPane() { + initComponents(); + + this.setLayout(new BorderLayout()); + this.add(fieldFormatPane, BorderLayout.NORTH); + this.add(fieldFunctionPane, BorderLayout.CENTER); + this.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); + } + + private void initComponents() { double p = TableLayout.PREFERRED; double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; @@ -35,10 +43,6 @@ public class VanChartFieldAttrPane extends JPanel { protected JPanel createContentPane(Component[][] components) { return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, new double[]{d, e}); } - - public void addActionListener(ActionListener listener) { - - } }; fieldDataFunction = new CalculateComboBox(); @@ -49,11 +53,6 @@ public class VanChartFieldAttrPane extends JPanel { }; fieldFunctionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{d, e}); - - this.setLayout(new BorderLayout()); - this.add(fieldFormatPane, BorderLayout.NORTH); - this.add(fieldFunctionPane, BorderLayout.CENTER); - this.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); } public void registerFunctionListener(ActionListener listener) { @@ -67,7 +66,6 @@ public class VanChartFieldAttrPane extends JPanel { public void populate(Format format, AbstractDataFunction dataFunction, boolean showDataFunction) { fieldFormatPane.populateBean(format); fieldDataFunction.populateBean(dataFunction); - fieldFunctionPane.setVisible(showDataFunction); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index aa3dbd17b..c4039c691 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -194,9 +194,8 @@ public class VanChartFieldListPane extends JPanel { public void addSelectedField(String fieldName, String fieldId) { VanChartRichEditorModel model = richEditorPane.update(); - String content = model.getContent() + getFieldRichText(fieldName, fieldId); - model.setContent(content); - VanChartRichEditorPane.createRichEditorPane(model); + model.setAddition(fieldName); + VanChartRichEditorPane.richEditorAddField(model); } public void populateFieldFormatPane() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java index 245eaa951..83df27c0f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java @@ -10,6 +10,7 @@ public class VanChartRichEditorModel { private String params = StringUtils.EMPTY; private String initParams = StringUtils.EMPTY; private String align = TextAlign.LEFT.getAlign(); + private String addition = StringUtils.EMPTY; public VanChartRichEditorModel() { } @@ -20,6 +21,7 @@ public class VanChartRichEditorModel { this.params = params; this.initParams = initParams; this.align = align; + this.addition = StringUtils.EMPTY; } public String getContent() { @@ -61,4 +63,13 @@ public class VanChartRichEditorModel { public void setAlign(String align) { this.align = align; } + + public String getAddition() { + return addition; + } + + public void setAddition(String addition) { + this.addition = addition; + } + } 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 99afba30e..87710da55 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 @@ -1,10 +1,8 @@ package com.fr.van.chart.designer.component.richText; -import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; import com.fr.design.ui.ModernUIPane; import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.type.TextAlign; import com.fr.stable.StringUtils; @@ -15,38 +13,20 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import java.util.Locale; import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; public class VanChartRichEditorPane { - private static final String namespace = "Pool"; - private static final String variable = "data"; - private static final String richEditorPath = "/com/fr/design/editor/rich_editor.html"; - private static final String expression = "dispatch()"; + private static final String NAME_SPACE = "Pool"; + private static final String VARIABLE = "data"; + + private static final String RICH_EDITOR_HTML = "/com/fr/design/editor/rich_editor.html"; + + private static final String REFRESH = "refresh()"; + private static final String ADD_FIELD = "addField()"; private static ModernUIPane richEditorPane; private static Browser browser; - public static void initRichEditorPane() { - ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor(new NamedThreadFactory("VanChartRichEditor")); - - try { - singleThreadExecutor.submit(new Runnable() { - @Override - public void run() { - try { - richEditorPane = initPane(new VanChartRichEditorModel()); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - }); - } finally { - singleThreadExecutor.shutdown(); - } - } - public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { VanChartRichEditorModel model = getRichEditorModel(richEditor); return createRichEditorPane(model); @@ -55,13 +35,25 @@ public class VanChartRichEditorPane { public static ModernUIPane createRichEditorPane(VanChartRichEditorModel model) { if (richEditorPane == null) { richEditorPane = initPane(model); - } else if (browser != null) { - updatePane(browser, model); + } else { + richEditorRefresh(model); } return richEditorPane; } + public static void richEditorRefresh(VanChartRichEditorModel model) { + if (richEditorPane != null && browser != null) { + refresh(browser, model); + } + } + + public static void richEditorAddField(VanChartRichEditorModel model) { + if (richEditorPane != null && browser != null) { + addField(browser, model); + } + } + public static ModernUIPane initPane(VanChartRichEditorModel model) { return new ModernUIPane.Builder() .prepare(new ScriptContextAdapter() { @@ -74,18 +66,26 @@ public class VanChartRichEditorPane { browser.executeJavaScript(generateTransformI18nJS()); browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/web/ui/materials.min.js")); - JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace); - ns.asObject().setProperty(variable, model); + JSValue ns = browser.executeJavaScriptAndReturnValue("window." + NAME_SPACE); + ns.asObject().setProperty(VARIABLE, model); } }) - .withEMB(richEditorPath) - .namespace(namespace).build(); + .withEMB(RICH_EDITOR_HTML) + .namespace(NAME_SPACE).build(); + } + + public static void refresh(Browser browser, VanChartRichEditorModel model) { + stateChange(browser, model, REFRESH); + } + + public static void addField(Browser browser, VanChartRichEditorModel model) { + stateChange(browser, model, ADD_FIELD); } - public static void updatePane(Browser browser, VanChartRichEditorModel model) { - JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace); - ns.asObject().setProperty(variable, model); - browser.executeJavaScript("window." + namespace + "." + expression); + public static void stateChange(Browser browser, VanChartRichEditorModel model, String trigger) { + JSValue ns = browser.executeJavaScriptAndReturnValue("window." + NAME_SPACE); + ns.asObject().setProperty(VARIABLE, model); + browser.executeJavaScript("window." + NAME_SPACE + "." + trigger); } public static VanChartRichEditorModel getRichEditorModel(AttrTooltipRichText richText) { diff --git a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html index e6c769f0a..f62d7dbb2 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html +++ b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html @@ -88,8 +88,7 @@ {type: "bi.rich_editor_color_chooser"}, {type: "bi.rich_editor_align_left_button"}, {type: "bi.rich_editor_align_center_button"}, - {type: "bi.rich_editor_align_right_button"}, - {type: "bi.design.chart.common.editor.insert_param"} + {type: "bi.rich_editor_align_right_button"} ] }, ref: function (_ref) { @@ -97,7 +96,7 @@ } }); - Pool.dispatch = function () { + Pool.refresh = function () { var content = Pool.data.getContent(); var isAuto = Pool.data.isAuto(); var params = Pool.data.getParams(); @@ -117,7 +116,31 @@ }); rich_editor.setFocus(); - } + }; + + Pool.addField = function () { + var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); + + var content = Pool.data.getContent(); + var isAuto = Pool.data.isAuto(); + var params = Pool.data.getParams(); + var addition = Pool.data.getAddition(); + + if (addition) { + // todo 暂时先处理成在content后加一行 + content += '

' + editorService.getEditorParamImage(addition) + '

'; + } + + rich_editor.editor.bindToolbar(rich_editor.bar); + + rich_editor.setValue({ + content: content, + isAuto: isAuto, + dimensionIds: getDimensionIds(params) + }); + + rich_editor.setFocus(); + }; Pool.update = function () { var {content, isAuto} = rich_editor.getValue(); From 6ff17bf1a7da0e6498a5b9b0ee523790f115375c Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 28 Dec 2020 17:34:37 +0800 Subject: [PATCH 062/147] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 2 +- .../richText/VanChartFieldButton.java | 23 +++- .../richText/VanChartFieldListPane.java | 109 +++++++++--------- .../richText/VanChartRichTextPane.java | 26 +---- 4 files changed, 79 insertions(+), 81 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 9700e4faa..89a627518 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -439,7 +439,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - VanChartRichTextPane richTextPane = new VanChartRichTextPane(parent, getTableFieldNames(), richEditorPane); + VanChartRichTextPane richTextPane = new VanChartRichTextPane(getTableFieldNames(), richEditorPane); BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); // 更新字段格式和汇总方式 diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java index 9c0c20d11..a3ccc2a47 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java @@ -6,6 +6,8 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.Icon; @@ -28,19 +30,20 @@ public class VanChartFieldButton extends JPanel { private final String fieldName; private final String fieldId; + private final AttrTooltipFormat tooltipFormat; private final boolean showDataFunction; private UIToggleButton fieldButton; private UIButton addButton; - private Format format; private DataFunction dataFunction; - public VanChartFieldButton(String fieldName, String fieldId, boolean showSummary, VanChartFieldListener listener) { + public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, VanChartFieldListener listener) { this.fieldName = fieldName; - this.fieldId = fieldId; + this.tooltipFormat = format; + this.showDataFunction = showDataFunction; - this.showDataFunction = showSummary; + this.fieldId = format == null ? StringUtils.EMPTY : format.getFormatJSONKey(); initComponents(fieldName, listener); @@ -52,12 +55,20 @@ public class VanChartFieldButton extends JPanel { return fieldName; } + public boolean isEnable() { + return this.tooltipFormat.isEnable(); + } + + public void setEnable(boolean enable) { + this.tooltipFormat.setEnable(enable); + } + public Format getFormat() { - return format; + return tooltipFormat.getFormat(); } public void setFormat(Format format) { - this.format = format; + this.tooltipFormat.setFormat(format); } public DataFunction getDataFunction() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index c4039c691..f7fb81d0c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -7,6 +7,7 @@ import com.fr.design.ui.ModernUIPane; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; @@ -49,6 +50,8 @@ public class VanChartFieldListPane extends JPanel { this.richEditorPane = richEditorPane; initFieldListListener(); + initDefaultFieldButton(); + registerAttrListener(); this.setLayout(new BorderLayout()); @@ -58,58 +61,37 @@ public class VanChartFieldListPane extends JPanel { } private JPanel createDefaultFieldPane() { - JPanel defaultField = new JPanel(); + JPanel fieldPane = new JPanel(); - defaultField.setLayout(new GridLayout(0, 1, 1, 0)); - createDefaultButtonGroup(defaultField); + fieldPane.setLayout(new GridLayout(0, 1, 1, 0)); - List defaultFieldButtonList = getDefaultFieldButtonList(); + addDefaultFieldButton(fieldPane); - defaultField.setPreferredSize(new Dimension(FIELD_ADD_W, defaultFieldButtonList.size() * FIELD_ADD_H)); - defaultField.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); + fieldPane.setPreferredSize(new Dimension(FIELD_ADD_W, getDefaultFieldButtonList().size() * FIELD_ADD_H)); + fieldPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); - return defaultField; + return fieldPane; } - protected void createDefaultButtonGroup(JPanel field) { - categoryNameButton = createCategoryFieldButton(); - seriesNameButton = createSeriesFieldButton(); - valueButton = createValueFieldButton(); - percentButton = createPercentFieldButton(); + protected void initDefaultFieldButton() { + categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + new AttrTooltipCategoryFormat(), false, fieldListener); - field.add(categoryNameButton); - field.add(seriesNameButton); - field.add(valueButton); - field.add(percentButton); - } + seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + new AttrTooltipSeriesFormat(), false, fieldListener); - // 不同图表的name和id不一样 - protected VanChartFieldButton createCategoryFieldButton() { - String name = Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"); - String id = new AttrTooltipCategoryFormat().getFormatJSONKey(); + valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + new AttrTooltipValueFormat(), false, fieldListener); - return new VanChartFieldButton(name, id, false, fieldListener); + percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); } - protected VanChartFieldButton createSeriesFieldButton() { - String name = Toolkit.i18nText("Fine-Design_Chart_Series_Name"); - String id = new AttrTooltipSeriesFormat().getFormatJSONKey(); - - return new VanChartFieldButton(name, id, false, fieldListener); - } - - protected VanChartFieldButton createValueFieldButton() { - String name = Toolkit.i18nText("Fine-Design_Chart_Use_Value"); - String id = new AttrTooltipValueFormat().getFormatJSONKey(); - - return new VanChartFieldButton(name, id, false, fieldListener); - } - - protected VanChartFieldButton createPercentFieldButton() { - String name = Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); - String id = new AttrTooltipPercentFormat().getFormatJSONKey(); - - return new VanChartFieldButton(name, id, false, fieldListener); + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(categoryNameButton); + fieldPane.add(seriesNameButton); + fieldPane.add(valueButton); + fieldPane.add(percentButton); } private JPanel createTableFieldPane() { @@ -122,7 +104,7 @@ public class VanChartFieldListPane extends JPanel { tableField.setLayout(new GridLayout(0, 1, 1, 0)); for (String name : tableFieldNameList) { - VanChartFieldButton fieldButton = new VanChartFieldButton(name, name, true, fieldListener); + VanChartFieldButton fieldButton = new VanChartFieldButton(name, getTableTooltipFormat(name), true, fieldListener); tableField.add(fieldButton); tableFieldButtonList.add(fieldButton); @@ -133,6 +115,11 @@ public class VanChartFieldListPane extends JPanel { return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); } + // 生成新增字段对应的format + private AttrTooltipFormat getTableTooltipFormat(String fieldName) { + return new AttrTooltipCategoryFormat(); + } + protected List getDefaultFieldButtonList() { List defaultFieldButtonList = new ArrayList<>(); @@ -252,10 +239,6 @@ public class VanChartFieldListPane extends JPanel { } } - private String getFieldRichText(String fieldName, String fieldId) { - return "

" + fieldName + "

"; - } - public void populate(AttrTooltipContent tooltipContent) { populateDefaultField(tooltipContent); populateTableField(tooltipContent); @@ -265,10 +248,19 @@ public class VanChartFieldListPane extends JPanel { } public void populateDefaultField(AttrTooltipContent tooltipContent) { - categoryNameButton.setFormat(tooltipContent.getRichTextCategoryFormat().getFormat()); - seriesNameButton.setFormat(tooltipContent.getRichTextSeriesFormat().getFormat()); - valueButton.setFormat(tooltipContent.getRichTextValueFormat().getFormat()); - percentButton.setFormat(tooltipContent.getRichTextPercentFormat().getFormat()); + populateButtonFormat(categoryNameButton, tooltipContent.getRichTextCategoryFormat()); + populateButtonFormat(seriesNameButton, tooltipContent.getRichTextSeriesFormat()); + populateButtonFormat(valueButton, tooltipContent.getRichTextValueFormat()); + populateButtonFormat(percentButton, tooltipContent.getRichTextPercentFormat()); + } + + public void populateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) { + if (button == null || format == null) { + return; + } + + button.setEnable(format.isEnable()); + button.setFormat(format.getFormat()); } public void populateTableField(AttrTooltipContent tooltipContent) { @@ -281,13 +273,22 @@ public class VanChartFieldListPane extends JPanel { } public void updateDefaultField(AttrTooltipContent tooltipContent) { - tooltipContent.getRichTextCategoryFormat().setFormat(categoryNameButton.getFormat()); - tooltipContent.getRichTextSeriesFormat().setFormat(seriesNameButton.getFormat()); - tooltipContent.getRichTextValueFormat().setFormat(valueButton.getFormat()); - tooltipContent.getRichTextPercentFormat().setFormat(percentButton.getFormat()); + updateButtonFormat(categoryNameButton, tooltipContent.getRichTextCategoryFormat()); + updateButtonFormat(seriesNameButton, tooltipContent.getRichTextSeriesFormat()); + updateButtonFormat(valueButton, tooltipContent.getRichTextValueFormat()); + updateButtonFormat(percentButton, tooltipContent.getRichTextPercentFormat()); } public void updateTableField(AttrTooltipContent tooltipContent) { } + + public void updateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) { + if (button == null || format == null) { + return; + } + + format.setEnable(button.isEnable()); + format.setFormat(button.getFormat()); + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java index e48050619..7ee3f3df6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -5,7 +5,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.stable.StringUtils; -import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -26,27 +25,14 @@ public class VanChartRichTextPane extends BasicBeanPane { private VanChartFieldListPane fieldListPane; private VanChartFieldAttrPane fieldAttrPane; - private VanChartStylePane parent; + public VanChartRichTextPane(List tableFieldNames, ModernUIPane richEditor) { - private List tableFieldsFormat; - - private ModernUIPane richEditor; - - public VanChartRichTextPane(VanChartStylePane parent, List tableFieldsFormat, ModernUIPane richEditor) { - this.parent = parent; - this.tableFieldsFormat = tableFieldsFormat; - this.richEditor = richEditor; - - initFieldContent(); + fieldAttrPane = new VanChartFieldAttrPane(); + fieldListPane = new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); this.setLayout(new BorderLayout()); this.add(createFieldContentPane(), BorderLayout.CENTER); - this.add(createRichEditorPane(), BorderLayout.SOUTH); - } - - private void initFieldContent() { - fieldAttrPane = new VanChartFieldAttrPane(); - fieldListPane = new VanChartFieldListPane(tableFieldsFormat, fieldAttrPane, richEditor); + this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH); } private JPanel createFieldContentPane() { @@ -73,12 +59,12 @@ public class VanChartRichTextPane extends BasicBeanPane { return fieldPane; } - private JPanel createRichEditorPane() { + private JPanel createRichEditorPane(JPanel richEditor) { JPanel richEditorPane = new JPanel(); richEditorPane.setLayout(new BorderLayout()); richEditorPane.setPreferredSize(new Dimension(RICH_EDITOR_W, RICH_EDITOR_H)); - richEditorPane.add(this.richEditor, BorderLayout.CENTER); + richEditorPane.add(richEditor, BorderLayout.CENTER); return richEditorPane; } From 5ee5c7a6423d2b7d46ba31280ed06a29708d843b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Tue, 29 Dec 2020 09:56:19 +0800 Subject: [PATCH 063/147] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 12 ++--- .../designer/style/VanChartStylePane.java | 54 +++++++++++++++++++ 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 89a627518..b9472dd86 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -49,7 +49,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.ArrayList; import java.util.List; /** @@ -475,14 +474,11 @@ public class VanChartTooltipContentPane extends BasicBeanPane getTableFieldNames() { - List fieldNames = new ArrayList<>(); - - fieldNames.add("字段A"); - fieldNames.add("字段B"); - fieldNames.add("字段C"); - fieldNames.add("字段D"); + if (parent == null) { + return null; + } - return fieldNames; + return parent.getDataModelColumnNames(); } private JPanel createHtmlPane() { 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 32a4f8e54..f9d0720dc 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 @@ -1,9 +1,20 @@ package com.fr.van.chart.designer.style; +import com.fr.base.TableData; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; 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.design.DesignModelAdapter; +import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.van.chart.designer.style.axis.VanChartAxisPane; import com.fr.van.chart.designer.style.background.VanChartAreaPane; @@ -75,4 +86,47 @@ public class VanChartStylePane extends ChartStylePane { protected void addVanChartTooltipPane(List paneList) { paneList.add(new VanChartTooltipPane(VanChartStylePane.this)); } + + public List getDataModelColumnNames() { + Chart chart = getChart(); + + if (chart == null) { + return null; + } + + TopDefinitionProvider definition = chart.getFilterDefinition(); + + if (definition == null) { + return null; + } + + DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); + TableDataSource tableDataSource = adapter == null ? null : adapter.getBook(); + + TableData tableData = null; + + if (ComparatorUtils.equals(definition.getDataDefinitionType(), OneValueCDDefinition.DEFINITION_TYPE)) { + OneValueCDDefinition oneValueCDDefinition = (OneValueCDDefinition) definition; + tableData = oneValueCDDefinition.getTableData(); + } + + if (ComparatorUtils.equals(definition.getDataDefinitionType(), MoreNameCDDefinition.DEFINITION_TYPE)) { + MoreNameCDDefinition moreNameCDDefinition = (MoreNameCDDefinition) definition; + tableData = moreNameCDDefinition.getTableData(); + } + + if (tableData == null) { + return null; + } + + try { + EmbeddedTableData embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataSource, + tableData, TableData.RESULT_NOT_NEED, false); + + return DesignTableDataManager.getColumnNamesByTableData(embeddedTableData); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return null; + } + } } \ No newline at end of file From a5b5f640910a5a2714f52c87a9a331e58f25bdea Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Tue, 29 Dec 2020 11:22:22 +0800 Subject: [PATCH 064/147] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../richText/VanChartFieldButton.java | 3 +- .../richText/VanChartFieldListPane.java | 60 ++++++++++++++++--- 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java index a3ccc2a47..4e75b9feb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java @@ -2,6 +2,7 @@ package com.fr.van.chart.designer.component.richText; import com.fr.base.BaseUtils; import com.fr.data.util.function.DataFunction; +import com.fr.data.util.function.NoneFunction; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.layout.TableLayout; @@ -36,7 +37,7 @@ public class VanChartFieldButton extends JPanel { private UIToggleButton fieldButton; private UIButton addButton; - private DataFunction dataFunction; + private DataFunction dataFunction = new NoneFunction(); public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, VanChartFieldListener listener) { this.fieldName = fieldName; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index f7fb81d0c..e88937a6a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -1,12 +1,17 @@ package com.fr.van.chart.designer.component.richText; import com.fr.data.util.function.AbstractDataFunction; +import com.fr.data.util.function.DataFunction; import com.fr.design.event.UIObserverListener; import com.fr.design.i18n.Toolkit; import com.fr.design.ui.ModernUIPane; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.TableFieldCollection; +import com.fr.plugin.chart.base.TableFieldDefinition; import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFieldFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; @@ -23,6 +28,7 @@ import java.awt.event.ActionListener; import java.text.Format; import java.util.ArrayList; import java.util.List; +import java.util.Map; public class VanChartFieldListPane extends JPanel { @@ -38,13 +44,14 @@ public class VanChartFieldListPane extends JPanel { private ModernUIPane richEditorPane; private List tableFieldNameList; private List tableFieldButtonList = new ArrayList<>(); + private TableFieldCollection tableFieldCollection = new TableFieldCollection(); private VanChartFieldListener fieldListener; public VanChartFieldListPane(List tableFieldNameList, VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { - this.tableFieldNameList = tableFieldNameList; + this.tableFieldNameList = tableFieldNameList == null ? new ArrayList<>() : tableFieldNameList; this.fieldAttrPane = fieldAttrPane; this.richEditorPane = richEditorPane; @@ -104,7 +111,7 @@ public class VanChartFieldListPane extends JPanel { tableField.setLayout(new GridLayout(0, 1, 1, 0)); for (String name : tableFieldNameList) { - VanChartFieldButton fieldButton = new VanChartFieldButton(name, getTableTooltipFormat(name), true, fieldListener); + VanChartFieldButton fieldButton = new VanChartFieldButton(name, new AttrTooltipFieldFormat(name), true, fieldListener); tableField.add(fieldButton); tableFieldButtonList.add(fieldButton); @@ -115,11 +122,6 @@ public class VanChartFieldListPane extends JPanel { return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); } - // 生成新增字段对应的format - private AttrTooltipFormat getTableTooltipFormat(String fieldName) { - return new AttrTooltipCategoryFormat(); - } - protected List getDefaultFieldButtonList() { List defaultFieldButtonList = new ArrayList<>(); @@ -180,6 +182,16 @@ public class VanChartFieldListPane extends JPanel { } public void addSelectedField(String fieldName, String fieldId) { + if (tableFieldNameList.contains(fieldName)) { + int index = tableFieldNameList.indexOf(fieldName); + + VanChartFieldButton fieldButton = tableFieldButtonList.get(index); + Format fieldFormat = fieldButton.getFormat(); + DataFunction dataFunction = fieldButton.getDataFunction(); + + tableFieldCollection.addFieldDefinition(fieldName, new TableFieldDefinition(fieldName, fieldFormat, dataFunction)); + } + VanChartRichEditorModel model = richEditorPane.update(); model.setAddition(fieldName); VanChartRichEditorPane.richEditorAddField(model); @@ -264,7 +276,35 @@ public class VanChartFieldListPane extends JPanel { } public void populateTableField(AttrTooltipContent tooltipContent) { + TableFieldCollection fieldCollection = tooltipContent.getFieldCollection(); + if (fieldCollection == null) { + return; + } + + Map fieldDefinitionGroup = fieldCollection.getFieldNameFormulaMap(); + + if (fieldDefinitionGroup == null || fieldDefinitionGroup.isEmpty()) { + return; + } + + this.tableFieldCollection = new TableFieldCollection(); + + for (int i = 0, len = tableFieldNameList.size(); i < len; i++) { + String fieldName = tableFieldNameList.get(i); + VanChartFieldButton fieldButton = tableFieldButtonList.get(i); + TableFieldDefinition fieldDefinition = fieldDefinitionGroup.get(fieldName); + + if (fieldDefinitionGroup.containsKey(fieldName)) { + Format fieldFormat = fieldDefinition.getFormat(); + DataFunction dataFunction = fieldDefinition.getDataFunction(); + + fieldButton.setFormat(fieldFormat); + fieldButton.setDataFunction(dataFunction); + + this.tableFieldCollection.addFieldDefinition(fieldName, new TableFieldDefinition(fieldName, fieldFormat, dataFunction)); + } + } } public void update(AttrTooltipContent tooltipContent) { @@ -280,7 +320,11 @@ public class VanChartFieldListPane extends JPanel { } public void updateTableField(AttrTooltipContent tooltipContent) { - + try { + tooltipContent.setFieldCollection(this.tableFieldCollection); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } } public void updateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) { From cd9e4832ce4a606c51ef4b7224c21fc575b7e37f Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Tue, 29 Dec 2020 13:55:09 +0800 Subject: [PATCH 065/147] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=AF=8C=E6=96=87=E6=9C=AC=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 13 +++++++++---- .../component/richText/VanChartFieldListPane.java | 15 +++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index b9472dd86..ba6a55cb8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -15,6 +15,7 @@ import com.fr.design.ui.ModernUIPane; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipRichText; +import com.fr.plugin.chart.base.TableFieldCollection; import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -449,15 +450,19 @@ public class VanChartTooltipContentPane extends BasicBeanPane Date: Tue, 29 Dec 2020 17:00:14 +0800 Subject: [PATCH 066/147] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=8F=82=E6=95=B0=E6=9B=B4=E6=96=B0=E7=9A=84=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 56 ++++++++++++++++--- .../richText/VanChartFieldButton.java | 4 ++ .../richText/VanChartFieldListPane.java | 20 +++++++ .../richText/VanChartRichTextPane.java | 7 ++- 4 files changed, 78 insertions(+), 9 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index ba6a55cb8..66f04a3d3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -16,7 +16,11 @@ import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.TableFieldCollection; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +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.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; @@ -50,7 +54,9 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 数据点提示内容界面,含有通用设置、富文本编辑器、自定义JS界面 @@ -436,15 +442,14 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - VanChartRichTextPane richTextPane = new VanChartRichTextPane(getTableFieldNames(), richEditorPane); + VanChartRichTextPane richTextPane = this.createRichTextPane(getTableFieldNames(), richEditorPane); + BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); - // 更新字段格式和汇总方式 richTextPane.populateBean(this.richTextTooltipContent); - // 更新富文本编辑器内容 richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); richTextDialog.addDialogActionListener(new DialogActionAdapter() { @@ -486,6 +491,42 @@ public class VanChartTooltipContentPane extends BasicBeanPane tableFieldNames, ModernUIPane richEditorPane) { + return new VanChartRichTextPane(tableFieldNames, richEditorPane); + } + + protected void refreshRichTextFormat(AttrTooltipRichText richText) { + String[] fieldNames = new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + + AttrTooltipFormat[] fieldFormats = new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; + + Map params = new HashMap<>(); + + for (int i = 0, len = fieldNames.length; i < len; i++) { + params.put(fieldNames[i], fieldFormats[i].getJs()); + } + + List tableFieldNames = this.getTableFieldNames(); + + if (tableFieldNames != null) { + for (String fieldName : tableFieldNames) { + params.put(fieldName, fieldName); + } + } + + richText.setParams(params); + } + private JPanel createHtmlPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -734,11 +775,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane { public VanChartRichTextPane(List tableFieldNames, ModernUIPane richEditor) { fieldAttrPane = new VanChartFieldAttrPane(); - fieldListPane = new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + fieldListPane = createFieldListPane(tableFieldNames, fieldAttrPane, richEditor); this.setLayout(new BorderLayout()); this.add(createFieldContentPane(), BorderLayout.CENTER); @@ -59,6 +59,11 @@ public class VanChartRichTextPane extends BasicBeanPane { return fieldPane; } + protected VanChartFieldListPane createFieldListPane(List tableFieldNames, VanChartFieldAttrPane fieldAttrPane, + ModernUIPane richEditor) { + return new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + } + private JPanel createRichEditorPane(JPanel richEditor) { JPanel richEditorPane = new JPanel(); From 4854fa76501f08351135f725572e7a3798c36281 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 31 Dec 2020 15:56:38 +0800 Subject: [PATCH 067/147] =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5=E5=90=8D?= =?UTF-8?q?=E7=9A=84=E7=B1=BB=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChartOtherPane.java | 8 ++- .../component/VanChartTooltipContentPane.java | 44 +++----------- .../richText/VanChartFieldListPane.java | 7 ++- .../richText/VanChartRichEditorPane.java | 60 +++++++++++++++++++ .../richText/VanChartRichTextPane.java | 11 ++-- .../designer/style/VanChartStylePane.java | 55 +---------------- 6 files changed, 85 insertions(+), 100 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java index 9b494a1a4..54c010119 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java @@ -13,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.other.ChartConditionAttrPane; import com.fr.design.mainframe.chart.gui.other.ChartInteractivePane; import com.fr.design.mainframe.chart.gui.type.ChartTabPane; import com.fr.design.mainframe.chart.info.ChartInfoCollector; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import javax.swing.JPanel; import java.util.ArrayList; @@ -76,11 +77,11 @@ public class ChartOtherPane extends AbstractChartAttrPane { public String title4PopupWindow() { return PaneTitleConstants.CHART_OTHER_TITLE; } - + private boolean isHaveCondition() { return hasCondition; } - + /** * 设置选中的界面id */ @@ -110,6 +111,7 @@ public class ChartOtherPane extends AbstractChartAttrPane { public void populateBean(Chart chart) { interactivePane.populateBean(chart); if (ChartOtherPane.this.isHaveCondition()) { + VanChartRichEditorPane.refreshFieldNames(chart); conditionAttrPane.populateBean(chart); } } @@ -126,7 +128,7 @@ public class ChartOtherPane extends AbstractChartAttrPane { //特效埋点 ChartInfoCollector.getInstance().updateChartConfig(chart, ConfigType.EFFECT, chart.getBuryingPointEffectConfig()); } - + /** * 注册 切换按钮的切换事件. * @param currentChartEditPane 当前编辑的图表编辑界面. diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 66f04a3d3..544bd3825 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -36,7 +36,6 @@ import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutChe import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import com.fr.van.chart.designer.component.richText.VanChartRichTextDialog; @@ -445,7 +444,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - VanChartRichTextPane richTextPane = this.createRichTextPane(getTableFieldNames(), richEditorPane); + VanChartRichTextPane richTextPane = this.createRichTextPane(richEditorPane); BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); @@ -483,19 +482,11 @@ public class VanChartTooltipContentPane extends BasicBeanPane getTableFieldNames() { - if (parent == null) { - return null; - } - - return parent.getDataModelColumnNames(); - } - - protected VanChartRichTextPane createRichTextPane(List tableFieldNames, ModernUIPane richEditorPane) { - return new VanChartRichTextPane(tableFieldNames, richEditorPane); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + return new VanChartRichTextPane(richEditorPane); } - protected void refreshRichTextFormat(AttrTooltipRichText richText) { + protected void refreshRichTextParams(AttrTooltipRichText richText) { String[] fieldNames = new String[]{ Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), Toolkit.i18nText("Fine-Design_Chart_Series_Name"), @@ -516,7 +507,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane tableFieldNames = this.getTableFieldNames(); + List tableFieldNames = VanChartRichEditorPane.getFieldNames(); if (tableFieldNames != null) { for (String fieldName : tableFieldNames) { @@ -757,30 +748,13 @@ public class VanChartTooltipContentPane extends BasicBeanPane tableFieldNameList, VanChartFieldAttrPane fieldAttrPane, - ModernUIPane richEditorPane) { + public VanChartFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { - this.tableFieldNameList = tableFieldNameList == null ? new ArrayList<>() : tableFieldNameList; + List richEditorFieldNames = VanChartRichEditorPane.getFieldNames(); + + this.tableFieldNameList = richEditorFieldNames == null ? new ArrayList<>() : richEditorFieldNames; this.fieldAttrPane = fieldAttrPane; this.richEditorPane = richEditorPane; 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 87710da55..dcec83deb 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 @@ -1,8 +1,19 @@ package com.fr.van.chart.designer.component.richText; +import com.fr.base.TableData; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; +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.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.type.TextAlign; import com.fr.stable.StringUtils; @@ -11,6 +22,7 @@ import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; +import java.util.List; import java.util.Locale; import java.util.Map; @@ -26,6 +38,54 @@ public class VanChartRichEditorPane { private static ModernUIPane richEditorPane; private static Browser browser; + private static List fieldNames; + + public static List getFieldNames() { + return fieldNames; + } + + public static void refreshFieldNames(Chart chart) { + VanChartRichEditorPane.fieldNames = null; + + if (chart == null) { + return; + } + + TopDefinitionProvider definition = chart.getFilterDefinition(); + + if (definition == null) { + return; + } + + DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); + TableDataSource tableDataSource = adapter == null ? null : adapter.getBook(); + + TableData tableData = null; + + if (ComparatorUtils.equals(definition.getDataDefinitionType(), OneValueCDDefinition.DEFINITION_TYPE)) { + OneValueCDDefinition oneValueCDDefinition = (OneValueCDDefinition) definition; + tableData = oneValueCDDefinition.getTableData(); + } + + if (ComparatorUtils.equals(definition.getDataDefinitionType(), MoreNameCDDefinition.DEFINITION_TYPE)) { + MoreNameCDDefinition moreNameCDDefinition = (MoreNameCDDefinition) definition; + tableData = moreNameCDDefinition.getTableData(); + } + + if (tableData == null) { + 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); + } + } public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { VanChartRichEditorModel model = getRichEditorModel(richEditor); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java index 83ef4853e..93fb9048a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -11,7 +11,6 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import java.awt.BorderLayout; import java.awt.Dimension; -import java.util.List; // 标签提示中的富文本面板,包含字段设置和富文本编辑器 public class VanChartRichTextPane extends BasicBeanPane { @@ -25,10 +24,9 @@ public class VanChartRichTextPane extends BasicBeanPane { private VanChartFieldListPane fieldListPane; private VanChartFieldAttrPane fieldAttrPane; - public VanChartRichTextPane(List tableFieldNames, ModernUIPane richEditor) { - + public VanChartRichTextPane(ModernUIPane richEditor) { fieldAttrPane = new VanChartFieldAttrPane(); - fieldListPane = createFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + fieldListPane = createFieldListPane(fieldAttrPane, richEditor); this.setLayout(new BorderLayout()); this.add(createFieldContentPane(), BorderLayout.CENTER); @@ -59,9 +57,8 @@ public class VanChartRichTextPane extends BasicBeanPane { return fieldPane; } - protected VanChartFieldListPane createFieldListPane(List tableFieldNames, VanChartFieldAttrPane fieldAttrPane, - ModernUIPane richEditor) { - return new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartFieldListPane(fieldAttrPane, richEditor); } private JPanel createRichEditorPane(JPanel richEditor) { 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 f9d0720dc..bb8df99fd 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 @@ -1,21 +1,11 @@ package com.fr.van.chart.designer.style; -import com.fr.base.TableData; -import com.fr.base.chart.chartdata.TopDefinitionProvider; -import com.fr.chart.chartattr.Chart; 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.design.DesignModelAdapter; -import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartStylePane; -import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import com.fr.van.chart.designer.style.axis.VanChartAxisPane; import com.fr.van.chart.designer.style.background.VanChartAreaPane; import com.fr.van.chart.designer.style.datasheet.VanChartDataSheetPane; @@ -87,46 +77,7 @@ public class VanChartStylePane extends ChartStylePane { paneList.add(new VanChartTooltipPane(VanChartStylePane.this)); } - public List getDataModelColumnNames() { - Chart chart = getChart(); - - if (chart == null) { - return null; - } - - TopDefinitionProvider definition = chart.getFilterDefinition(); - - if (definition == null) { - return null; - } - - DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); - TableDataSource tableDataSource = adapter == null ? null : adapter.getBook(); - - TableData tableData = null; - - if (ComparatorUtils.equals(definition.getDataDefinitionType(), OneValueCDDefinition.DEFINITION_TYPE)) { - OneValueCDDefinition oneValueCDDefinition = (OneValueCDDefinition) definition; - tableData = oneValueCDDefinition.getTableData(); - } - - if (ComparatorUtils.equals(definition.getDataDefinitionType(), MoreNameCDDefinition.DEFINITION_TYPE)) { - MoreNameCDDefinition moreNameCDDefinition = (MoreNameCDDefinition) definition; - tableData = moreNameCDDefinition.getTableData(); - } - - if (tableData == null) { - return null; - } - - try { - EmbeddedTableData embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataSource, - tableData, TableData.RESULT_NOT_NEED, false); - - return DesignTableDataManager.getColumnNamesByTableData(embeddedTableData); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - return null; - } + public void refreshTableFieldNames() { + VanChartRichEditorPane.refreshFieldNames(getChart()); } } \ No newline at end of file From 9db265cd919975de2be98503bce75b7e08bbf16e Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 3 Jan 2021 22:15:28 +0800 Subject: [PATCH 068/147] =?UTF-8?q?=E6=95=A3=E7=82=B9=E5=9B=BE=E5=AF=8C?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 28 ++++- .../richText/VanChartFieldListPane.java | 16 +++ .../richText/VanChartRichTextPane.java | 10 +- ...ChartScatterRefreshTooltipContentPane.java | 9 +- .../VanChartScatterRichTextFieldListPane.java | 93 ++++++++++++++ .../VanChartScatterTooltipContentPane.java | 114 ++++++++---------- 6 files changed, 189 insertions(+), 81 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 544bd3825..0698a3291 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -115,9 +115,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane params = new HashMap<>(); @@ -874,6 +888,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane { this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH); } + public VanChartFieldListPane getFieldListPane() { + return fieldListPane; + } + private JPanel createFieldContentPane() { JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); @@ -71,12 +75,16 @@ public class VanChartRichTextPane extends BasicBeanPane { return richEditorPane; } + protected AttrTooltipContent getInitialTooltipContent() { + return new AttrTooltipContent(); + } + public void populateBean(AttrTooltipContent tooltipContent) { fieldListPane.populate(tooltipContent); } public AttrTooltipContent updateBean() { - AttrTooltipContent content = new AttrTooltipContent(); + AttrTooltipContent content = getInitialTooltipContent(); fieldListPane.update(content); return content; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java index db7ce4152..e5416b1c2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java @@ -62,14 +62,7 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo @Override protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextXFormatPane(), null}, - new Component[]{getRichTextYFormatPane(), null}, - new Component[]{getRichTextSizeFormatPane(), null}, - new Component[]{richTextChangedSizeFormatPane, null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; + return null; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java new file mode 100644 index 000000000..776d5397d --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java @@ -0,0 +1,93 @@ +package com.fr.van.chart.scatter; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipSizeFormat; +import com.fr.plugin.chart.base.format.AttrTooltipXFormat; +import com.fr.plugin.chart.base.format.AttrTooltipYFormat; +import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; + +public class VanChartScatterRichTextFieldListPane extends VanChartFieldListPane { + + private VanChartFieldButton richTextXFormatPane; + private VanChartFieldButton richTextYFormatPane; + private VanChartFieldButton richTextSizeFormatPane; + + public VanChartScatterRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + public VanChartFieldButton getRichTextXFormatPane() { + return richTextXFormatPane; + } + + public VanChartFieldButton getRichTextYFormatPane() { + return richTextYFormatPane; + } + + public VanChartFieldButton getRichTextSizeFormatPane() { + return richTextSizeFormatPane; + } + + protected void initDefaultFieldButton() { + super.initDefaultFieldButton(); + + VanChartFieldListener listener = getFieldListener(); + + richTextXFormatPane = new VanChartFieldButton("x", new AttrTooltipXFormat(), false, listener); + richTextYFormatPane = new VanChartFieldButton("y", new AttrTooltipYFormat(), false, listener); + richTextSizeFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), new AttrTooltipSizeFormat(), false, listener); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getSeriesNameButton()); + fieldPane.add(richTextXFormatPane); + fieldPane.add(richTextYFormatPane); + fieldPane.add(richTextSizeFormatPane); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(richTextXFormatPane); + fieldButtonList.add(richTextYFormatPane); + fieldButtonList.add(richTextSizeFormatPane); + + return fieldButtonList; + } + + public void populateDefaultField(AttrTooltipContent tooltipContent) { + super.populateDefaultField(tooltipContent); + + if (tooltipContent instanceof ScatterAttrTooltipContent) { + ScatterAttrTooltipContent scatter = (ScatterAttrTooltipContent) tooltipContent; + + populateButtonFormat(richTextXFormatPane, scatter.getRichTextXFormat()); + populateButtonFormat(richTextYFormatPane, scatter.getRichTextYFormat()); + populateButtonFormat(richTextSizeFormatPane, scatter.getRichTextSizeFormat()); + } + } + + public void updateDefaultField(AttrTooltipContent tooltipContent) { + super.updateDefaultField(tooltipContent); + + if (tooltipContent instanceof ScatterAttrTooltipContent) { + ScatterAttrTooltipContent scatter = (ScatterAttrTooltipContent) tooltipContent; + + updateButtonFormat(richTextXFormatPane, scatter.getRichTextXFormat()); + updateButtonFormat(richTextYFormatPane, scatter.getRichTextYFormat()); + updateButtonFormat(richTextSizeFormatPane, scatter.getRichTextSizeFormat()); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java index 39b20bedb..8e33bd5e2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java @@ -1,17 +1,22 @@ package com.fr.van.chart.scatter; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSizeFormat; +import com.fr.plugin.chart.base.format.AttrTooltipXFormat; +import com.fr.plugin.chart.base.format.AttrTooltipYFormat; import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.XFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.XFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.YFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.YFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -26,10 +31,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa private YFormatPaneWithCheckBox yFormatPane; private ValueFormatPaneWithCheckBox sizeFormatPane; - private XFormatPaneWithoutCheckBox richTextXFormatPane; - private YFormatPaneWithoutCheckBox richTextYFormatPane; - private ValueFormatPaneWithoutCheckBox richTextSizeFormatPane; - public XFormatPaneWithCheckBox getXFormatPane() { return xFormatPane; } @@ -42,18 +43,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa return sizeFormatPane; } - public XFormatPaneWithoutCheckBox getRichTextXFormatPane() { - return richTextXFormatPane; - } - - public YFormatPaneWithoutCheckBox getRichTextYFormatPane() { - return richTextYFormatPane; - } - - public ValueFormatPaneWithoutCheckBox getRichTextSizeFormatPane() { - return richTextSizeFormatPane; - } - public VanChartScatterTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){ super(parent, showOnPane); } @@ -71,13 +60,22 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa sizeFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); + protected void initRichTextTooltipContent() { + setRichTextTooltipContent(new ScatterAttrTooltipContent()); + } + + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartScatterRichTextFieldListPane(fieldAttrPane, richEditor); + } - richTextXFormatPane = new XFormatPaneWithoutCheckBox(parent, showOnPane); - richTextYFormatPane = new YFormatPaneWithoutCheckBox(parent, showOnPane); - richTextSizeFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); + protected AttrTooltipContent getInitialTooltipContent() { + return new ScatterAttrTooltipContent(); + } + }; } @Override @@ -90,16 +88,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa }; } - @Override - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{richTextXFormatPane, null}, - new Component[]{richTextYFormatPane, null}, - new Component[]{richTextSizeFormatPane, null} - }; - } - @Override protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { super.populateFormatPane(attrTooltipContent); @@ -111,30 +99,20 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa } } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - if (attrTooltipContent instanceof ScatterAttrTooltipContent) { - ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + "x", + "y", + Toolkit.i18nText("Fine-Design_Chart_Use_Value")}; + } - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextSeriesNameFormatPane(), - richTextXFormatPane, - richTextYFormatPane, - richTextSizeFormatPane - }; - - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - scatterAttrTooltipContent.getRichTextSeriesFormat(), - scatterAttrTooltipContent.getRichTextXFormat(), - scatterAttrTooltipContent.getRichTextYFormat(), - scatterAttrTooltipContent.getRichTextSizeFormat() - }; - - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); - - checkRichEditorState(attrTooltipContent); - } + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipSeriesFormat(), + new AttrTooltipXFormat(), + new AttrTooltipYFormat(), + new AttrTooltipSizeFormat()}; } @Override @@ -148,14 +126,16 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa } } - protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { - super.updateRichEditor(attrTooltipContent); + protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) { + super.updateTooltipFormat(target, source); - if (attrTooltipContent instanceof ScatterAttrTooltipContent) { - ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; - richTextXFormatPane.update(scatterAttrTooltipContent.getRichTextXFormat()); - richTextYFormatPane.update(scatterAttrTooltipContent.getRichTextYFormat()); - richTextSizeFormatPane.update(scatterAttrTooltipContent.getRichTextSizeFormat()); + if (target instanceof ScatterAttrTooltipContent && source instanceof ScatterAttrTooltipContent) { + ScatterAttrTooltipContent targetScatter = (ScatterAttrTooltipContent) target; + ScatterAttrTooltipContent sourceScatter = (ScatterAttrTooltipContent) source; + + targetScatter.setRichTextXFormat(sourceScatter.getRichTextXFormat()); + targetScatter.setRichTextYFormat(sourceScatter.getRichTextYFormat()); + targetScatter.setRichTextSizeFormat(sourceScatter.getRichTextSizeFormat()); } } From 8462205db47b3f76465f79dff653a623ac4fed00 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 3 Jan 2021 23:05:11 +0800 Subject: [PATCH 069/147] =?UTF-8?q?=E8=AF=8D=E4=BA=91=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 7 +--- .../VanChartScatterTooltipContentPane.java | 6 +-- ...anChartWordCloudRichTextFieldListPane.java | 41 +++++++++++++++++++ .../VanChartWordCloudTooltipContentPane.java | 37 ++++++----------- 4 files changed, 57 insertions(+), 34 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 0698a3291..f2c566230 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -115,8 +115,9 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane) { return new VanChartRichTextPane(richEditorPane) { @@ -73,7 +69,7 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa } protected AttrTooltipContent getInitialTooltipContent() { - return new ScatterAttrTooltipContent(); + return createAttrTooltip(); } }; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java new file mode 100644 index 000000000..3394e6f05 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRichTextFieldListPane.java @@ -0,0 +1,41 @@ +package com.fr.van.chart.wordcloud.designer.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +public class VanChartWordCloudRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartWordCloudRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener fieldListener = getFieldListener(); + + VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + new AttrTooltipCategoryFormat(), false, fieldListener); + + VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Word_Name"), + new AttrTooltipNameFormat(), false, fieldListener); + + VanChartFieldButton valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Word_Value"), + new AttrTooltipValueFormat(), false, fieldListener); + + VanChartFieldButton percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); + + setCategoryNameButton(categoryNameButton); + setSeriesNameButton(seriesNameButton); + setValueButton(valueButton); + setPercentButton(percentButton); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java index c0e9ac6c3..99b437861 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java @@ -2,17 +2,18 @@ package com.fr.van.chart.wordcloud.designer.style; import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -53,31 +54,19 @@ public class VanChartWordCloudTooltipContentPane extends VanChartTooltipContentP setPercentFormatPane(percentFormatPane); } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); - } - }; - SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Word_Name"); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartWordCloudRichTextFieldListPane(fieldAttrPane, richEditor); } - }; - ValueFormatPaneWithoutCheckBox richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Word_Value"); + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); } }; - PercentFormatPaneWithoutCheckBox richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane); - - setRichTextCategoryNameFormatPane(richTextCategoryNameFormatPane); - setRichTextSeriesNameFormatPane(richTextSeriesNameFormatPane); - setRichTextValueFormatPane(richTextValueFormatPane); - setRichTextPercentFormatPane(richTextPercentFormatPane); } - @Override protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat()); From 57c73aa26dff888a3df88bfbbefd3e015f3abd96 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 4 Jan 2021 16:04:46 +0800 Subject: [PATCH 070/147] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=AF=8D=E4=BA=91?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=AF=8C=E6=96=87=E6=9C=AC=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VanChartWordCloudTooltipContentPane.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java index 99b437861..0abd60ac1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudTooltipContentPane.java @@ -4,7 +4,11 @@ package com.fr.van.chart.wordcloud.designer.style; import com.fr.design.i18n.Toolkit; import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; @@ -67,6 +71,24 @@ public class VanChartWordCloudTooltipContentPane extends VanChartTooltipContentP }; } + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Word_Name"), + Toolkit.i18nText("Fine-Design_Chart_Word_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipNameFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; + } + protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent attrTooltipContent = new AttrTooltipContent(); attrTooltipContent.setSeriesFormat(new AttrTooltipNameFormat()); From 428204f0d2eaf43481b7c8f468e51e48efdb4d45 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 4 Jan 2021 16:33:58 +0800 Subject: [PATCH 071/147] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E9=9D=A2=E6=9D=BF=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VanChartMapRichTextFieldListPane.java | 41 +++++++++++++++++++ .../label/VanChartMapLabelContentPane.java | 32 ++++++++++----- .../VanChartMapTooltipContentPane.java | 31 +++++++++----- 3 files changed, 84 insertions(+), 20 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java new file mode 100644 index 000000000..91e1817ef --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapRichTextFieldListPane.java @@ -0,0 +1,41 @@ +package com.fr.van.chart.map.designer.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; +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.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +public class VanChartMapRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartMapRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener fieldListener = getFieldListener(); + + VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Area_Name"), + new AttrTooltipAreaNameFormat(), false, fieldListener); + + VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + new AttrTooltipSeriesFormat(), false, fieldListener); + + VanChartFieldButton valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + new AttrTooltipValueFormat(), false, fieldListener); + + VanChartFieldButton percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); + + setCategoryNameButton(categoryNameButton); + setSeriesNameButton(seriesNameButton); + setValueButton(valueButton); + setPercentButton(percentButton); + } +} 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 084953c99..baec70ca9 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,18 +1,19 @@ package com.fr.van.chart.map.designer.style.label; +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat; +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.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -21,6 +22,7 @@ import javax.swing.JPanel; * Created by Mitisky on 16/5/20. */ public class VanChartMapLabelContentPane extends VanChartLabelContentPane { + public VanChartMapLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) { super(parent, showOnPane, inCondition); } @@ -33,12 +35,22 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new MapAreaNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipAreaNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java index 12948b14d..03f720bf7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java @@ -1,17 +1,18 @@ package com.fr.van.chart.map.designer.style.tooltip; +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipMapValueFormat; +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.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -32,12 +33,22 @@ public class VanChartMapTooltipContentPane extends VanChartTooltipContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new MapAreaNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipAreaNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } @Override From dbf0cba2f6542b9ebfaa15ffaed028ddfa4788df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 20 Jan 2021 13:36:27 +0800 Subject: [PATCH 072/147] =?UTF-8?q?CHART-17958=20=20=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E9=85=8D=E8=89=B2=E5=8F=96=E8=89=B2=E5=99=A8=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/style/color/ColorAdjustPane.java | 4 ++++ .../java/com/fr/design/style/color/ColorSelectPane.java | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java b/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java index 909501857..fcdc594b5 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java @@ -206,6 +206,10 @@ public class ColorAdjustPane extends JPanel implements UIObserver { public void setVisible(boolean b) { super.setVisible(b); } + + protected boolean selectRealTime() { + return false; + } }; colorPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java index c82eac0c0..68c1b2b99 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java @@ -115,12 +115,16 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable row1Pane.setPreferredSize(new Dimension(135, 24)); // 宽度为 16 * 8 + 7 // 最近使用 - UsedColorPane usedColorPane = new UsedColorPane(1, 8, 1, this, true, true); + UsedColorPane usedColorPane = new UsedColorPane(1, 8, 1, this, true, selectRealTime()); usedColorPane.getPane().setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 8)); row1Pane.add(usedColorPane.getPane()); return row1Pane; } + protected boolean selectRealTime() { + return true; + } + protected Color[] getColorArray() { return ColorFactory.MenuColors; } From 0368ee251bf5936f59d1abee25cf506608b9c603 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 21 Jan 2021 10:16:42 +0800 Subject: [PATCH 073/147] =?UTF-8?q?REPORT-43833=20=E3=80=9010.0.14?= =?UTF-8?q?=E3=80=91=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5/=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E5=A2=9E=E5=8A=A0=E9=94=81=E5=AE=9A=20?= =?UTF-8?q?=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E6=8F=90=E4=BA=A4=20=E3=80=90=E6=94=B9=E5=8A=A8?= =?UTF-8?q?=E6=80=9D=E8=B7=AF=E3=80=91=E8=BF=AD=E4=BB=A3=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/UpdateAction.java | 52 +++++++------- .../actions/server/ConnectionListAction.java | 39 +++++++++-- .../actions/server/GlobalTableDataAction.java | 44 +++++++++++- .../design/data/BasicTableDataTreePane.java | 23 +++++++ .../connect/ConnectionComboBoxPanel.java | 48 ++++++++++++- .../connect/ItemEditableComboBoxPanel.java | 58 ++++++++-------- .../editlock/ConnectionLockChangeChecker.java | 25 +++++++ .../editlock/EditLockChangeChecker.java | 67 ++++++++++++++++++ .../design/editlock/EditLockChangeEvent.java | 25 +++++++ .../editlock/EditLockChangeListener.java | 16 +++++ .../com/fr/design/editlock/EditLockUtils.java | 69 +++++++++++++++++++ .../ServerTableDataLockChangeChecker.java | 23 +++++++ .../fr/design/gui/ibutton/UILockButton.java | 46 +++++++++++++ .../fr/design/gui/imenu/UILockMenuItem.java | 47 +++++++++++++ .../fr/design/gui/imenu/UILockMenuItemUI.java | 28 ++++++++ .../design/os/impl/DatabaseDialogAction.java | 14 +++- .../images/m_web/connection_locked_normal.svg | 15 ++++ .../fr/design/images/m_web/locked_normal.svg | 14 ++++ .../images/m_web/warningIcon_normal.svg | 21 ++++++ .../module/DesignerWorkspaceProvider.java | 14 ++++ 20 files changed, 625 insertions(+), 63 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java create mode 100644 designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java create mode 100644 designer-base/src/main/java/com/fr/design/editlock/EditLockChangeEvent.java create mode 100644 designer-base/src/main/java/com/fr/design/editlock/EditLockChangeListener.java create mode 100644 designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java create mode 100644 designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_web/connection_locked_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_web/locked_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon_normal.svg diff --git a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java index bb4ba4ccc..5c12ff29c 100644 --- a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java @@ -339,33 +339,37 @@ public abstract class UpdateAction extends ShortCut implements Action { if (!(object instanceof AbstractButton)) { UIButton button = null; button = new UIButton(); - // 添加一个名字作为自动化测试用 - button.setName(getName()); - button.set4ToolbarButton(); - - //设置属性. - Integer mnemonicInteger = (Integer) this.getValue(Action.MNEMONIC_KEY); - if (mnemonicInteger != null) { - button.setMnemonic((char) mnemonicInteger.intValue()); - } - - button.setIcon((Icon) this.getValue(Action.SMALL_ICON)); - setPressedIcon4Button(button); - setDisabledIcon4Button(button); - button.addActionListener(this); + object = initButton(button, UIButton.class.getName()); + } - button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); + return (JComponent) object; + } - this.putValue(UIButton.class.getName(), button); - button.setText(StringUtils.EMPTY); - button.setEnabled(this.isEnabled()); + protected JComponent initButton(UIButton button, String name) { + // 添加一个名字作为自动化测试用 + button.setName(getName()); + button.set4ToolbarButton(); - //peter:产生tooltip - button.setToolTipText(getToolTipText()); - object = button; + //设置属性. + Integer mnemonicInteger = (Integer) this.getValue(Action.MNEMONIC_KEY); + if (mnemonicInteger != null) { + button.setMnemonic((char) mnemonicInteger.intValue()); } - return (JComponent) object; + button.setIcon((Icon) this.getValue(Action.SMALL_ICON)); + setPressedIcon4Button(button); + setDisabledIcon4Button(button); + button.addActionListener(this); + + button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); + + this.putValue(name, button); + button.setText(StringUtils.EMPTY); + button.setEnabled(this.isEnabled()); + + //peter:产生tooltip + button.setToolTipText(getToolTipText()); + return button; } /** @@ -641,14 +645,14 @@ public abstract class UpdateAction extends ShortCut implements Action { shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator); } - private void setPressedIcon4Button(AbstractButton button) { + protected void setPressedIcon4Button(AbstractButton button) { Icon pressedIcon = (Icon) this.getValue(UpdateAction.PRESSED_ICON); if (pressedIcon != null && pressedIcon instanceof SVGIcon) { button.setPressedIcon(pressedIcon); } } - private void setDisabledIcon4Button(AbstractButton button) { + protected void setDisabledIcon4Button(AbstractButton button) { Icon disabledIcon = (Icon) this.getValue(UpdateAction.DISABLED_ICON); if (disabledIcon != null && disabledIcon instanceof SVGIcon) { button.setDisabledIcon(disabledIcon); diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 820de79e5..45502c073 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -1,19 +1,25 @@ package com.fr.design.actions.server; -import com.fr.base.svg.IconUtils; import com.fr.data.impl.Connection; import com.fr.design.actions.UpdateAction; import com.fr.design.data.datapane.connect.ConnectionShowPane; import com.fr.design.data.datapane.connect.DatabaseConnectionPane; import com.fr.design.dialog.BasicDialog; +import com.fr.design.editlock.ConnectionLockChangeChecker; +import com.fr.design.editlock.EditLockUtils; import com.fr.design.gui.NameInspector; +import com.fr.design.gui.ibutton.UILockButton; +import com.fr.design.gui.imenu.UILockMenuItem; +import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.menu.MenuKeySet; +import com.fr.stable.StringUtils; import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; import com.fr.design.os.impl.DatabaseDialogAction; import com.fr.file.ConnectionConfig; +import com.fr.workspace.server.lock.editlock.LockItem; -import javax.swing.*; +import javax.swing.KeyStroke; import java.awt.event.ActionEvent; import java.util.Map; @@ -53,8 +59,16 @@ public class ConnectionListAction extends UpdateAction { * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { - OSBasedAction osBasedAction = OSSupportCenter.getAction(DatabaseDialogAction.class); - osBasedAction.execute(); + // 尝试为数据连接加锁 + boolean actionLock = EditLockUtils.lock(LockItem.CONNECTION); + if (!actionLock) { + // 锁定失败,代表已经被其他用户锁定,跳出弹窗提示 + EditLockUtils.showLockMessage(); + } else { + // 锁定成功,执行后续操作 + OSBasedAction osBasedAction = OSSupportCenter.getAction(DatabaseDialogAction.class); + osBasedAction.execute(); + } } /** @@ -96,4 +110,21 @@ public class ConnectionListAction extends UpdateAction { public void update() { this.setEnabled(true); } + + @Override + public UIMenuItem createMenuItem() { + Object object = this.getValue(UILockMenuItem.class.getName()); + if (object == null && !(object instanceof UILockMenuItem)) { + UILockMenuItem menuItem = new UILockMenuItem(this, EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, StringUtils.EMPTY, LockItem.CONNECTION); + // 设置名字用作单元测 + menuItem.setName(getName()); + setPressedIcon4Button(menuItem); + setDisabledIcon4Button(menuItem); + object = menuItem; + + this.putValue(UILockMenuItem.class.getName(), object); + ConnectionLockChangeChecker.getInstance().addEditLockChangeListener((UILockMenuItem)object); + } + return (UILockMenuItem) object; + } } diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index 468fb1f98..14795066d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java @@ -4,7 +4,6 @@ package com.fr.design.actions.server; import com.fr.base.TableData; -import com.fr.base.svg.IconUtils; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.data.DesignTableDataManager; @@ -13,18 +12,24 @@ import com.fr.design.data.tabledata.ResponseDataSourceChange; import com.fr.design.data.tabledata.tabledatapane.TableDataManagerPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.editlock.EditLockUtils; +import com.fr.design.editlock.ServerTableDataLockChangeChecker; import com.fr.design.gui.NameInspector; +import com.fr.design.gui.imenu.UILockMenuItem; +import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.file.TableDataConfig; +import com.fr.stable.StringUtils; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; +import com.fr.workspace.server.lock.editlock.LockItem; import javax.swing.KeyStroke; -import java.awt.*; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.util.HashMap; import java.util.Map; @@ -66,6 +71,14 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { + // 尝试为服务器数据集加锁 + boolean actionLock = EditLockUtils.lock(LockItem.SERVER_TABLE_DATA); + if (!actionLock) { + // 锁定失败,代表已经被其他用户锁定,跳出弹窗提示 + EditLockUtils.showLockMessage(); + return; + } + // 锁定成功,执行后续操作 final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); final TableDataConfig tableDataConfig = TableDataConfig.getInstance(); final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { @@ -90,7 +103,8 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS globalTableDataDialog.setDoOKSucceed(false); return; } - + // 关闭服务器数据集页面,为其解锁 + EditLockUtils.unlock(LockItem.SERVER_TABLE_DATA); DesignTableDataManager.clearGlobalDs(); // 保存时 移除服务器数据集列名缓存 for (String name : tableDataConfig.getTableDatas().keySet()) { @@ -117,6 +131,13 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS } })); } + + @Override + public void doCancel() { + super.doCancel(); + // 关闭服务器数据集页面,为其解锁 + EditLockUtils.unlock(LockItem.SERVER_TABLE_DATA); + } }); globalTableDataDialog.setVisible(true); } @@ -166,4 +187,21 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS public void fireDSChanged(Map map) { DesignTableDataManager.fireDSChanged(map); } + + @Override + public UIMenuItem createMenuItem() { + Object object = this.getValue(UILockMenuItem.class.getName()); + if (object == null && !(object instanceof UILockMenuItem)) { + UILockMenuItem menuItem = new UILockMenuItem(this, EditLockUtils.SERVER_TABLEDATA_LOCKED_TOOLTIPS, StringUtils.EMPTY, LockItem.SERVER_TABLE_DATA); + // 设置名字用作单元测 + menuItem.setName(getName()); + setPressedIcon4Button(menuItem); + setDisabledIcon4Button(menuItem); + object = menuItem; + + this.putValue(UILockMenuItem.class.getName(), object); + ServerTableDataLockChangeChecker.getInstance().addEditLockChangeListener((UILockMenuItem)object); + } + return (UILockMenuItem) object; + } } diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index 83740f685..34482d0d2 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -18,7 +18,10 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; +import com.fr.design.editlock.ConnectionLockChangeChecker; +import com.fr.design.editlock.EditLockUtils; import com.fr.design.gui.ibutton.UIHeadGroup; +import com.fr.design.gui.ibutton.UILockButton; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.icon.IconPathConstants; @@ -31,8 +34,11 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; +import javax.swing.AbstractButton; +import javax.swing.Action; import javax.swing.DefaultCellEditor; import javax.swing.Icon; +import javax.swing.JComponent; import javax.swing.JTree; import javax.swing.event.CellEditorListener; import javax.swing.event.ChangeEvent; @@ -439,6 +445,23 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp this.setMnemonic('D'); this.setSmallIcon("/com/fr/design/images/m_web/connection"); } + + @Override + public JComponent createToolBarComponent() { + Object object = this.getValue(UILockButton.class.getName()); + if (!(object instanceof AbstractButton)) { + UILockButton button = new UILockButton( + EditLockUtils.CONNECTION_LOCKED_ICON, + (Icon) this.getValue(Action.SMALL_ICON), + EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, + getToolTipText() + ); + initButton(button, UILockButton.class.getName()); + object = button; + ConnectionLockChangeChecker.getInstance().addEditLockChangeListener((UILockButton)object); + } + return (JComponent) object; + } } /** diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index f4a7910b1..91813418b 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -1,5 +1,6 @@ package com.fr.design.data.datapane.connect; +import com.fr.base.svg.IconUtils; import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.Connection; import com.fr.data.impl.NameDatabaseConnection; @@ -7,6 +8,10 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.actions.server.ConnectionListAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.editlock.ConnectionLockChangeChecker; +import com.fr.design.editlock.EditLockUtils; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UILockButton; import com.fr.design.mainframe.DesignerContext; import com.fr.file.ConnectionConfig; import com.fr.general.ComparatorUtils; @@ -16,8 +21,12 @@ import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; import com.fr.workspace.WorkContext; import com.fr.workspace.server.connection.DBConnectAuth; +import com.fr.workspace.server.lock.editlock.LockItem; import javax.swing.SwingUtilities; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; @@ -56,6 +65,25 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { refreshItems(); } + @Override + protected UIButton initEditButton(UIButton editButton, Dimension buttonSize) { + editButton = new UILockButton( + EditLockUtils.CONNECTION_LOCKED_ICON, + IconUtils.readIcon("/com/fr/design/images/m_web/connection"), + EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, + StringUtils.EMPTY + ); + editButton.setIcon(IconUtils.readIcon("/com/fr/design/images/m_web/connection")); + editButton.setPreferredSize(buttonSize); + editButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + editItems(); + } + }); + ConnectionLockChangeChecker.getInstance().addEditLockChangeListener((UILockButton) editButton); + return editButton; + } + /* * 刷新ComboBox.items */ @@ -97,6 +125,14 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { * 弹出对话框编辑Items */ protected void editItems() { + // 尝试为数据连接加锁 + boolean actionLock = EditLockUtils.lock(LockItem.CONNECTION); + if (!actionLock) { + // 锁定失败,代表已经被其他用户锁定,跳出弹窗提示 + EditLockUtils.showLockMessage(); + return; + } + // 锁定成功,执行后续操作 final ConnectionListPane connectionListPane = new ConnectionListPane(); final ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); ConnectionConfig cloned = connectionConfig.mirror(); @@ -109,7 +145,8 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { connectionListDialog.setDoOKSucceed(false); return; } - + // 关闭定义数据连接页面,为其解锁 + EditLockUtils.unlock(LockItem.CONNECTION); Configurations.modify(new WorkerFacade(ConnectionConfig.class) { @Override public void run() { @@ -129,6 +166,13 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { })); } + + @Override + public void doCancel() { + // 关闭定义数据连接页面,为其解锁 + super.doCancel(); + EditLockUtils.unlock(LockItem.CONNECTION); + } }); connectionListDialog.setVisible(true); refreshItems(); @@ -158,4 +202,4 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { } } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java index 1c61eea26..f06d1405b 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java @@ -12,7 +12,7 @@ import java.awt.event.ActionListener; public abstract class ItemEditableComboBoxPanel extends JPanel { /** - * + * */ private static final long serialVersionUID = 1L; @@ -21,37 +21,29 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { return ""; } }; - + protected UIComboBox itemComboBox; protected UIButton editButton; protected UIButton refreshButton; - + public ItemEditableComboBoxPanel() { super(); - + initComponents(); } - + protected void initComponents() { this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); - + Dimension buttonSize = new Dimension(26, 20); itemComboBox = new UIComboBox(); itemComboBox.setEnabled(true); this.add(itemComboBox, BorderLayout.CENTER); - - editButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/control-center2.png")); refreshButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); JPanel jPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 4 ,4); + editButton = initEditButton(editButton, buttonSize); jPanel.add(editButton); jPanel.add(refreshButton); this.add(jPanel, BorderLayout.EAST); - Dimension buttonSize = new Dimension(26, 20); - editButton.setPreferredSize(buttonSize); - editButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { - editItems(); - } - }); refreshButton.setPreferredSize(buttonSize); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -59,32 +51,44 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { } }); } - + + protected UIButton initEditButton(UIButton editButton, Dimension buttonSize) { + editButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/control-center2.png")); + editButton.setPreferredSize(buttonSize); + editButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + editItems(); + } + }); + return editButton; + } + + /** * 给itemComboBox添加ActionListener */ public void addComboBoxActionListener(ActionListener l) { itemComboBox.addActionListener(l); } - + /* * 刷新itemComboBox的内容 */ protected void refreshItems() { // 记录原来选中的Item,重新加载后需要再次选中 Object lastSelectedItem = itemComboBox.getSelectedItem(); - + DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel()); model.removeAllElements(); - + // 先加EMPTY,再加items model.addElement(EMPTY); - + java.util.Iterator itemIt = items(); while(itemIt.hasNext()) { model.addElement(itemIt.next()); } - + // 再次选中之前选中的Item int idx = model.getIndexOf(lastSelectedItem); if(idx < 0) { @@ -92,16 +96,16 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { } itemComboBox.setSelectedIndex(idx); } - + /* * 得到其中的itemComboBox所选中的Item */ public String getSelectedItem() { Object selected = itemComboBox.getSelectedItem(); - + return selected instanceof String ? (String)selected : null; } - + /* * 选中name项 */ @@ -109,14 +113,14 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel()); model.setSelectedItem(name); } - + /* * 刷新ComboBox.items */ protected abstract java.util.Iterator items(); - + /* * 弹出对话框编辑Items */ protected abstract void editItems(); -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java b/designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java new file mode 100644 index 000000000..ac80cd53c --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java @@ -0,0 +1,25 @@ +package com.fr.design.editlock; + + +import com.fr.workspace.server.lock.editlock.LockItem; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2021/1/20 + * 定义数据连接的checker + */ +public class ConnectionLockChangeChecker extends EditLockChangeChecker{ + + private static class Holder { + private static final ConnectionLockChangeChecker INSTANCE = new ConnectionLockChangeChecker(); + } + + public static ConnectionLockChangeChecker getInstance() { + return ConnectionLockChangeChecker.Holder.INSTANCE; + } + + public ConnectionLockChangeChecker() { + this.lockItem = LockItem.CONNECTION; + } +} diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java new file mode 100644 index 000000000..13ac921e3 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java @@ -0,0 +1,67 @@ +package com.fr.design.editlock; + +import com.fr.concurrent.NamedThreadFactory; +import com.fr.log.FineLoggerFactory; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.lock.editlock.EditLockOperator; +import com.fr.workspace.server.lock.editlock.LockItem; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2021/1/19 + * 判断当前设计器在远程设计服务器中的锁状态是否发生了改变 + */ +public abstract class EditLockChangeChecker { + + private static final int INTERVAL = 30000; + private ScheduledExecutorService scheduler; + protected LockItem lockItem; + private boolean isLocked = false; + private List listeners = new ArrayList<>(); + + /** + * 轮询任务,如果是远程设计状态,每隔30s查询一次相应lockItem的锁状态是否改变 + */ + public void start() { + this.scheduler = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("EditLockChangeChecker")); + this.scheduler.scheduleAtFixedRate(new Runnable() { + @Override + public void run() { + // 判断是否为远程设计环境 + if (!WorkContext.getCurrent().isLocal()) { + try { + EditLockOperator operator = WorkContext.getCurrent().get(EditLockOperator.class); + boolean locked = operator.isLocked(lockItem); + if (isLocked != locked) { + isLocked = locked; + fireChange(); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + }, 0, INTERVAL, TimeUnit.MILLISECONDS); + } + + public void stop() { + this.scheduler.shutdown(); + } + + public void addEditLockChangeListener(EditLockChangeListener listener) { + this.listeners.add(listener); + } + + private void fireChange() { + for (EditLockChangeListener listener : this.listeners) { + listener.updateLockedState(new EditLockChangeEvent(isLocked)); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeEvent.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeEvent.java new file mode 100644 index 000000000..66420fd0b --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeEvent.java @@ -0,0 +1,25 @@ +package com.fr.design.editlock; + +import java.util.EventObject; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2021/1/20 + */ +public class EditLockChangeEvent extends EventObject { + + private boolean isLocked; + + /** + * @param source 锁状态发生了改变,且当前锁状态就是source + */ + public EditLockChangeEvent(boolean source) { + super(source); + this.isLocked = source; + } + + public boolean isLocked() { + return isLocked; + } +} diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeListener.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeListener.java new file mode 100644 index 000000000..dcabe87cc --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeListener.java @@ -0,0 +1,16 @@ +package com.fr.design.editlock; + +import java.util.EventListener; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2021/1/20 + */ +public interface EditLockChangeListener extends EventListener { + /** + * 锁定状态改变后执行的动作 + * @param event 事件 + */ + void updateLockedState(EditLockChangeEvent event); +} diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java new file mode 100644 index 000000000..20708462d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java @@ -0,0 +1,69 @@ +package com.fr.design.editlock; + +import com.fr.base.svg.IconUtils; +import com.fr.base.svg.SVGLoader; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.lock.editlock.EditLockOperator; +import com.fr.workspace.server.lock.editlock.LockItem; +import org.jetbrains.annotations.Nullable; + +import javax.swing.Icon; +import javax.swing.JOptionPane; +import java.awt.Image; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2021/1/20 + * 关于编辑锁定的一些常量和静态方法 + */ +public class EditLockUtils { + + /** + * 数据连接锁定标志 + */ + public static final Icon CONNECTION_LOCKED_ICON = IconUtils.readIcon("/com/fr/design/images/m_web/connection_locked"); + + /** + * 小锁图片 + */ + public static final @Nullable Image LOCKED_IMAGE = SVGLoader.load("/com/fr/design/images/m_web/locked_normal.svg"); + + public static final Icon TOOLTIPS_ICON = IconUtils.readIcon("/com/fr/design/images/m_web/warningIcon"); + + /** + * 数据连接锁定中 + */ + public static final String CONNECTION_LOCKED_TOOLTIPS = Toolkit.i18nText("Fine_Designer_Remote_Design_Data_Connection_Locked"); + + /** + * 服务器数据集锁定中 + */ + public static final String SERVER_TABLEDATA_LOCKED_TOOLTIPS = Toolkit.i18nText("Fine_Designer_Remote_Design_Server_TableData_Locked"); + + public static final String LOCKED_MESSAGE = Toolkit.i18nText("Fine_Designer_Remote_Design_Locked_Message"); + + public static final String TOOLTIPS = Toolkit.i18nText("Fine-Engine_Report_Tooltips"); + + /** + * 已经被锁,跳出弹窗提示 + */ + public static void showLockMessage() { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), EditLockUtils.LOCKED_MESSAGE, EditLockUtils.TOOLTIPS, JOptionPane.INFORMATION_MESSAGE, EditLockUtils.TOOLTIPS_ICON); + } + + public static boolean lock(LockItem lockItem) { + return WorkContext.getCurrent().get(EditLockOperator.class).lock(lockItem); + } + + public static boolean unlock(LockItem lockItem) { + return WorkContext.getCurrent().get(EditLockOperator.class).unlock(lockItem); + } + + public static boolean isLocked(LockItem lockItem) { + return WorkContext.getCurrent().get(EditLockOperator.class).isLocked(lockItem); + } +} diff --git a/designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java b/designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java new file mode 100644 index 000000000..a3f2bbbf4 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java @@ -0,0 +1,23 @@ +package com.fr.design.editlock; + +import com.fr.workspace.server.lock.editlock.LockItem; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2021/1/20 + * 服务器数据集的checker + */ +public class ServerTableDataLockChangeChecker extends EditLockChangeChecker{ + private static class Holder { + private static final ServerTableDataLockChangeChecker INSTANCE = new ServerTableDataLockChangeChecker(); + } + + public static ServerTableDataLockChangeChecker getInstance() { + return ServerTableDataLockChangeChecker.Holder.INSTANCE; + } + + public ServerTableDataLockChangeChecker() { + this.lockItem = LockItem.SERVER_TABLE_DATA; + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java new file mode 100644 index 000000000..aa643b6c1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java @@ -0,0 +1,46 @@ +package com.fr.design.gui.ibutton; + +import com.fr.design.editlock.EditLockChangeEvent; +import com.fr.design.editlock.EditLockChangeListener; + +import javax.swing.Icon; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2021/1/20 + */ +public class UILockButton extends UIButton implements EditLockChangeListener { + + /** + * 锁定状态图标 + */ + private Icon lockedIcon; + /** + * 正常状态图标 + */ + private Icon normalIcon; + /** + * 锁定状态的提示信息 + */ + private String lockedTooltips; + /** + * 正常状态的提示信息 + */ + private String normalTooltips; + + public UILockButton(Icon lockedIcon, Icon normalIcon, String lockedTooltips, String normalTooltips) { + super(); + this.lockedIcon = lockedIcon; + this.normalIcon = normalIcon; + this.lockedTooltips = lockedTooltips; + this.normalTooltips = normalTooltips; + } + + @Override + public void updateLockedState(EditLockChangeEvent event) { + this.setIcon(event.isLocked() ? lockedIcon : normalIcon); + this.setToolTipText(event.isLocked() ? lockedTooltips : normalTooltips); + this.repaint(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java new file mode 100644 index 000000000..092b76516 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java @@ -0,0 +1,47 @@ +package com.fr.design.gui.imenu; + +import com.fr.design.editlock.EditLockChangeEvent; +import com.fr.design.editlock.EditLockChangeListener; +import com.fr.workspace.server.lock.editlock.LockItem; + +import javax.swing.Action; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2021/1/20 + */ +public class UILockMenuItem extends UIMenuItem implements EditLockChangeListener { + + /** + * 锁定状态的提示信息 + */ + private String lockedTooltips; + /** + * 正常状态的提示信息 + */ + private String normalTooltips; + + /** + * 当前锁定项 + */ + private LockItem lockItem; + + public UILockMenuItem(Action action, String lockedTooltips, String normalTooltips, LockItem lockItem) { + super(action); + this.lockedTooltips = lockedTooltips; + this.normalTooltips = normalTooltips; + this.lockItem = lockItem; + setUI(new UILockMenuItemUI()); + } + + public LockItem getLockItem() { + return lockItem; + } + + @Override + public void updateLockedState(EditLockChangeEvent event) { + this.setToolTipText(event.isLocked() ? lockedTooltips : normalTooltips); + this.repaint(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java new file mode 100644 index 000000000..c0f70795b --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java @@ -0,0 +1,28 @@ +package com.fr.design.gui.imenu; + +import com.fr.design.editlock.EditLockUtils; + +import javax.swing.JMenuItem; +import java.awt.Graphics; +import java.awt.Rectangle; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2021/1/20 + */ +public class UILockMenuItemUI extends UIMenuItemUI{ + + @Override + protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { + super.paintText(g, menuItem, textRect, text); + // 除了绘制text之外,还需要画一下锁定图标 + UILockMenuItem lockMenuItem = (UILockMenuItem) menuItem; + if (EditLockUtils.isLocked(lockMenuItem.getLockItem())) { + int width = menuItem.getWidth(); + int height = menuItem.getHeight(); + g.drawImage(EditLockUtils.LOCKED_IMAGE, (int) Math.round(width * 0.9), (int) Math.round(height * 0.1), 16, 16, null); + } + + } +} diff --git a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java index acd906897..3d343ab93 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java @@ -1,18 +1,17 @@ package com.fr.design.os.impl; -import com.fr.config.ServerPreferenceConfig; import com.fr.design.data.datapane.connect.ConnectionManagerPane; -import com.fr.design.dcm.UniversalDatabaseOpener; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.editlock.EditLockUtils; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.file.ConnectionConfig; -import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.support.OSBasedAction; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; +import com.fr.workspace.server.lock.editlock.LockItem; import static com.fr.design.actions.server.ConnectionListAction.doWithDatasourceManager; /** @@ -53,6 +52,8 @@ public class DatabaseDialogAction implements OSBasedAction { databaseListDialog.setDoOKSucceed(false); return; } + // 定义数据连接弹窗关闭后,解锁 + EditLockUtils.unlock(LockItem.CONNECTION); Configurations.modify(new WorkerFacade(ConnectionConfig.class) { @Override public void run() { @@ -71,6 +72,13 @@ public class DatabaseDialogAction implements OSBasedAction { } })); } + + @Override + public void doCancel() { + super.doCancel(); + // 定义数据连接弹窗关闭后,解锁 + EditLockUtils.unlock(LockItem.CONNECTION); + } }); databaseListDialog.setVisible(true); } diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/connection_locked_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/connection_locked_normal.svg new file mode 100644 index 000000000..b1b9d1792 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/connection_locked_normal.svg @@ -0,0 +1,15 @@ + + + 编组 3 + + + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/locked_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/locked_normal.svg new file mode 100644 index 000000000..b3b2ac74f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/locked_normal.svg @@ -0,0 +1,14 @@ + + + 编组 2 + + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon_normal.svg new file mode 100644 index 000000000..b7748925d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon_normal.svg @@ -0,0 +1,21 @@ + + + icon_WarningIcon_normal + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index a7ef4f108..0a572e672 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -3,6 +3,8 @@ package com.fr.start.module; import com.fr.design.DesignerEnvManager; import com.fr.design.EnvChangeEntrance; import com.fr.design.constants.DesignerLaunchStatus; +import com.fr.design.editlock.ConnectionLockChangeChecker; +import com.fr.design.editlock.ServerTableDataLockChangeChecker; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.LocalDesignerWorkspaceInfo; @@ -88,6 +90,12 @@ public class DesignerWorkspaceProvider extends Activator { } } pluginErrorRemind(); + editLockCheckerStart(); + } + + private void editLockCheckerStart() { + ConnectionLockChangeChecker.getInstance().start(); + ServerTableDataLockChangeChecker.getInstance().start(); } private void pluginErrorRemind() { @@ -102,6 +110,12 @@ public class DesignerWorkspaceProvider extends Activator { @Override public void stop() { // void + editLockCheckerStop(); + } + + private void editLockCheckerStop() { + ConnectionLockChangeChecker.getInstance().stop(); + ServerTableDataLockChangeChecker.getInstance().stop(); } @Override From 389483541d0ae4c56af540024925973d33281693 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 21 Jan 2021 14:36:38 +0800 Subject: [PATCH 074/147] =?UTF-8?q?REPORT-43833=20=E3=80=9010.0.14?= =?UTF-8?q?=E3=80=91=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5/=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E5=A2=9E=E5=8A=A0=E9=94=81=E5=AE=9A=20?= =?UTF-8?q?=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91=E8=87=AA?= =?UTF-8?q?=E6=B5=8B+=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9Bbug=20=E3=80=90?= =?UTF-8?q?=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91=E8=87=AA=E6=B5=8B?= =?UTF-8?q?+=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/server/ConnectionListAction.java | 2 +- .../actions/server/GlobalTableDataAction.java | 2 +- .../connect/ConnectionComboBoxPanel.java | 1 - .../com/fr/design/editlock/EditLockUtils.java | 14 ++++++++++-- .../fr/design/gui/ibutton/UILockButton.java | 9 ++++++++ .../fr/design/images/m_web/warningIcon.png | Bin 0 -> 1190 bytes .../images/m_web/warningIcon_normal.svg | 21 ------------------ 7 files changed, 23 insertions(+), 26 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon.png delete mode 100644 designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon_normal.svg diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 45502c073..1fd555e82 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -115,7 +115,7 @@ public class ConnectionListAction extends UpdateAction { public UIMenuItem createMenuItem() { Object object = this.getValue(UILockMenuItem.class.getName()); if (object == null && !(object instanceof UILockMenuItem)) { - UILockMenuItem menuItem = new UILockMenuItem(this, EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, StringUtils.EMPTY, LockItem.CONNECTION); + UILockMenuItem menuItem = new UILockMenuItem(this, EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, null, LockItem.CONNECTION); // 设置名字用作单元测 menuItem.setName(getName()); setPressedIcon4Button(menuItem); diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index 14795066d..44d38db9f 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java @@ -192,7 +192,7 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS public UIMenuItem createMenuItem() { Object object = this.getValue(UILockMenuItem.class.getName()); if (object == null && !(object instanceof UILockMenuItem)) { - UILockMenuItem menuItem = new UILockMenuItem(this, EditLockUtils.SERVER_TABLEDATA_LOCKED_TOOLTIPS, StringUtils.EMPTY, LockItem.SERVER_TABLE_DATA); + UILockMenuItem menuItem = new UILockMenuItem(this, EditLockUtils.SERVER_TABLEDATA_LOCKED_TOOLTIPS, null, LockItem.SERVER_TABLE_DATA); // 设置名字用作单元测 menuItem.setName(getName()); setPressedIcon4Button(menuItem); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index 91813418b..a5ab12ff9 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -73,7 +73,6 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, StringUtils.EMPTY ); - editButton.setIcon(IconUtils.readIcon("/com/fr/design/images/m_web/connection")); editButton.setPreferredSize(buttonSize); editButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java index 20708462d..baa3543f8 100644 --- a/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java @@ -5,6 +5,7 @@ import com.fr.base.svg.SVGLoader; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; +import com.fr.general.IOUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.editlock.EditLockOperator; import com.fr.workspace.server.lock.editlock.LockItem; @@ -32,7 +33,10 @@ public class EditLockUtils { */ public static final @Nullable Image LOCKED_IMAGE = SVGLoader.load("/com/fr/design/images/m_web/locked_normal.svg"); - public static final Icon TOOLTIPS_ICON = IconUtils.readIcon("/com/fr/design/images/m_web/warningIcon"); + /** + * 提示弹窗中的提示标志 + */ + public static final Icon TOOLTIPS_ICON = IOUtils.readIcon("/com/fr/design/images/m_web/warningIcon.png"); /** * 数据连接锁定中 @@ -44,9 +48,15 @@ public class EditLockUtils { */ public static final String SERVER_TABLEDATA_LOCKED_TOOLTIPS = Toolkit.i18nText("Fine_Designer_Remote_Design_Server_TableData_Locked"); + /** + * 提示弹窗中的提示信息 + */ public static final String LOCKED_MESSAGE = Toolkit.i18nText("Fine_Designer_Remote_Design_Locked_Message"); - public static final String TOOLTIPS = Toolkit.i18nText("Fine-Engine_Report_Tooltips"); + /** + * 提示弹窗中的标题 + */ + public static final String TOOLTIPS = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Title_Hint"); /** * 已经被锁,跳出弹窗提示 diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java index aa643b6c1..b5534f609 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java @@ -2,6 +2,8 @@ package com.fr.design.gui.ibutton; import com.fr.design.editlock.EditLockChangeEvent; import com.fr.design.editlock.EditLockChangeListener; +import com.fr.design.editlock.EditLockUtils; +import com.fr.workspace.server.lock.editlock.LockItem; import javax.swing.Icon; @@ -35,6 +37,13 @@ public class UILockButton extends UIButton implements EditLockChangeListener { this.normalIcon = normalIcon; this.lockedTooltips = lockedTooltips; this.normalTooltips = normalTooltips; + init(); + } + + private void init() { + boolean locked = EditLockUtils.isLocked(LockItem.CONNECTION); + this.setIcon(locked ? lockedIcon : normalIcon); + this.setToolTipText(locked ? lockedTooltips : normalTooltips); } @Override diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon.png b/designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..41c7c703a2d614f1a7321ae76f1f78be8f9ea3fe GIT binary patch literal 1190 zcmV;X1X=ruP)1-1EWA`z1MZ43<~dJBuW(d zqR2O)A%N(DzUO(q=QGcqIdkqvQSu)ENE2)w17r4+we-BR-j1J7NGYMrsbraEyDF3}B1$8+)wd1qVu5D)7s$ReGj%6$CtzGU87rmY>PG96JZOT!9p?!%^UudFV0kfJR~&xa_LvUCs{rDGyvb->N-@7 zgf~+|oE8P)IcAj(Z+{i_U9W|};rvhop?77PGvI>LVkQW`8-jX0CgnDr!2ynWwEg8e za?66#I*gPSxIG?o=5Y?xHwyYQ{_}#5ZpUz5V$GBy|X>4*#G}+su72E_9@8kBjF=pk~ zqH( zG+>qmr{($3I57|l7n=fyVC&O(V*8K_cG9@&a+;GF{OR2PS?2h5nXT@CU+$ctFpzrPy8@nVyJv+TeIvt*G(VWn5Sr zqQT`}t0Pm1)KdNfQvO+O_HUH(oF?=38aIAxUm4H|;xao}P!qI1h%6Vu@oexgenR^+ z5_|Ou296Ue@hyVmA^s>n1dsG8aKuH7#7cb${_ubn;T7C7Q#(wQ&`VeR;;Sm6_H0$d z!YJO!eF04cqylTPFzVsw)7N{cqE0Nx?BTxM@%6?j_1*>{vj?8|?%q-qpPiT&UqITg z?>9oci9eg3!)@`w;#U8Eh7|H9e%t*6x54i#BU5MZ0CBX*Zs}O8*#H0l07*qoM6N<$ Ef^m~eUjP6A literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon_normal.svg deleted file mode 100644 index b7748925d..000000000 --- a/designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon_normal.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - icon_WarningIcon_normal - - - - - - - - - - - - - - - - - - \ No newline at end of file From a97241863ef39822f4aa25bf79d340d3d7d4104e Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 21 Jan 2021 16:25:20 +0800 Subject: [PATCH 075/147] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=9A=84id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/designer/component/VanChartTooltipContentPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index f2c566230..c4c5fa9f5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -522,7 +522,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane Date: Thu, 21 Jan 2021 16:25:51 +0800 Subject: [PATCH 076/147] =?UTF-8?q?=E9=80=82=E9=85=8D=E5=A4=9A=E5=B1=82?= =?UTF-8?q?=E9=A5=BC=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VanChartMultiPieLabelContentPane.java | 47 +++++++++++++++---- ...VanChartMultiPieRichTextFieldListPane.java | 41 ++++++++++++++++ .../VanChartMultiPieTooltipContentPane.java | 47 +++++++++++++++---- 3 files changed, 119 insertions(+), 16 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java index 73e766afc..b62655a26 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java @@ -1,13 +1,21 @@ package com.fr.van.chart.multilayer.style; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; +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.multilayer.style.AttrTooltipMultiLevelNameFormat; import com.fr.plugin.chart.type.TextAlign; import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -28,12 +36,35 @@ public class VanChartMultiPieLabelContentPane extends VanChartLabelContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new MultiPieLevelNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new MultiPieSeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartMultiPieRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Level_Name"), + Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipMultiLevelNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } protected AttrTooltipContent createAttrTooltip() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieRichTextFieldListPane.java new file mode 100644 index 000000000..2a0aea819 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieRichTextFieldListPane.java @@ -0,0 +1,41 @@ +package com.fr.van.chart.multilayer.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +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.multilayer.style.AttrTooltipMultiLevelNameFormat; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +public class VanChartMultiPieRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartMultiPieRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener fieldListener = getFieldListener(); + + VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Level_Name"), + new AttrTooltipMultiLevelNameFormat(), false, fieldListener); + + VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + new AttrTooltipSeriesFormat(), false, fieldListener); + + VanChartFieldButton valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + new AttrTooltipValueFormat(), false, fieldListener); + + VanChartFieldButton percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); + + setCategoryNameButton(categoryNameButton); + setSeriesNameButton(seriesNameButton); + setValueButton(valueButton); + setPercentButton(percentButton); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java index 1fbe0870a..76d536d5b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java @@ -1,12 +1,20 @@ package com.fr.van.chart.multilayer.style; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; +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.multilayer.style.AttrTooltipMultiLevelNameFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -27,12 +35,35 @@ public class VanChartMultiPieTooltipContentPane extends VanChartTooltipContentPa setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new MultiPieLevelNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new MultiPieSeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartMultiPieRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Level_Name"), + Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipMultiLevelNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } @Override From 22e2d7cb9266795bbbe1fb69d391064a57de4087 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 21 Jan 2021 16:34:43 +0800 Subject: [PATCH 077/147] =?UTF-8?q?=E9=80=82=E9=85=8D=E5=9C=B0=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../label/VanChartMapLabelContentPane.java | 20 +++++++++++++++++++ .../VanChartMapTooltipContentPane.java | 20 +++++++++++++++++++ 2 files changed, 40 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 baec70ca9..ce3e34ba7 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,7 @@ package com.fr.van.chart.map.designer.style.label; import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; @@ -14,7 +15,12 @@ import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheck import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.map.designer.style.VanChartMapRichTextFieldListPane; import javax.swing.JPanel; @@ -35,6 +41,20 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartMapRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + protected String[] getRichTextFieldNames() { return new String[]{ Toolkit.i18nText("Fine-Design_Chart_Area_Name"), diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java index 03f720bf7..718cfc358 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapTooltipContentPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.map.designer.style.tooltip; import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; @@ -13,7 +14,12 @@ import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheck import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.map.designer.style.VanChartMapRichTextFieldListPane; import javax.swing.JPanel; @@ -33,6 +39,20 @@ public class VanChartMapTooltipContentPane extends VanChartTooltipContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartMapRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + protected String[] getRichTextFieldNames() { return new String[]{ Toolkit.i18nText("Fine-Design_Chart_Area_Name"), From f29003889f7d59b9ed179b9a27405446c6defce8 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 21 Jan 2021 16:50:58 +0800 Subject: [PATCH 078/147] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=B5=81=E5=90=91?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VanChartLineMapRichTextFieldListPane.java | 41 ++++++++++++++++ .../VanChartLineMapTooltipContentPane.java | 48 +++++++++++++++---- 2 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapRichTextFieldListPane.java new file mode 100644 index 000000000..0a1e2bbb6 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapRichTextFieldListPane.java @@ -0,0 +1,41 @@ +package com.fr.van.chart.map.line; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipStartAndEndNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +public class VanChartLineMapRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartLineMapRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener fieldListener = getFieldListener(); + + VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Start_And_End"), + new AttrTooltipStartAndEndNameFormat(), false, fieldListener); + + VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + new AttrTooltipSeriesFormat(), false, fieldListener); + + VanChartFieldButton valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + new AttrTooltipValueFormat(), false, fieldListener); + + VanChartFieldButton percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); + + setCategoryNameButton(categoryNameButton); + setSeriesNameButton(seriesNameButton); + setValueButton(valueButton); + setPercentButton(percentButton); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java index 9dbc696a6..04ab53b6a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java @@ -1,15 +1,21 @@ package com.fr.van.chart.map.line; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipStartAndEndNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -30,12 +36,36 @@ public class VanChartLineMapTooltipContentPane extends VanChartTooltipContentPan setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new StartAndEndNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartLineMapRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Start_And_End"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipStartAndEndNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } @Override From db2aa5788ec11f0a9d8b10ba3cfc48034e18501a Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 21 Jan 2021 19:40:48 +0800 Subject: [PATCH 079/147] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=BC=8F=E6=96=97?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/VanChartFunnelLabelContentPane.java | 57 +++++++++-------- .../VanChartFunnelRichTextFieldListPane.java | 62 +++++++++++++++++++ .../VanChartFunnelTooltipContentPane.java | 57 +++++++++-------- 3 files changed, 124 insertions(+), 52 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java index a97225d55..e785b562b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java @@ -1,18 +1,21 @@ package com.fr.van.chart.funnel.designer.style; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.plugin.chart.type.TextAlign; import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -54,32 +57,34 @@ public class VanChartFunnelLabelContentPane extends VanChartLabelContentPane { setPercentFormatPane(new FunnelPercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new FunnelPercentFormatPaneWithoutCheckBox(parent, showOnPane)); - } + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextSeriesNameFormatPane(), - getRichTextValueFormatPane(), - getRichTextPercentFormatPane() - }; + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartFunnelRichTextFieldListPane(fieldAttrPane, richEditor); + } - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - attrTooltipContent.getRichTextSeriesFormat(), - attrTooltipContent.getRichTextValueFormat(), - attrTooltipContent.getRichTextPercentFormat() + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } }; + } - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Value_Conversion") + }; + } - checkRichEditorState(attrTooltipContent); + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipNameFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } protected AttrTooltipContent createAttrTooltip() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRichTextFieldListPane.java new file mode 100644 index 000000000..c63f112a7 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRichTextFieldListPane.java @@ -0,0 +1,62 @@ +package com.fr.van.chart.funnel.designer.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; + +public class VanChartFunnelRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartFunnelRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener fieldListener = getFieldListener(); + + VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + new AttrTooltipCategoryFormat(), false, fieldListener); + + VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + new AttrTooltipNameFormat(), false, fieldListener); + + VanChartFieldButton valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + new AttrTooltipValueFormat(), false, fieldListener); + + VanChartFieldButton percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Value_Conversion"), + new AttrTooltipPercentFormat(), false, fieldListener); + + setCategoryNameButton(categoryNameButton); + setSeriesNameButton(seriesNameButton); + setValueButton(valueButton); + setPercentButton(percentButton); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getSeriesNameButton()); + fieldPane.add(getValueButton()); + fieldPane.add(getPercentButton()); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(getValueButton()); + fieldButtonList.add(getPercentButton()); + + return fieldButtonList; + } + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java index 247194ec4..e15c62e0c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java @@ -1,17 +1,20 @@ package com.fr.van.chart.funnel.designer.style; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -53,32 +56,34 @@ public class VanChartFunnelTooltipContentPane extends VanChartTooltipContentPane setPercentFormatPane(new FunnelPercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new FunnelPercentFormatPaneWithoutCheckBox(parent, showOnPane)); - } + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextSeriesNameFormatPane(), - getRichTextValueFormatPane(), - getRichTextPercentFormatPane() - }; + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartFunnelRichTextFieldListPane(fieldAttrPane, richEditor); + } - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - attrTooltipContent.getRichTextSeriesFormat(), - attrTooltipContent.getRichTextValueFormat(), - attrTooltipContent.getRichTextPercentFormat() + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } }; + } - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Value_Conversion") + }; + } - checkRichEditorState(attrTooltipContent); + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipNameFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } protected AttrTooltipContent createAttrTooltip() { From 7b271caeba1a2d19c15c6fd6e06ab445bd943672 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 21 Jan 2021 20:04:58 +0800 Subject: [PATCH 080/147] =?UTF-8?q?REPORT-43833=20=E3=80=9010.0.14?= =?UTF-8?q?=E3=80=91=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5/=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E5=A2=9E=E5=8A=A0=E9=94=81=E5=AE=9A=20?= =?UTF-8?q?=E5=B0=86=E5=BC=B9=E7=AA=97=E5=85=B3=E9=97=AD=E5=90=8E=E8=A7=A3?= =?UTF-8?q?=E9=94=81=E7=9A=84=E6=93=8D=E4=BD=9C=EF=BC=8C=E6=94=BE=E5=88=B0?= =?UTF-8?q?afterCommit=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/server/GlobalTableDataAction.java | 4 ++-- .../main/java/com/fr/design/os/impl/DatabaseDialogAction.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index 44d38db9f..d41af3205 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java @@ -103,8 +103,6 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS globalTableDataDialog.setDoOKSucceed(false); return; } - // 关闭服务器数据集页面,为其解锁 - EditLockUtils.unlock(LockItem.SERVER_TABLE_DATA); DesignTableDataManager.clearGlobalDs(); // 保存时 移除服务器数据集列名缓存 for (String name : tableDataConfig.getTableDatas().keySet()) { @@ -128,6 +126,8 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS // 刷新共有数据集 TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); fireDSChanged(globalTableDataPane.getDsChangedNameMap()); + // 关闭服务器数据集页面,为其解锁 + EditLockUtils.unlock(LockItem.SERVER_TABLE_DATA); } })); } diff --git a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java index 3d343ab93..ae0f8d1cb 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java @@ -52,8 +52,6 @@ public class DatabaseDialogAction implements OSBasedAction { databaseListDialog.setDoOKSucceed(false); return; } - // 定义数据连接弹窗关闭后,解锁 - EditLockUtils.unlock(LockItem.CONNECTION); Configurations.modify(new WorkerFacade(ConnectionConfig.class) { @Override public void run() { @@ -69,6 +67,8 @@ public class DatabaseDialogAction implements OSBasedAction { @Override public void afterCommit() { DesignerContext.getDesignerBean("databasename").refreshBeanElement(); + // 定义数据连接弹窗关闭后,解锁 + EditLockUtils.unlock(LockItem.CONNECTION); } })); } From 7cc2ffb8fdb68e1c3621ab48b0dfc5400fd86cb8 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 21 Jan 2021 20:10:13 +0800 Subject: [PATCH 081/147] =?UTF-8?q?REPORT-43833=20=E3=80=9010.0.14?= =?UTF-8?q?=E3=80=91=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5/=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E5=A2=9E=E5=8A=A0=E9=94=81=E5=AE=9A=20?= =?UTF-8?q?=E5=B0=86=E9=80=9A=E7=9F=A5=E7=BB=84=E4=BB=B6=E7=9A=84=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=94=BE=E5=88=B0EDT=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/editlock/EditLockChangeChecker.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java index 13ac921e3..951bea334 100644 --- a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java @@ -1,6 +1,7 @@ package com.fr.design.editlock; import com.fr.concurrent.NamedThreadFactory; +import com.fr.design.ui.util.UIUtil; import com.fr.log.FineLoggerFactory; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.editlock.EditLockOperator; @@ -60,8 +61,13 @@ public abstract class EditLockChangeChecker { } private void fireChange() { - for (EditLockChangeListener listener : this.listeners) { - listener.updateLockedState(new EditLockChangeEvent(isLocked)); - } + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + for (EditLockChangeListener listener : EditLockChangeChecker.this.listeners) { + listener.updateLockedState(new EditLockChangeEvent(isLocked)); + } + } + }); } } From 43642548e66fa90a094c1361e9a39e12fb04735a Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Fri, 22 Jan 2021 09:29:14 +0800 Subject: [PATCH 082/147] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...anChartStructureRichTextFieldListPane.java | 61 ++++++++++++++++++ .../VanChartStructureTooltipContentPane.java | 63 ++++++++----------- 2 files changed, 88 insertions(+), 36 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRichTextFieldListPane.java new file mode 100644 index 000000000..49f81968c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRichTextFieldListPane.java @@ -0,0 +1,61 @@ +package com.fr.van.chart.structure.desinger.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +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.multilayer.style.AttrTooltipMultiLevelNameFormat; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; + +public class VanChartStructureRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartStructureRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener fieldListener = getFieldListener(); + + VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Node_Name"), + new AttrTooltipMultiLevelNameFormat(), false, fieldListener); + + VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + new AttrTooltipSeriesFormat(), false, fieldListener); + + VanChartFieldButton valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + new AttrTooltipValueFormat(), false, fieldListener); + + VanChartFieldButton percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); + + setCategoryNameButton(categoryNameButton); + setSeriesNameButton(seriesNameButton); + setValueButton(valueButton); + setPercentButton(percentButton); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getCategoryNameButton()); + fieldPane.add(getSeriesNameButton()); + fieldPane.add(getValueButton()); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getCategoryNameButton()); + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(getValueButton()); + + return fieldButtonList; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java index f5999391f..f0252fab7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java @@ -2,20 +2,21 @@ package com.fr.van.chart.structure.desinger.style; import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -70,44 +71,34 @@ public class VanChartStructureTooltipContentPane extends VanChartTooltipContentP setPercentFormatPane(percentFormatPane); } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Node_Name"); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartStructureRichTextFieldListPane(fieldAttrPane, richEditor); } - }; - SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); } }; - ValueFormatPaneWithoutCheckBox richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); - PercentFormatPaneWithoutCheckBox richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane); - - setRichTextCategoryNameFormatPane(richTextCategoryNameFormatPane); - setRichTextSeriesNameFormatPane(richTextSeriesNameFormatPane); - setRichTextValueFormatPane(richTextValueFormatPane); - setRichTextPercentFormatPane(richTextPercentFormatPane); } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextCategoryNameFormatPane(), - getRichTextSeriesNameFormatPane(), - getRichTextValueFormatPane() + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Node_Name"), + Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value") }; + } - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - attrTooltipContent.getRichTextCategoryFormat(), - attrTooltipContent.getRichTextSeriesFormat(), - attrTooltipContent.getRichTextValueFormat() + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipMultiLevelNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat() }; - - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); - - checkRichEditorState(attrTooltipContent); } @Override From e5585ff488ed78cd428a8a23ba4606243d7a61ea Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 22 Jan 2021 15:16:45 +0800 Subject: [PATCH 083/147] =?UTF-8?q?REPORT-43833=20=E3=80=9010.0.14?= =?UTF-8?q?=E3=80=91=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5/=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E5=A2=9E=E5=8A=A0=E9=94=81=E5=AE=9A=201.=20?= =?UTF-8?q?=E5=B0=86=E6=9C=AC=E5=9C=B0=E5=AE=9E=E7=8E=B0=E4=BD=9C=E4=B8=BA?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=AE=9E=E7=8E=B0=EF=BC=8C=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E8=B5=B7=E6=9D=A5=EF=BC=8C=E4=BB=A5=E5=85=BC=E5=AE=B9=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E8=BF=9E=E6=8E=A5=E8=80=81=E7=89=88=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E7=9A=84=E6=83=85=E5=86=B5=202.=20=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E6=B8=85=E7=90=86=E8=84=8F=E6=95=B0=E6=8D=AE=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=9C=89=E7=82=B9=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=96=B9=E5=BC=8F=E4=B8=BA=EF=BC=9A=E4=B8=BALockItem?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA=E6=88=90?= =?UTF-8?q?=E5=91=98=E5=8F=98=E9=87=8Fbirth=EF=BC=8C=E4=BB=A3=E8=A1=A8?= =?UTF-8?q?=E5=85=B6=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E4=B8=94=E4=BC=9A=E4=B8=BA=E6=AF=8F=E4=B8=AAClientID=E5=9C=A8?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E7=9A=84=E6=9C=8D=E5=8A=A1=E4=B8=AD=E5=AD=98?= =?UTF-8?q?=E4=B8=8A=E4=B8=80=E4=B8=AAkey=3DclientID=EF=BC=8Cvalue=3DLockI?= =?UTF-8?q?tem=E7=9A=84=E9=94=AE=E5=80=BC=E5=AF=B9=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=99=BB=E5=85=A5=E6=97=B6=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E6=AF=8F=E9=9A=9430s=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4=EF=BC=8C=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=99=BB=E5=87=BA=E6=97=B6=E6=B8=85=E9=99=A4=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E4=B8=94=E5=9C=A8=E8=BD=AE=E8=AF=A2=E4=BB=BB=E5=8A=A1=E4=B8=AD?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=A3=80=E6=9F=A5=E5=BD=93=E5=89=8D=E5=90=84?= =?UTF-8?q?=E4=B8=AALockItem=E5=AF=B9=E5=BA=94=E7=9A=84=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E4=B8=8B=E8=BF=99=E4=B8=AA=E9=94=AE=E5=80=BC=E5=AF=B9=E9=87=8C?= =?UTF-8?q?value=E7=9A=84birth=E6=98=AF=E5=90=A6=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E5=A6=82=E6=9E=9C=E8=B6=85=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=B8=85=E7=90=86=E8=84=8F=E6=95=B0=E6=8D=AE=203.=20=E5=B0=86?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E4=BD=BF=E7=94=A8=E7=9A=84applyForService?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BAapplyForCleanableService=EF=BC=8C?= =?UTF-8?q?=E4=BE=BF=E4=BA=8E=E9=9B=86=E7=BE=A4=E9=87=8D=E5=90=AF=E6=97=B6?= =?UTF-8?q?=E6=B8=85=E7=90=86=E6=9C=8D=E5=8A=A1=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/server/ConnectionListAction.java | 4 +--- .../com/fr/design/actions/server/GlobalTableDataAction.java | 3 +-- .../design/data/datapane/connect/ConnectionComboBoxPanel.java | 2 +- .../com/fr/design/editlock/ConnectionLockChangeChecker.java | 2 +- .../java/com/fr/design/editlock/EditLockChangeChecker.java | 2 +- .../src/main/java/com/fr/design/editlock/EditLockUtils.java | 2 +- .../fr/design/editlock/ServerTableDataLockChangeChecker.java | 2 +- .../src/main/java/com/fr/design/gui/ibutton/UILockButton.java | 2 +- .../src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java | 2 +- .../main/java/com/fr/design/os/impl/DatabaseDialogAction.java | 2 +- 10 files changed, 10 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 1fd555e82..4742f337c 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -8,16 +8,14 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.editlock.ConnectionLockChangeChecker; import com.fr.design.editlock.EditLockUtils; import com.fr.design.gui.NameInspector; -import com.fr.design.gui.ibutton.UILockButton; import com.fr.design.gui.imenu.UILockMenuItem; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.menu.MenuKeySet; -import com.fr.stable.StringUtils; import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; import com.fr.design.os.impl.DatabaseDialogAction; import com.fr.file.ConnectionConfig; -import com.fr.workspace.server.lock.editlock.LockItem; +import com.fr.report.LockItem; import javax.swing.KeyStroke; import java.awt.event.ActionEvent; diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index d41af3205..ab85a14dc 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java @@ -22,11 +22,10 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.file.TableDataConfig; -import com.fr.stable.StringUtils; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; -import com.fr.workspace.server.lock.editlock.LockItem; +import com.fr.report.LockItem; import javax.swing.KeyStroke; import java.awt.Dimension; diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index a5ab12ff9..afd65f3e5 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -21,7 +21,7 @@ import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; import com.fr.workspace.WorkContext; import com.fr.workspace.server.connection.DBConnectAuth; -import com.fr.workspace.server.lock.editlock.LockItem; +import com.fr.report.LockItem; import javax.swing.SwingUtilities; import java.awt.Dimension; diff --git a/designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java b/designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java index ac80cd53c..8eb6a4aa9 100644 --- a/designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java +++ b/designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java @@ -1,7 +1,7 @@ package com.fr.design.editlock; -import com.fr.workspace.server.lock.editlock.LockItem; +import com.fr.report.LockItem; /** * @author Yvan diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java index 951bea334..8f276dfe8 100644 --- a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java @@ -5,7 +5,7 @@ import com.fr.design.ui.util.UIUtil; import com.fr.log.FineLoggerFactory; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.editlock.EditLockOperator; -import com.fr.workspace.server.lock.editlock.LockItem; +import com.fr.report.LockItem; import java.util.ArrayList; import java.util.List; diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java index baa3543f8..2ab10fb92 100644 --- a/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java @@ -8,7 +8,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.general.IOUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.editlock.EditLockOperator; -import com.fr.workspace.server.lock.editlock.LockItem; +import com.fr.report.LockItem; import org.jetbrains.annotations.Nullable; import javax.swing.Icon; diff --git a/designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java b/designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java index a3f2bbbf4..e38a4e940 100644 --- a/designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java +++ b/designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java @@ -1,6 +1,6 @@ package com.fr.design.editlock; -import com.fr.workspace.server.lock.editlock.LockItem; +import com.fr.report.LockItem; /** * @author Yvan diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java index b5534f609..77b5516f5 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java @@ -3,7 +3,7 @@ package com.fr.design.gui.ibutton; import com.fr.design.editlock.EditLockChangeEvent; import com.fr.design.editlock.EditLockChangeListener; import com.fr.design.editlock.EditLockUtils; -import com.fr.workspace.server.lock.editlock.LockItem; +import com.fr.report.LockItem; import javax.swing.Icon; diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java index 092b76516..c609e5d5c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java @@ -2,7 +2,7 @@ package com.fr.design.gui.imenu; import com.fr.design.editlock.EditLockChangeEvent; import com.fr.design.editlock.EditLockChangeListener; -import com.fr.workspace.server.lock.editlock.LockItem; +import com.fr.report.LockItem; import javax.swing.Action; diff --git a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java index ae0f8d1cb..057b561fa 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java @@ -11,7 +11,7 @@ import com.fr.stable.os.support.OSBasedAction; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; -import com.fr.workspace.server.lock.editlock.LockItem; +import com.fr.report.LockItem; import static com.fr.design.actions.server.ConnectionListAction.doWithDatasourceManager; /** From a17002e48fe034bfcf6bb3648aa73fa83076a971 Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 22 Jan 2021 15:20:22 +0800 Subject: [PATCH 084/147] =?UTF-8?q?REPORT-44666=20=E5=A4=9A=E5=B1=8F?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=20=E9=83=A8=E5=88=86=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E6=98=BE=E7=A4=BA=E5=9C=A8=E5=8F=A6=E4=B8=80=E5=9D=97?= =?UTF-8?q?=E5=B1=8F=E5=B9=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 2 +- .../datapane/preview/PreviewTablePane.java | 2 ++ .../gui/controlpane/UIListControlPane.java | 2 +- .../background/image/ExpandFileChooser.java | 3 +++ .../com/fr/design/utils/gui/GUICoreUtils.java | 26 +++++++++++++++++++ 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 2b36bd45f..c8078777d 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -437,7 +437,7 @@ public class EnvChangeEntrance { public void chooseEnv(final String envName) { final EnvListPane envListPane = new EnvListPane(); - final BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame())); + final BasicDialog envListDialog = envListPane.showWindow(DesignerContext.getDesignerFrame()); envListPane.populateEnvManager(envName); envListDialog.addDialogActionListener(new DialogActionAdapter() { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java index d3881bcd1..da87c10f6 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java @@ -26,6 +26,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.ui.util.UIUtil; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.function.TIME; import com.fr.general.FRFont; import com.fr.log.FineLoggerFactory; @@ -168,6 +169,7 @@ public class PreviewTablePane extends BasicPane { this.add(new JScrollPane(preveiwTable), BorderLayout.CENTER); if (this.dialog == null) { this.dialog = this.showWindow(new JFrame()); + GUICoreUtils.centerWindow(DesignerContext.getDesignerFrame(), this.dialog); } progressBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) { public void doMonitorCanceled() { diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java index 100daf511..ec76f5bf7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java @@ -247,7 +247,7 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon resultPos.x = listPos.x + nameableList.getParent().getWidth(); } // 如果右侧显示不下,可以向左移动 - int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - popupEditDialog.getWidth() - EDIT_RANGE; + int maxX = frame.getLocationOnScreen().x + frame.getWidth() - popupEditDialog.getWidth() - EDIT_RANGE; if (resultPos.x > maxX) { resultPos.x = maxX; } diff --git a/designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java b/designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java index ca091cf94..ef6371694 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java @@ -5,6 +5,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.StringUtils; @@ -19,6 +20,7 @@ import java.awt.Container; import java.awt.Dimension; import java.awt.Insets; import java.awt.LayoutManager; +import java.awt.Rectangle; import java.awt.event.ActionListener; /** @@ -85,6 +87,7 @@ public class ExpandFileChooser extends JFileChooser { @Override public int showDialog(Component parent, String approveButtonText) { dialog.setModal(true); + GUICoreUtils.centerWindow(parent, dialog); dialog.setVisible(true); return retVal; } diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index e6b276437..d55382c49 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -292,6 +292,24 @@ public final class GUICoreUtils { return button; } + + /** + * 将独立弹窗设置在中间位置 适应多屏 跟随设计器主界面 + * 可从父界面获取弹窗应该所在的矩形范围 + * + * @param parent 独立弹窗的父窗口 + * @param win 弹窗自身 + */ + public static void centerWindow(Component parent, Window win) { + Rectangle rectangle; + if (parent == null) { + rectangle = DesignerContext.getDesignerFrame().getGraphicsConfiguration().getBounds(); + } else { + rectangle = parent.getGraphicsConfiguration().getBounds(); + } + centerWindow(win, rectangle); + } + /** * 设置一个窗口 * @@ -301,7 +319,14 @@ public final class GUICoreUtils { // Toolkit.getDefaultToolkit().getScreenSize()在有多个显示器也只能获取到主屏的大小 // getGraphicsConfiguration().getBounds()能获取多个屏时 设计器主体界面所在屏的大小和对应的坐标 Rectangle rectangle = win.getGraphicsConfiguration().getBounds(); + centerWindow(win, rectangle); + } + /** + * @param win + * @param rectangle 窗口所在的一个矩形范围 + */ + public static void centerWindow(Window win, Rectangle rectangle) { Dimension screenSize = rectangle.getSize(); Dimension winSize = win.getSize(); @@ -315,6 +340,7 @@ public final class GUICoreUtils { win.setLocation(rectangle.x + (screenSize.width - winSize.width) / 2, rectangle.y + (screenSize.height - winSize.height) / 2 - WINDOW_GAP); } + /** * Gets window/frame to screen center. * @param owerWin 父窗口 From c785ac8c20094cb3fc1a8d1e4011db97042524f3 Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 22 Jan 2021 15:32:04 +0800 Subject: [PATCH 085/147] =?UTF-8?q?REPORT-44666=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 --- .../com/fr/design/style/background/image/ExpandFileChooser.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java b/designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java index ef6371694..768e7dacd 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java @@ -5,7 +5,6 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.StringUtils; @@ -20,7 +19,6 @@ import java.awt.Container; import java.awt.Dimension; import java.awt.Insets; import java.awt.LayoutManager; -import java.awt.Rectangle; import java.awt.event.ActionListener; /** From 6475734917184e419ea9d31da723540556c4fde7 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Fri, 22 Jan 2021 15:47:50 +0800 Subject: [PATCH 086/147] =?UTF-8?q?=E9=80=82=E9=85=8D=E7=94=98=E7=89=B9?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../richText/VanChartFieldAttrPane.java | 52 +++++-- .../richText/VanChartFieldButton.java | 31 +++++ .../richText/VanChartFieldListPane.java | 18 ++- .../VanChartGanttRichTextFieldListPane.java | 107 ++++++++++++++ .../VanChartGanttTooltipContentPane.java | 131 ++++++------------ 5 files changed, 238 insertions(+), 101 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java index 89c3cd73e..5cab5485f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java @@ -2,11 +2,13 @@ package com.fr.van.chart.designer.component.richText; import com.fr.data.util.function.AbstractDataFunction; import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.style.FormatPane; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; +import com.fr.plugin.chart.base.format.IntervalTimeFormat; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont; @@ -21,15 +23,18 @@ import java.text.Format; public class VanChartFieldAttrPane extends JPanel { private FormatPane fieldFormatPane; - private CalculateComboBox fieldDataFunction; + private UIComboBox intervalTimeBox; + private CalculateComboBox dataFunctionBox; + private JPanel formatPane; + private JPanel intervalTimePane; private JPanel fieldFunctionPane; public VanChartFieldAttrPane() { initComponents(); this.setLayout(new BorderLayout()); - this.add(fieldFormatPane, BorderLayout.NORTH); + this.add(formatPane, BorderLayout.NORTH); this.add(fieldFunctionPane, BorderLayout.CENTER); this.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); } @@ -44,28 +49,43 @@ public class VanChartFieldAttrPane extends JPanel { return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, new double[]{d, e}); } }; + intervalTimeBox = new UIComboBox(IntervalTimeFormat.getFormats()); + dataFunctionBox = new CalculateComboBox(); - fieldDataFunction = new CalculateComboBox(); - - Component[][] components = new Component[][]{ + Component[][] intervalTimeComponents = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), intervalTimeBox} + }; + Component[][] dataFunctionComponents = new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), fieldDataFunction} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), dataFunctionBox} }; - fieldFunctionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{d, e}); - } + intervalTimePane = TableLayout4VanChartHelper.createGapTableLayoutPane(intervalTimeComponents, new double[]{p, p}, new double[]{d, e}); - public void registerFunctionListener(ActionListener listener) { - fieldDataFunction.addActionListener(listener); + formatPane = new JPanel(new BorderLayout()); + formatPane.add(fieldFormatPane, BorderLayout.NORTH); + formatPane.add(intervalTimePane, BorderLayout.CENTER); + + fieldFunctionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(dataFunctionComponents, new double[]{p, p}, new double[]{d, e}); } - public void registerChangeListener(UIObserverListener listener) { + public void registerFormatListener(UIObserverListener listener) { fieldFormatPane.registerChangeListener(listener); + intervalTimeBox.registerChangeListener(listener); } - public void populate(Format format, AbstractDataFunction dataFunction, boolean showDataFunction) { + public void registerFunctionListener(ActionListener listener) { + dataFunctionBox.addActionListener(listener); + } + + public void populate(Format format, IntervalTimeFormat intervalTime, AbstractDataFunction dataFunction, boolean showDataFunction, boolean showIntervalTime) { fieldFormatPane.populateBean(format); - fieldDataFunction.populateBean(dataFunction); + intervalTimeBox.setSelectedItem(intervalTime); + dataFunctionBox.populateBean(dataFunction); + + fieldFormatPane.setVisible(!showIntervalTime); + intervalTimePane.setVisible(showIntervalTime); fieldFunctionPane.setVisible(showDataFunction); } @@ -73,7 +93,11 @@ public class VanChartFieldAttrPane extends JPanel { return fieldFormatPane.update(); } + public IntervalTimeFormat updateIntervalTime() { + return (IntervalTimeFormat) intervalTimeBox.getSelectedItem(); + } + public AbstractDataFunction updateDataFunction() { - return fieldDataFunction.updateBean(); + return dataFunctionBox.updateBean(); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java index 74bf77030..1e76d616c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java @@ -7,7 +7,9 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.IntervalTimeFormat; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -33,16 +35,27 @@ public class VanChartFieldButton extends JPanel { private final AttrTooltipFormat tooltipFormat; private final boolean showDataFunction; + private final boolean showIntervalTime; private UIToggleButton fieldButton; private UIButton addButton; private DataFunction dataFunction = new NoneFunction(); + public VanChartFieldButton(String fieldName, AttrTooltipFormat format, VanChartFieldListener listener) { + this(fieldName, format, false, false, listener); + } + public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, VanChartFieldListener listener) { + this(fieldName, format, showDataFunction, false, listener); + } + + public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, boolean showIntervalTime, VanChartFieldListener listener) { this.fieldName = fieldName; this.tooltipFormat = format; + this.showDataFunction = showDataFunction; + this.showIntervalTime = showIntervalTime; this.fieldId = format == null ? StringUtils.EMPTY : format.getFormatJSONKey(); @@ -72,6 +85,20 @@ public class VanChartFieldButton extends JPanel { this.tooltipFormat.setFormat(format); } + public IntervalTimeFormat getIntervalTimeFormat() { + if (tooltipFormat instanceof AttrTooltipDurationFormat) { + return ((AttrTooltipDurationFormat) tooltipFormat).getIntervalTimeFormat(); + } + + return IntervalTimeFormat.DAY; + } + + public void setIntervalTimeFormat(IntervalTimeFormat intervalTime) { + if (tooltipFormat instanceof AttrTooltipDurationFormat) { + ((AttrTooltipDurationFormat) tooltipFormat).setIntervalTimeFormat(intervalTime); + } + } + public DataFunction getDataFunction() { return dataFunction; } @@ -84,6 +111,10 @@ public class VanChartFieldButton extends JPanel { return showDataFunction; } + public boolean isShowIntervalTime() { + return showIntervalTime; + } + public String getFormatJs() { return this.tooltipFormat.getJs(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index 2d6b4b579..60a0b1158 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -11,11 +11,13 @@ import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.TableFieldCollection; import com.fr.plugin.chart.base.TableFieldDefinition; import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipFieldFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; 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.base.format.IntervalTimeFormat; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.BorderFactory; @@ -242,10 +244,13 @@ public class VanChartFieldListPane extends JPanel { } Format format = fieldButton.getFormat(); + IntervalTimeFormat intervalTime = fieldButton.getIntervalTimeFormat(); AbstractDataFunction dataFunction = (AbstractDataFunction) fieldButton.getDataFunction(); + boolean showDataFunction = fieldButton.isShowDataFunction(); + boolean showIntervalTime = fieldButton.isShowIntervalTime(); - fieldAttrPane.populate(format, dataFunction, showDataFunction); + fieldAttrPane.populate(format, intervalTime, dataFunction, showDataFunction, showIntervalTime); } public void updateFieldFormatPane() { @@ -256,6 +261,7 @@ public class VanChartFieldListPane extends JPanel { } fieldButton.setFormat(fieldAttrPane.updateFormat()); + fieldButton.setIntervalTimeFormat(fieldAttrPane.updateIntervalTime()); fieldButton.setDataFunction(fieldAttrPane.updateDataFunction()); if (tableFieldNameList.contains(fieldName)) { @@ -276,7 +282,7 @@ public class VanChartFieldListPane extends JPanel { } }); - fieldAttrPane.registerChangeListener(new UIObserverListener() { + fieldAttrPane.registerFormatListener(new UIObserverListener() { public void doChange() { fieldListener.updateFieldFormatPane(); } @@ -317,6 +323,10 @@ public class VanChartFieldListPane extends JPanel { button.setEnable(format.isEnable()); button.setFormat(format.getFormat()); + + if (button.isShowIntervalTime() && format instanceof AttrTooltipDurationFormat) { + button.setIntervalTimeFormat(((AttrTooltipDurationFormat) format).getIntervalTimeFormat()); + } } public void populateTableField(AttrTooltipContent tooltipContent) { @@ -378,5 +388,9 @@ public class VanChartFieldListPane extends JPanel { format.setEnable(button.isEnable()); format.setFormat(button.getFormat()); + + if (button.isShowIntervalTime() && format instanceof AttrTooltipDurationFormat) { + ((AttrTooltipDurationFormat) format).setIntervalTimeFormat(button.getIntervalTimeFormat()); + } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttRichTextFieldListPane.java new file mode 100644 index 000000000..6332c6757 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttRichTextFieldListPane.java @@ -0,0 +1,107 @@ +package com.fr.van.chart.gantt.designer.style.tooltip; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; +import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat; +import com.fr.plugin.chart.base.format.AttrTooltipProcessesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipProgressFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipStartTimeFormat; +import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; + +public class VanChartGanttRichTextFieldListPane extends VanChartFieldListPane { + + private VanChartFieldButton richTextProcessesFormatPane; + private VanChartFieldButton richTextStartTimeFormatPane; + private VanChartFieldButton richTextEndTimeFormatPane; + private VanChartFieldButton richTextDurationFormatPane; + private VanChartFieldButton richTextProgressFormatPane; + + public VanChartGanttRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener listener = getFieldListener(); + + richTextProcessesFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Project_Name"), + new AttrTooltipProcessesFormat(), false, listener); + + setSeriesNameButton(new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + new AttrTooltipSeriesFormat(), false, listener)); + + richTextStartTimeFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Start_Time"), + new AttrTooltipStartTimeFormat(), false, listener); + + richTextEndTimeFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_End_Time"), + new AttrTooltipEndTimeFormat(), false, listener); + + richTextDurationFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Duration_Time"), + new AttrTooltipDurationFormat(), false, true, listener); + + richTextProgressFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Process"), + new AttrTooltipProgressFormat(), false, listener); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(richTextProcessesFormatPane); + fieldPane.add(getSeriesNameButton()); + fieldPane.add(richTextStartTimeFormatPane); + fieldPane.add(richTextEndTimeFormatPane); + fieldPane.add(richTextDurationFormatPane); + fieldPane.add(richTextProgressFormatPane); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(richTextProcessesFormatPane); + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(richTextStartTimeFormatPane); + fieldButtonList.add(richTextEndTimeFormatPane); + fieldButtonList.add(richTextDurationFormatPane); + fieldButtonList.add(richTextProgressFormatPane); + + return fieldButtonList; + } + + public void populateDefaultField(AttrTooltipContent tooltipContent) { + super.populateDefaultField(tooltipContent); + + if (tooltipContent instanceof AttrGanttTooltipContent) { + AttrGanttTooltipContent gantt = (AttrGanttTooltipContent) tooltipContent; + + populateButtonFormat(richTextProcessesFormatPane, gantt.getRichTextProcessesFormat()); + populateButtonFormat(richTextStartTimeFormatPane, gantt.getRichTextStartTimeFormat()); + populateButtonFormat(richTextEndTimeFormatPane, gantt.getRichTextEndTimeFormat()); + populateButtonFormat(richTextDurationFormatPane, gantt.getRichTextDurationFormat()); + populateButtonFormat(richTextProgressFormatPane, gantt.getRichTextProgressFormat()); + } + } + + public void updateDefaultField(AttrTooltipContent tooltipContent) { + super.updateDefaultField(tooltipContent); + + if (tooltipContent instanceof AttrGanttTooltipContent) { + AttrGanttTooltipContent gantt = (AttrGanttTooltipContent) tooltipContent; + + updateButtonFormat(richTextProcessesFormatPane, gantt.getRichTextProcessesFormat()); + updateButtonFormat(richTextStartTimeFormatPane, gantt.getRichTextStartTimeFormat()); + updateButtonFormat(richTextEndTimeFormatPane, gantt.getRichTextEndTimeFormat()); + updateButtonFormat(richTextDurationFormatPane, gantt.getRichTextDurationFormat()); + updateButtonFormat(richTextProgressFormatPane, gantt.getRichTextProgressFormat()); + } + } + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java index d724deff5..6868a0c87 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java @@ -1,10 +1,11 @@ package com.fr.van.chart.gantt.designer.style.tooltip; import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipProcessesFormat; import com.fr.plugin.chart.base.format.AttrTooltipProgressFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; @@ -12,14 +13,15 @@ import com.fr.plugin.chart.base.format.AttrTooltipStartTimeFormat; import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; import java.awt.Component; -import java.util.Map; /** * Created by hufan on 2017/1/13. @@ -31,12 +33,6 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane private VanChartFormatComBoxWithCheckBox durationFormatPane; private VanChartFormatPaneWithCheckBox progressFormatPane; - private VanChartFormatPaneWithoutCheckBox richTextProcessesFormatPane; - private VanChartDateFormatPaneWithoutCheckBox richTextStartTimeFormatPane; - private VanChartDateFormatPaneWithoutCheckBox richTextEndTimeFormatPane; - private VanChartFormatComBoxWithoutCheckBox richTextDurationFormatPane; - private VanChartFormatPaneWithoutCheckBox richTextProgressFormatPane; - public VanChartGanttTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { super(parent, showOnPane); } @@ -70,28 +66,39 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane }; } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - richTextProcessesFormatPane = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane){ - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Project_Name"); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartGanttRichTextFieldListPane(fieldAttrPane, richEditor); } - }; - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - richTextStartTimeFormatPane = new VanChartDateFormatPaneWithoutCheckBox(parent, showOnPane){ - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Start_Time"); + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); } }; - richTextEndTimeFormatPane = new VanChartDateFormatPaneWithoutCheckBox(parent, showOnPane){ - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_End_Time"); - } + } + + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Project_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Start_Time"), + Toolkit.i18nText("Fine-Design_Chart_End_Time"), + Toolkit.i18nText("Fine-Design_Chart_Duration_Time"), + Toolkit.i18nText("Fine-Design_Chart_Process") }; - richTextDurationFormatPane = new VanChartFormatComBoxWithoutCheckBox(); - richTextProgressFormatPane = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane){ - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Process"); - } + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipProcessesFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipStartTimeFormat(), + new AttrTooltipEndTimeFormat(), + new AttrTooltipDurationFormat(), + new AttrTooltipProgressFormat() }; } @@ -106,17 +113,6 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane }; } - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{richTextProcessesFormatPane,null}, - new Component[]{getRichTextSeriesNameFormatPane(),null}, - new Component[]{richTextStartTimeFormatPane,null}, - new Component[]{richTextEndTimeFormatPane,null}, - new Component[]{richTextDurationFormatPane, null}, - new Component[]{richTextProgressFormatPane, null} - }; - } - protected double[] getRowSize(double p){ return new double[]{p,p,p,p,p,p}; } @@ -135,43 +131,6 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane } } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - if(attrTooltipContent instanceof AttrGanttTooltipContent){ - setRichTextAttr(new AttrTooltipRichText()); - - AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; - Map params = getRichTextAttr().getParams(); - - AttrTooltipProcessesFormat processesFormat = ganttTooltipContent.getRichTextProcessesFormat(); - richTextProcessesFormatPane.populate(processesFormat); - richTextProcessesFormatPane.updateFormatParams(params, processesFormat.getJs()); - - AttrTooltipSeriesFormat seriesFormat = ganttTooltipContent.getRichTextSeriesFormat(); - getRichTextSeriesNameFormatPane().populate(seriesFormat); - getRichTextSeriesNameFormatPane().updateFormatParams(params, seriesFormat.getJs()); - - AttrTooltipStartTimeFormat startTimeFormat = ganttTooltipContent.getRichTextStartTimeFormat(); - richTextStartTimeFormatPane.populate(startTimeFormat); - richTextStartTimeFormatPane.updateFormatParams(params, startTimeFormat.getJs()); - - AttrTooltipEndTimeFormat endTimeFormat = ganttTooltipContent.getRichTextEndTimeFormat(); - richTextEndTimeFormatPane.populate(endTimeFormat); - richTextEndTimeFormatPane.updateFormatParams(params, endTimeFormat.getJs()); - - AttrTooltipDurationFormat durationFormat = ganttTooltipContent.getRichTextDurationFormat(); - richTextDurationFormatPane.populate(durationFormat); - richTextDurationFormatPane.updateFormatParams(params, durationFormat.getJs()); - - AttrTooltipProgressFormat progressFormat = ganttTooltipContent.getRichTextProgressFormat(); - richTextProgressFormatPane.populate(progressFormat); - richTextProgressFormatPane.updateFormatParams(params, progressFormat.getJs()); - - populateRichText(attrTooltipContent.getRichTextAttr()); - - checkRichEditorState(attrTooltipContent); - } - } - protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { if (attrTooltipContent instanceof AttrGanttTooltipContent){ AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; @@ -184,16 +143,18 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane } } - protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { - if(attrTooltipContent instanceof AttrGanttTooltipContent) { - AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; + protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) { + super.updateTooltipFormat(target, source); + + if (target instanceof AttrGanttTooltipContent && source instanceof AttrGanttTooltipContent) { + AttrGanttTooltipContent targetGantt = (AttrGanttTooltipContent) target; + AttrGanttTooltipContent sourceGantt = (AttrGanttTooltipContent) source; - richTextProcessesFormatPane.update(ganttTooltipContent.getRichTextProcessesFormat()); - getRichTextSeriesNameFormatPane().update(ganttTooltipContent.getRichTextSeriesFormat()); - richTextStartTimeFormatPane.update(ganttTooltipContent.getRichTextStartTimeFormat()); - richTextEndTimeFormatPane.update(ganttTooltipContent.getRichTextEndTimeFormat()); - richTextDurationFormatPane.update(ganttTooltipContent.getRichTextDurationFormat()); - richTextProgressFormatPane.update(ganttTooltipContent.getRichTextProgressFormat()); + targetGantt.setRichTextProcessesFormat(sourceGantt.getRichTextProcessesFormat()); + targetGantt.setRichTextStartTimeFormat(sourceGantt.getRichTextStartTimeFormat()); + targetGantt.setRichTextEndTimeFormat(sourceGantt.getRichTextEndTimeFormat()); + targetGantt.setRichTextDurationFormat(sourceGantt.getRichTextDurationFormat()); + targetGantt.setRichTextProgressFormat(sourceGantt.getRichTextProgressFormat()); } } From 137adaaef28135d7b1b63d4258a5c86a3526af1b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Fri, 22 Jan 2021 17:14:50 +0800 Subject: [PATCH 087/147] =?UTF-8?q?=E9=80=82=E9=85=8D=E7=AE=B1=E5=9E=8B?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ChartBoxRichTextDetailedFieldListPane.java | 135 ++++++++++ ...anChartBoxRichTextResultFieldListPane.java | 41 +++ .../box/VanChartBoxTooltipContentPane.java | 234 +++++++----------- 3 files changed, 259 insertions(+), 151 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextDetailedFieldListPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextResultFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextDetailedFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextDetailedFieldListPane.java new file mode 100644 index 000000000..d780a44eb --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextDetailedFieldListPane.java @@ -0,0 +1,135 @@ +package com.fr.van.chart.box; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDataMaxFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDataMedianFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDataMinFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDataNumberFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDataOutlierFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDataQ1Format; +import com.fr.plugin.chart.base.format.AttrTooltipDataQ3Format; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; + +public class VanChartBoxRichTextDetailedFieldListPane extends VanChartFieldListPane { + + private VanChartFieldButton richTextNumber; + private VanChartFieldButton richTextMax; + private VanChartFieldButton richTextQ3; + private VanChartFieldButton richTextMedian; + private VanChartFieldButton richTextQ1; + private VanChartFieldButton richTextMin; + private VanChartFieldButton richTextOutlier; + + public VanChartBoxRichTextDetailedFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + public VanChartFieldButton getRichTextMax() { + return richTextMax; + } + + public VanChartFieldButton getRichTextQ3() { + return richTextQ3; + } + + public VanChartFieldButton getRichTextMedian() { + return richTextMedian; + } + + public VanChartFieldButton getRichTextQ1() { + return richTextQ1; + } + + public VanChartFieldButton getRichTextMin() { + return richTextMin; + } + + protected void initDefaultFieldButton() { + VanChartFieldListener listener = getFieldListener(); + + setCategoryNameButton(new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), new AttrTooltipCategoryFormat(), listener)); + setSeriesNameButton(new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), new AttrTooltipSeriesFormat(), listener)); + + richTextNumber = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Number"), new AttrTooltipDataNumberFormat(), listener); + richTextMax = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Max_Value"), new AttrTooltipDataMaxFormat(), listener); + richTextQ3 = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Q3"), new AttrTooltipDataQ3Format(), listener); + richTextMedian = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Median"), new AttrTooltipDataMedianFormat(), listener); + richTextQ1 = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Q1"), new AttrTooltipDataQ1Format(), listener); + richTextMin = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Min_Value"), new AttrTooltipDataMinFormat(), listener); + richTextOutlier = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Outlier_Value"), new AttrTooltipDataOutlierFormat(), listener); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getCategoryNameButton()); + fieldPane.add(getSeriesNameButton()); + fieldPane.add(richTextNumber); + fieldPane.add(richTextMax); + fieldPane.add(richTextQ3); + fieldPane.add(richTextMedian); + fieldPane.add(richTextQ1); + fieldPane.add(richTextMin); + fieldPane.add(richTextOutlier); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getCategoryNameButton()); + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(richTextNumber); + fieldButtonList.add(richTextMax); + fieldButtonList.add(richTextQ3); + fieldButtonList.add(richTextMedian); + fieldButtonList.add(richTextQ1); + fieldButtonList.add(richTextMin); + fieldButtonList.add(richTextOutlier); + + return fieldButtonList; + } + + public void populateDefaultField(AttrTooltipContent tooltipContent) { + super.populateDefaultField(tooltipContent); + + if (tooltipContent instanceof AttrBoxTooltipContent) { + AttrBoxTooltipContent box = (AttrBoxTooltipContent) tooltipContent; + + populateButtonFormat(richTextNumber, box.getRichTextNumber()); + populateButtonFormat(richTextMax, box.getRichTextMax()); + populateButtonFormat(richTextQ3, box.getRichTextQ3()); + populateButtonFormat(richTextMedian, box.getRichTextMedian()); + populateButtonFormat(richTextQ1, box.getRichTextQ1()); + populateButtonFormat(richTextMin, box.getRichTextMin()); + populateButtonFormat(richTextOutlier, box.getRichTextOutlier()); + } + } + + public void updateDefaultField(AttrTooltipContent tooltipContent) { + super.updateDefaultField(tooltipContent); + + if (tooltipContent instanceof AttrBoxTooltipContent) { + AttrBoxTooltipContent box = (AttrBoxTooltipContent) tooltipContent; + + updateButtonFormat(richTextNumber, box.getRichTextNumber()); + updateButtonFormat(richTextMax, box.getRichTextMax()); + updateButtonFormat(richTextQ3, box.getRichTextQ3()); + updateButtonFormat(richTextMedian, box.getRichTextMedian()); + updateButtonFormat(richTextQ1, box.getRichTextQ1()); + updateButtonFormat(richTextMin, box.getRichTextMin()); + updateButtonFormat(richTextOutlier, box.getRichTextOutlier()); + } + } + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextResultFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextResultFieldListPane.java new file mode 100644 index 000000000..9816967ff --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextResultFieldListPane.java @@ -0,0 +1,41 @@ +package com.fr.van.chart.box; + +import com.fr.design.ui.ModernUIPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; + +public class VanChartBoxRichTextResultFieldListPane extends VanChartBoxRichTextDetailedFieldListPane { + + public VanChartBoxRichTextResultFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getCategoryNameButton()); + fieldPane.add(getSeriesNameButton()); + fieldPane.add(getRichTextMax()); + fieldPane.add(getRichTextQ3()); + fieldPane.add(getRichTextMedian()); + fieldPane.add(getRichTextQ1()); + fieldPane.add(getRichTextMin()); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getCategoryNameButton()); + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(getRichTextMax()); + fieldButtonList.add(getRichTextQ3()); + fieldButtonList.add(getRichTextMedian()); + fieldButtonList.add(getRichTextQ1()); + fieldButtonList.add(getRichTextMin()); + + return fieldButtonList; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java index 25eb587d8..64501bd9a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java @@ -4,8 +4,8 @@ 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.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; import com.fr.plugin.chart.base.format.AttrTooltipDataMaxFormat; import com.fr.plugin.chart.base.format.AttrTooltipDataMedianFormat; @@ -25,12 +25,15 @@ import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckB import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; -import java.util.Map; public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { @@ -55,9 +58,6 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { private JPanel dataNumberPane; private JPanel dataOutlierPane; - private JPanel richTextNumberPane; - private JPanel richTextOutlierPane; - public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane, boolean isDetailed) { super(parent, showOnPane); checkFormatVisible(isDetailed); @@ -155,14 +155,74 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { return commonPanel; } - protected JPanel createRichFormatPanel() { - JPanel richFormatPanel = new JPanel(new BorderLayout()); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + if (detailed) { + return new VanChartBoxRichTextDetailedFieldListPane(fieldAttrPane, richEditor); + } + + return new VanChartBoxRichTextResultFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + + protected String[] getRichTextFieldNames() { + if (detailed) { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Data_Number"), + Toolkit.i18nText("Fine-Design_Chart_Max_Value"), + Toolkit.i18nText("Fine-Design_Chart_Data_Q3"), + Toolkit.i18nText("Fine-Design_Chart_Data_Median"), + Toolkit.i18nText("Fine-Design_Chart_Data_Q1"), + Toolkit.i18nText("Fine-Design_Chart_Min_Value"), + Toolkit.i18nText("Fine-Design_Chart_Outlier_Value") + }; + } + + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Max_Value"), + Toolkit.i18nText("Fine-Design_Chart_Data_Q3"), + Toolkit.i18nText("Fine-Design_Chart_Data_Median"), + Toolkit.i18nText("Fine-Design_Chart_Data_Q1"), + Toolkit.i18nText("Fine-Design_Chart_Min_Value") + }; + } - richFormatPanel.add(createRichTextCateAndSeriesPane(), BorderLayout.NORTH); - richFormatPanel.add(createRichTextDataNumberPane(), BorderLayout.CENTER); - richFormatPanel.add(createRichTextDataDetailPane(), BorderLayout.SOUTH); + protected AttrTooltipFormat[] getRichTextFieldFormats() { + if (detailed) { + return new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipDataNumberFormat(), + new AttrTooltipDataMaxFormat(), + new AttrTooltipDataQ3Format(), + new AttrTooltipDataMedianFormat(), + new AttrTooltipDataQ1Format(), + new AttrTooltipDataMinFormat(), + new AttrTooltipDataOutlierFormat() + }; + } - return richFormatPanel; + return new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipDataMaxFormat(), + new AttrTooltipDataQ3Format(), + new AttrTooltipDataMedianFormat(), + new AttrTooltipDataQ1Format(), + new AttrTooltipDataMinFormat() + }; } protected Component[][] getRichTextComponents() { @@ -249,72 +309,6 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { return detailPane; } - private JPanel createRichTextCateAndSeriesPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - - double[] columnSize = {f, e}; - double[] rowSize = {p, p, p}; - - Component[][] cateAndSeries = new Component[][]{ - new Component[]{null, null}, - new Component[]{null, getRichTextCategoryNameFormatPane()}, - new Component[]{null, getRichTextSeriesNameFormatPane()} - }; - - return TableLayoutHelper.createTableLayoutPane(cateAndSeries, rowSize, columnSize); - } - - private JPanel createRichTextDataNumberPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - - double[] columnSize = {f, e}; - double[] rowSize = {p, p}; - - Component[][] dataNumber = new Component[][]{ - new Component[]{null, null}, - new Component[]{null, richTextNumber}, - }; - - richTextNumberPane = TableLayoutHelper.createTableLayoutPane(dataNumber, rowSize, columnSize); - - return richTextNumberPane; - } - - private JPanel createRichTextDataDetailPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - - double[] columnSize = {f, e}; - - JPanel detailPane = new JPanel(new BorderLayout()); - - Component[][] richTextDetail = new Component[][]{ - new Component[]{null, null}, - new Component[]{null, richTextMax}, - new Component[]{new UILabel(getLabelContentTitle()), richTextQ3}, - new Component[]{null, richTextMedian}, - new Component[]{null, richTextQ1}, - new Component[]{null, richTextMin} - }; - - Component[][] dataOutlier = new Component[][]{ - new Component[]{null, null}, - new Component[]{null, richTextOutlier}, - }; - - richTextOutlierPane = TableLayoutHelper.createTableLayoutPane(dataOutlier, new double[]{p, p}, columnSize); - - detailPane.add(TableLayoutHelper.createTableLayoutPane(richTextDetail, new double[]{p, p, p, p, p, p}, columnSize), BorderLayout.NORTH); - detailPane.add(richTextOutlierPane, BorderLayout.CENTER); - - return detailPane; - } - public boolean isDirty() { return getCategoryNameFormatPane().isDirty() || getSeriesNameFormatPane().isDirty() @@ -362,63 +356,21 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { } } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - setRichTextAttr(new AttrTooltipRichText()); - Map params = getRichTextAttr().getParams(); - - AttrTooltipCategoryFormat categoryFormat = attrTooltipContent.getRichTextCategoryFormat(); - getRichTextCategoryNameFormatPane().populate(categoryFormat); - getRichTextCategoryNameFormatPane().updateFormatParams(params, categoryFormat.getJs()); - - AttrTooltipSeriesFormat seriesFormat = attrTooltipContent.getRichTextSeriesFormat(); - getRichTextSeriesNameFormatPane().populate(seriesFormat); - getRichTextSeriesNameFormatPane().updateFormatParams(params, seriesFormat.getJs()); - - if (attrTooltipContent instanceof AttrBoxTooltipContent) { - AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent; - - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = getFormatPaneGroup(); - AttrTooltipFormat[] formatGroup = getFormatGroup(boxTooltipContent); - - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); - - checkRichEditorState(attrTooltipContent); - } - } - - private VanChartFormatPaneWithoutCheckBox[] getFormatPaneGroup() { - if (detailed) { - return new VanChartFormatPaneWithoutCheckBox[]{ - richTextNumber, richTextMax, richTextQ3, richTextMedian, - richTextQ1, richTextMin, richTextOutlier - }; - } - - return new VanChartFormatPaneWithoutCheckBox[]{ - richTextMax, richTextQ3, richTextMedian, richTextQ1, richTextMin - }; - } + protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) { + super.updateTooltipFormat(target, source); - private AttrTooltipFormat[] getFormatGroup(AttrBoxTooltipContent boxTooltipContent) { - AttrTooltipDataNumberFormat richTextNumber = boxTooltipContent.getRichTextNumber(); - AttrTooltipDataMaxFormat richTextMaxFormat = boxTooltipContent.getRichTextMax(); - AttrTooltipDataQ3Format richTextQ3Format = boxTooltipContent.getRichTextQ3(); - AttrTooltipDataMedianFormat richTextMedianFormat = boxTooltipContent.getRichTextMedian(); - AttrTooltipDataQ1Format richTextQ1Format = boxTooltipContent.getRichTextQ1(); - AttrTooltipDataMinFormat richTextMinFormat = boxTooltipContent.getRichTextMin(); - AttrTooltipDataOutlierFormat richTextOutlierFormat = boxTooltipContent.getRichTextOutlier(); + if (target instanceof AttrBoxTooltipContent && source instanceof AttrBoxTooltipContent) { + AttrBoxTooltipContent targetGantt = (AttrBoxTooltipContent) target; + AttrBoxTooltipContent sourceGantt = (AttrBoxTooltipContent) source; - if (detailed) { - return new AttrTooltipFormat[]{ - richTextNumber, richTextMaxFormat, richTextQ3Format, richTextMedianFormat, - richTextQ1Format, richTextMinFormat, richTextOutlierFormat - }; + targetGantt.setRichTextNumber(sourceGantt.getRichTextNumber()); + targetGantt.setRichTextMax(sourceGantt.getRichTextMax()); + targetGantt.setRichTextQ3(sourceGantt.getRichTextQ3()); + targetGantt.setRichTextMedian(sourceGantt.getRichTextMedian()); + targetGantt.setRichTextQ1(sourceGantt.getRichTextQ1()); + targetGantt.setRichTextMin(sourceGantt.getRichTextMin()); + targetGantt.setRichTextOutlier(sourceGantt.getRichTextOutlier()); } - - return new AttrTooltipFormat[]{ - richTextMaxFormat, richTextQ3Format, richTextMedianFormat, richTextQ1Format, richTextMinFormat - }; } protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { @@ -440,30 +392,10 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { } } - protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { - getRichTextCategoryNameFormatPane().update(attrTooltipContent.getRichTextCategoryFormat()); - getRichTextSeriesNameFormatPane().update(attrTooltipContent.getRichTextSeriesFormat()); - - if (attrTooltipContent instanceof AttrBoxTooltipContent) { - AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent; - - richTextNumber.update(boxTooltipContent.getRichTextNumber()); - richTextMax.update(boxTooltipContent.getRichTextMax()); - richTextQ3.update(boxTooltipContent.getRichTextQ3()); - richTextMedian.update(boxTooltipContent.getRichTextMedian()); - richTextQ1.update(boxTooltipContent.getRichTextQ1()); - richTextMin.update(boxTooltipContent.getRichTextMin()); - richTextOutlier.update(boxTooltipContent.getRichTextOutlier()); - } - } - public void checkFormatVisible(boolean detailed) { this.detailed = detailed; dataNumberPane.setVisible(detailed); dataOutlierPane.setVisible(detailed); - - richTextNumberPane.setVisible(detailed); - richTextOutlierPane.setVisible(detailed); } } From af29f516ef6e45e286b7aedcd55e60e6897f4a22 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 24 Jan 2021 16:14:15 +0800 Subject: [PATCH 088/147] =?UTF-8?q?=E9=80=82=E9=85=8D=E9=A5=BC=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VanChartPieCategoryLabelContentPane.java | 80 ++++++++++--------- ...ChartPieCategoryRichTextFieldListPane.java | 66 +++++++++++++++ .../VanChartPieValueLabelContentPane.java | 47 +++++++++-- ...VanChartPieValueRichTextFieldListPane.java | 34 ++++++++ ...ChartScatterRefreshTooltipContentPane.java | 21 ----- 5 files changed, 180 insertions(+), 68 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java index e5b55d749..73c63bbee 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java @@ -1,16 +1,20 @@ package com.fr.van.chart.pie.style; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.AttrTooltipRichText; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSummaryValueFormat; import com.fr.plugin.chart.pie.attr.PieCategoryLabelContent; import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SummaryValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SummaryValueFormatPaneWithoutCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -25,8 +29,6 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan private SummaryValueFormatPaneWithCheckBox summaryValueFormatPane; - private SummaryValueFormatPaneWithoutCheckBox richTextSummaryValueFormatPane; - public VanChartPieCategoryLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) { super(parent, showOnPane, inCondition); } @@ -42,25 +44,39 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan summaryValueFormatPane = new SummaryValueFormatPaneWithCheckBox(parent, showOnPane); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane)); - richTextSummaryValueFormatPane = new SummaryValueFormatPaneWithoutCheckBox(parent, showOnPane); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartPieCategoryRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; } - @Override - protected Component[][] getPaneComponents() { - return new Component[][]{ - new Component[]{getCategoryNameFormatPane(), null}, - new Component[]{summaryValueFormatPane, null}, + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Summary_Value") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipSummaryValueFormat() }; } @Override - protected Component[][] getRichTextComponents() { + protected Component[][] getPaneComponents() { return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{richTextSummaryValueFormatPane, null}, + new Component[]{getCategoryNameFormatPane(), null}, + new Component[]{summaryValueFormatPane, null}, }; } @@ -81,23 +97,15 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan summaryValueFormatPane.populate(pieCategoryLabelContent.getSummaryValueFormat()); } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent; - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextCategoryNameFormatPane(), - richTextSummaryValueFormatPane - }; - - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - pieCategoryLabelContent.getRichTextCategoryFormat(), - pieCategoryLabelContent.getRichTextSummaryValueFormat() - }; + protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) { + super.updateTooltipFormat(target, source); - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(pieCategoryLabelContent.getRichTextAttr()); + if (target instanceof PieCategoryLabelContent && source instanceof PieCategoryLabelContent) { + PieCategoryLabelContent targetPieCategory = (PieCategoryLabelContent) target; + PieCategoryLabelContent sourcePieCategory = (PieCategoryLabelContent) source; - checkRichEditorState(pieCategoryLabelContent); + targetPieCategory.setRichTextSummaryValueFormat(sourcePieCategory.getRichTextSummaryValueFormat()); + } } @Override @@ -107,12 +115,6 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan summaryValueFormatPane.update(pieCategoryLabelContent.getSummaryValueFormat()); } - protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { - PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent; - super.updateRichEditor(pieCategoryLabelContent); - richTextSummaryValueFormatPane.update(pieCategoryLabelContent.getRichTextSummaryValueFormat()); - } - @Override public void setDirty(boolean isDirty) { getCategoryNameFormatPane().setDirty(isDirty); diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java new file mode 100644 index 000000000..deb62c01c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java @@ -0,0 +1,66 @@ +package com.fr.van.chart.pie.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipSummaryValueFormat; +import com.fr.plugin.chart.pie.attr.PieCategoryLabelContent; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; + +public class VanChartPieCategoryRichTextFieldListPane extends VanChartFieldListPane { + + private VanChartFieldButton summaryValueButton; + + public VanChartPieCategoryRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + super.initDefaultFieldButton(); + + VanChartFieldListener listener = getFieldListener(); + + summaryValueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Summary_Value"), + new AttrTooltipSummaryValueFormat(), false, listener); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getCategoryNameButton()); + fieldPane.add(summaryValueButton); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getCategoryNameButton()); + fieldButtonList.add(summaryValueButton); + + return fieldButtonList; + } + + public void populateDefaultField(AttrTooltipContent tooltipContent) { + super.populateDefaultField(tooltipContent); + + if (tooltipContent instanceof PieCategoryLabelContent) { + PieCategoryLabelContent pieCategory = (PieCategoryLabelContent) tooltipContent; + populateButtonFormat(summaryValueButton, pieCategory.getRichTextSummaryValueFormat()); + } + } + + public void updateDefaultField(AttrTooltipContent tooltipContent) { + super.updateDefaultField(tooltipContent); + + if (tooltipContent instanceof PieCategoryLabelContent) { + PieCategoryLabelContent pieCategory = (PieCategoryLabelContent) tooltipContent; + updateButtonFormat(summaryValueButton, pieCategory.getRichTextSummaryValueFormat()); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java index ddc6e6631..6fdc4e584 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java @@ -1,12 +1,20 @@ package com.fr.van.chart.pie.style; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; +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.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -35,11 +43,34 @@ public class VanChartPieValueLabelContentPane extends VanChartLabelContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartPieValueRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueRichTextFieldListPane.java new file mode 100644 index 000000000..072b3a801 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueRichTextFieldListPane.java @@ -0,0 +1,34 @@ +package com.fr.van.chart.pie.style; + +import com.fr.design.ui.ModernUIPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; + +public class VanChartPieValueRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartPieValueRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getSeriesNameButton()); + fieldPane.add(getValueButton()); + fieldPane.add(getPercentButton()); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(getValueButton()); + fieldButtonList.add(getPercentButton()); + + return fieldButtonList; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java index e5416b1c2..742df9634 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java @@ -77,27 +77,6 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo } } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - super.populateRichEditor(attrTooltipContent); - - if (attrTooltipContent instanceof ScatterAttrTooltipContent) { - ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; - - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - richTextChangedSizeFormatPane, - getRichTextChangedPercentFormatPane() - }; - - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - scatterAttrTooltipContent.getRichTextChangeSizeFormat(), - scatterAttrTooltipContent.getRichTextChangedSizePercentFormat() - }; - - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); - } - } - @Override protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { super.updateFormatPane(attrTooltipContent); From 0e48e287219beae43059fa54ce6b53c67cc26b29 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 24 Jan 2021 21:49:45 +0800 Subject: [PATCH 089/147] =?UTF-8?q?=E9=80=82=E9=85=8D=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E7=9B=98=EF=BC=8C=E6=B8=85=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../box/VanChartBoxTooltipContentPane.java | 66 ------------- .../VanChartRefreshTooltipContentPane.java | 22 ----- .../component/VanChartTooltipContentPane.java | 99 ------------------- ...efreshTooltipContentPaneWithOutSeries.java | 18 ---- .../TooltipContentPaneWithOutSeries.java | 53 +++++----- .../VanChartFieldListPaneWithOutSeries.java | 34 +++++++ .../style/VanChartFunnelLabelContentPane.java | 8 -- ...nChartFunnelRefreshTooltipContentPane.java | 18 ---- .../VanChartFunnelTooltipContentPane.java | 8 -- .../VanChartMapRefreshTooltipContentPane.java | 21 ---- ...ChartMutiPieRefreshTooltipContentPane.java | 20 ---- .../VanChartPieValueLabelContentPane.java | 9 -- ...ChartScatterRefreshTooltipContentPane.java | 29 ------ ...artStructureRefreshTooltipContentPane.java | 22 ----- .../VanChartStructureTooltipContentPane.java | 9 -- ...artWordCloudRefreshTooltipContentPane.java | 28 ------ 16 files changed, 65 insertions(+), 399 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/VanChartFieldListPaneWithOutSeries.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java index 64501bd9a..4e7a657d6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java @@ -20,11 +20,8 @@ import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; @@ -47,14 +44,6 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { private VanChartFormatPaneWithCheckBox min; private VanChartFormatPaneWithCheckBox outlier; - private VanChartFormatPaneWithoutCheckBox richTextNumber; - private VanChartFormatPaneWithoutCheckBox richTextMax; - private VanChartFormatPaneWithoutCheckBox richTextQ3; - private VanChartFormatPaneWithoutCheckBox richTextMedian; - private VanChartFormatPaneWithoutCheckBox richTextQ1; - private VanChartFormatPaneWithoutCheckBox richTextMin; - private VanChartFormatPaneWithoutCheckBox richTextOutlier; - private JPanel dataNumberPane; private JPanel dataOutlierPane; @@ -104,47 +93,6 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { }; } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - - richTextNumber = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Data_Number"); - } - }; - richTextMax = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Max_Value"); - } - }; - richTextQ3 = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Data_Q3"); - } - }; - richTextMedian = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Data_Median"); - } - }; - richTextQ1 = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Data_Q1"); - } - }; - richTextMin = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Min_Value"); - } - }; - richTextOutlier = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Outlier_Value"); - } - }; - } - protected JPanel createCommonFormatPanel() { JPanel commonPanel = new JPanel(new BorderLayout()); @@ -225,20 +173,6 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { }; } - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{richTextNumber, null}, - new Component[]{richTextMax, null}, - new Component[]{richTextQ3, null}, - new Component[]{richTextMedian, null}, - new Component[]{richTextQ1, null}, - new Component[]{richTextMin, null}, - new Component[]{richTextOutlier, null} - }; - } - protected double[] getRowSize(double p) { return new double[]{p, p, p, p, p, p, p, p, p, p, p, p}; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java index 7ecb797d6..93ef14761 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java @@ -1,9 +1,7 @@ package com.fr.van.chart.designer.component; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -34,14 +32,6 @@ public class VanChartRefreshTooltipContentPane extends VanChartTooltipContentPan setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane)); - } - protected Component[][] getPaneComponents(){ return new Component[][]{ new Component[]{getCategoryNameFormatPane(), null}, @@ -52,16 +42,4 @@ public class VanChartRefreshTooltipContentPane extends VanChartTooltipContentPan new Component[]{getChangedPercentFormatPane(), null}, }; } - - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextChangedValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; - } - } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index c4c5fa9f5..7b22b02c8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -24,17 +24,11 @@ import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; @@ -84,13 +78,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane getContent() { return content; } @@ -558,13 +496,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartFieldListPaneWithOutSeries(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } }; } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextCategoryNameFormatPane(), - getRichTextValueFormatPane(), - getRichTextPercentFormatPane() + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") }; + } - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - attrTooltipContent.getRichTextCategoryFormat(), - attrTooltipContent.getRichTextValueFormat(), - attrTooltipContent.getRichTextPercentFormat() + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() }; - - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); - - checkRichEditorState(attrTooltipContent); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/VanChartFieldListPaneWithOutSeries.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/VanChartFieldListPaneWithOutSeries.java new file mode 100644 index 000000000..c651dbf89 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/VanChartFieldListPaneWithOutSeries.java @@ -0,0 +1,34 @@ +package com.fr.van.chart.designer.component.tooltip; + +import com.fr.design.ui.ModernUIPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; + +public class VanChartFieldListPaneWithOutSeries extends VanChartFieldListPane { + + public VanChartFieldListPaneWithOutSeries(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getCategoryNameButton()); + fieldPane.add(getValueButton()); + fieldPane.add(getPercentButton()); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getCategoryNameButton()); + fieldButtonList.add(getValueButton()); + fieldButtonList.add(getPercentButton()); + + return fieldButtonList; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java index e785b562b..55c3e3e78 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java @@ -41,14 +41,6 @@ public class VanChartFunnelLabelContentPane extends VanChartLabelContentPane { }; } - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null} - }; - } - @Override protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { setCategoryNameFormatPane(new CategoryNameFormatPaneWithCheckBox(parent, showOnPane)); diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java index b7f817eb3..bb3b8bea3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java @@ -29,14 +29,6 @@ public class VanChartFunnelRefreshTooltipContentPane extends VanChartFunnelToolt setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane)); - } - protected double[] getRowSize(double p){ return new double[]{p,p,p,p,p}; } @@ -50,14 +42,4 @@ public class VanChartFunnelRefreshTooltipContentPane extends VanChartFunnelToolt new Component[]{getChangedPercentFormatPane(), null}, }; } - - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextChangedValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java index e15c62e0c..e8c741b14 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java @@ -40,14 +40,6 @@ public class VanChartFunnelTooltipContentPane extends VanChartTooltipContentPane }; } - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null} - }; - } - @Override protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { setCategoryNameFormatPane(new CategoryNameFormatPaneWithCheckBox(parent, showOnPane)); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java index 7dca0fb3b..dff8a04d5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/tooltip/VanChartMapRefreshTooltipContentPane.java @@ -3,9 +3,7 @@ package com.fr.van.chart.map.designer.style.tooltip; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -35,14 +33,6 @@ public class VanChartMapRefreshTooltipContentPane extends VanChartMapTooltipCont setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane)); - } - protected Component[][] getPaneComponents(){ return new Component[][]{ new Component[]{getCategoryNameFormatPane(), null}, @@ -54,17 +44,6 @@ public class VanChartMapRefreshTooltipContentPane extends VanChartMapTooltipCont }; } - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextChangedValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; - } - @Override protected AttrTooltipContent createAttrTooltip() { AttrTooltipContent content = new AttrTooltipContent(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java index f375fa78f..f2e3534de 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java @@ -31,14 +31,6 @@ public class VanChartMutiPieRefreshTooltipContentPane extends VanChartMultiPieTo setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane)); - } - protected double[] getRowSize(double p){ return new double[]{p,p,p,p,p,p}; } @@ -53,16 +45,4 @@ public class VanChartMutiPieRefreshTooltipContentPane extends VanChartMultiPieTo new Component[]{getChangedPercentFormatPane(), null}, }; } - - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextChangedValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; - } - } diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java index 6fdc4e584..f8c094aa5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java @@ -87,15 +87,6 @@ public class VanChartPieValueLabelContentPane extends VanChartLabelContentPane { }; } - @Override - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null} - }; - } - @Override public void setDirty(boolean isDirty) { getSeriesNameFormatPane().setDirty(isDirty); diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java index 742df9634..dea075650 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java @@ -1,13 +1,9 @@ package com.fr.van.chart.scatter; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -19,7 +15,6 @@ import java.awt.Component; public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterTooltipContentPane { private ChangedValueFormatPaneWithCheckBox changedSizeFormatPane; - private ChangedValueFormatPaneWithoutCheckBox richTextChangedSizeFormatPane; public VanChartScatterRefreshTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { super(null, showOnPane); @@ -33,14 +28,6 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo setChangedPercentFormatPane(changedPercentFormatPane); } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - richTextChangedSizeFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane); - ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane); - setRichTextChangedPercentFormatPane(richTextChangedPercentFormatPane); - } - protected boolean supportRichEditor() { return false; } @@ -60,12 +47,6 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo }; } - @Override - protected Component[][] getRichTextComponents() { - return null; - } - - @Override protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { super.populateFormatPane(attrTooltipContent); @@ -87,16 +68,6 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo } } - protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { - super.updateRichEditor(attrTooltipContent); - - if (attrTooltipContent instanceof ScatterAttrTooltipContent) { - ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; - richTextChangedSizeFormatPane.update(scatterAttrTooltipContent.getRichTextChangeSizeFormat()); - getRichTextChangedPercentFormatPane().update(scatterAttrTooltipContent.getRichTextChangedSizePercentFormat()); - } - } - @Override public void setDirty(boolean isDirty) { super.setDirty(isDirty); diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java index ea09ff3c8..cfbaefc02 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java @@ -1,9 +1,7 @@ package com.fr.van.chart.structure.desinger.style; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -28,16 +26,6 @@ public class VanChartStructureRefreshTooltipContentPane extends VanChartStructur setChangedPercentFormatPane(changedPercentFormatPane); } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - ChangedValueFormatPaneWithoutCheckBox richTextChangedValueFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane); - ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane); - - setRichTextChangedValueFormatPane(richTextChangedValueFormatPane); - setRichTextChangedPercentFormatPane(richTextChangedPercentFormatPane); - } - protected boolean supportRichEditor() { return false; } @@ -55,14 +43,4 @@ public class VanChartStructureRefreshTooltipContentPane extends VanChartStructur new Component[]{getChangedPercentFormatPane(), null}, }; } - - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextChangedValueFormatPane(), null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java index f0252fab7..a2cb16308 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java @@ -39,15 +39,6 @@ public class VanChartStructureTooltipContentPane extends VanChartTooltipContentP }; } - @Override - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null} - }; - } - @Override protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { CategoryNameFormatPaneWithCheckBox categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTooltipContentPane.java index cab4d8558..5d0ff9f92 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTooltipContentPane.java @@ -3,9 +3,7 @@ package com.fr.van.chart.wordcloud.designer.style; import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -36,21 +34,6 @@ public class VanChartWordCloudRefreshTooltipContentPane extends VanChartWordClou setChangedPercentFormatPane(changedPercentFormatPane); } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - ChangedValueFormatPaneWithoutCheckBox richTextChangedValueFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Change_Word_Value"); - } - }; - - ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane); - - setRichTextChangedValueFormatPane(richTextChangedValueFormatPane); - setRichTextChangedPercentFormatPane(richTextChangedPercentFormatPane); - } - protected boolean supportRichEditor() { return false; } @@ -69,15 +52,4 @@ public class VanChartWordCloudRefreshTooltipContentPane extends VanChartWordClou new Component[]{getChangedPercentFormatPane(), null}, }; } - - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextChangedValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; - } } From 860bd0fc981c6fc947f4093dd5e7cece54405c8a Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 24 Jan 2021 22:22:19 +0800 Subject: [PATCH 090/147] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=8F=82=E6=95=B0=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 7b22b02c8..947c63684 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -47,7 +47,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -450,7 +450,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane params = new HashMap<>(); + Map params = new LinkedHashMap<>(); for (int i = 0, len = fieldNames.length; i < len; i++) { params.put(fieldNames[i], fieldFormats[i].getJs()); @@ -691,21 +691,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane Date: Sun, 24 Jan 2021 23:29:55 +0800 Subject: [PATCH 091/147] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=83=A8=E5=88=86=E5=9B=BE=E8=A1=A8=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/van/chart/designer/PlotFactory.java | 15 +++++++++++++++ .../component/richText/VanChartFieldListPane.java | 6 +++++- .../richText/VanChartRichEditorPane.java | 8 ++++++++ .../VanChartPieCategoryRichTextFieldListPane.java | 4 ++++ 4 files changed, 32 insertions(+), 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 0f9db09fa..3167b5f59 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 @@ -19,6 +19,7 @@ import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; import com.fr.plugin.chart.line.VanChartLinePlot; import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot; +import com.fr.plugin.chart.radar.VanChartRadarPlot; import com.fr.plugin.chart.scatter.VanChartScatterPlot; import com.fr.plugin.chart.structure.VanChartStructurePlot; import com.fr.plugin.chart.treemap.VanChartTreeMapPlot; @@ -94,6 +95,20 @@ public class PlotFactory { return autoAdjustLabelPlots.contains(plot.getClass()); } + private static Set> supportAddTableFieldPlots = new HashSet<>(); + + static { + supportAddTableFieldPlots.add(PiePlot4VanChart.class); + supportAddTableFieldPlots.add(VanChartColumnPlot.class); + supportAddTableFieldPlots.add(VanChartLinePlot.class); + supportAddTableFieldPlots.add(VanChartAreaPlot.class); + supportAddTableFieldPlots.add(VanChartRadarPlot.class); + } + + public static boolean plotSupportAddTableField(Plot plot) { + return supportAddTableFieldPlots.contains(plot.getClass()); + } + private static Set> borderAndBackgroundLabelPlots = new HashSet<>(); static { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index 60a0b1158..6e0e587be 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -54,7 +54,7 @@ public class VanChartFieldListPane extends JPanel { List richEditorFieldNames = VanChartRichEditorPane.getFieldNames(); - this.tableFieldNameList = richEditorFieldNames == null ? new ArrayList<>() : richEditorFieldNames; + this.tableFieldNameList = (!supportAddField() || richEditorFieldNames == null) ? new ArrayList<>() : richEditorFieldNames; this.fieldAttrPane = fieldAttrPane; this.richEditorPane = richEditorPane; @@ -133,6 +133,10 @@ public class VanChartFieldListPane extends JPanel { new AttrTooltipPercentFormat(), false, fieldListener); } + protected boolean supportAddField() { + return true; + } + protected void addDefaultFieldButton(JPanel fieldPane) { fieldPane.add(categoryNameButton); fieldPane.add(seriesNameButton); 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 dcec83deb..69c93926c 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 @@ -3,6 +3,7 @@ package com.fr.van.chart.designer.component.richText; import com.fr.base.TableData; import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.MoreNameCDDefinition; import com.fr.chart.chartdata.OneValueCDDefinition; import com.fr.data.TableDataSource; @@ -17,6 +18,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.type.TextAlign; import com.fr.stable.StringUtils; +import com.fr.van.chart.designer.PlotFactory; import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; @@ -51,6 +53,12 @@ public class VanChartRichEditorPane { return; } + Plot plot = chart.getPlot(); + + if (plot == null || !PlotFactory.plotSupportAddTableField(plot)) { + return; + } + TopDefinitionProvider definition = chart.getFilterDefinition(); if (definition == null) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java index deb62c01c..15361b490 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java @@ -32,6 +32,10 @@ public class VanChartPieCategoryRichTextFieldListPane extends VanChartFieldListP new AttrTooltipSummaryValueFormat(), false, listener); } + protected boolean supportAddField() { + return false; + } + protected void addDefaultFieldButton(JPanel fieldPane) { fieldPane.add(getCategoryNameButton()); fieldPane.add(summaryValueButton); From 0527e1265ad0d54e55df97b4c8f2e5b89c9b242d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 25 Jan 2021 16:36:58 +0800 Subject: [PATCH 092/147] =?UTF-8?q?CHART-17775=20=E5=83=8F=E7=B4=A0=20&=20?= =?UTF-8?q?=E7=99=BE=E5=88=86=E6=AF=94=E6=8E=A7=E4=BB=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frpane/UINumberDragPaneWithPercent.java | 24 ++++ .../com/fr/design/gui/ispinner/UISpinner.java | 26 +++- .../ispinner/chart/UISpinnerWithPercent.java | 15 +++ .../gui/ispinner/chart/UISpinnerWithPx.java | 20 +++ .../gui/ispinner/chart/UISpinnerWithUnit.java | 31 +++++ .../design/gui/itextfield/UINumberField.java | 22 ++-- .../gui/itextfield/UINumberFieldWithUnit.java | 114 ++++++++++++++++++ .../SeriesCondition/LabelAlphaPane.java | 3 +- .../van/chart/box/VanChartBoxBorderPane.java | 3 +- .../bubble/component/VanChartBubblePane.java | 5 +- .../chart/column/ColumnBorderAttriPane.java | 3 +- .../column/VanChartColumnSeriesPane.java | 8 +- .../VanChartAreaSeriesFillColorPane.java | 3 +- .../component/VanChartLineTypePane.java | 5 +- .../component/VanChartTrendLinePane.java | 3 +- .../background/VanChartBackgroundPane.java | 3 +- ...rtBackgroundPaneWithOutImageAndShadow.java | 23 +++- ...BackgroundWithOutShadowWithRadiusPane.java | 3 +- .../border/VanChartBorderWithAlphaPane.java | 3 +- .../border/VanChartBorderWithRadiusPane.java | 3 +- .../border/VanChartBorderWithShapePane.java | 3 +- .../marker/VanChartCommonMarkerPane.java | 3 +- .../style/VanChartPlotLegendPane.java | 11 +- .../designer/style/VanChartTitlePane.java | 11 +- .../style/axis/VanChartBaseAxisPane.java | 10 +- .../background/VanChartAlertValuePane.java | 3 +- .../VanChartCustomIntervalBackgroundPane.java | 3 +- .../VanChartAbstractPlotSeriesPane.java | 3 +- .../VanChartDrillMapInteractivePane.java | 10 +- .../style/axis/GanttAxisStylePane.java | 3 +- .../chart/gauge/VanChartGaugeSeriesPane.java | 6 +- .../style/VanChartHeatMapSeriesPane.java | 20 +-- .../van/chart/map/VanChartMapSeriesPane.java | 3 +- .../series/VanChartMapAnchorMarkerPane.java | 3 +- .../van/chart/map/line/VanChartCurvePane.java | 6 +- .../style/VanChartMultiPieSeriesPane.java | 7 +- .../van/chart/pie/RadiusCardLayoutPane.java | 11 +- .../van/chart/pie/VanChartPieSeriesPane.java | 10 +- .../style/StructureNodeStylePane.java | 46 ++++--- .../style/VanChartStructureSeriesPane.java | 35 +++--- .../style/VanChartWordCloudSeriesPane.java | 51 ++++---- 41 files changed, 431 insertions(+), 147 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPaneWithPercent.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPercent.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPx.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberFieldWithUnit.java diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPaneWithPercent.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPaneWithPercent.java new file mode 100644 index 000000000..9a17962b7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPaneWithPercent.java @@ -0,0 +1,24 @@ +package com.fr.design.gui.frpane; + +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPercent; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2021-01-21 + */ +public class UINumberDragPaneWithPercent extends UINumberDragPane { + + public UINumberDragPaneWithPercent(double minValue, double maxValue) { + super(minValue, maxValue); + } + + public UINumberDragPaneWithPercent(double minValue, double maxValue, double dierta) { + super(minValue, maxValue, dierta); + } + + protected UISpinner createUISpinner(double minValue, double maxValue, double dierta) { + return new UISpinnerWithPercent(minValue, maxValue, dierta, minValue); + } +} 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 c60ae2760..454b1e5b9 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 @@ -13,15 +13,28 @@ import com.fr.stable.CommonUtils; import com.fr.stable.Constants; import com.fr.stable.StringUtils; -import com.fr.stable.collections.utils.MathUtils; -import javax.swing.*; +import javax.swing.ButtonModel; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.plaf.ButtonUI; -import java.awt.*; -import java.awt.event.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver { @@ -46,6 +59,9 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver */ private int numberFieldColumns; + public UISpinner() { + + } public UISpinner(double minValue, double maxValue, double dierta) { init(minValue, maxValue, dierta); @@ -56,7 +72,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver textField.setValue(defaultValue); } - private void init(double minValue, double maxValue, double dierta) { + protected void init(double minValue, double maxValue, double dierta) { this.minValue = minValue; this.maxValue = maxValue; this.dierta = dierta; diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPercent.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPercent.java new file mode 100644 index 000000000..5fdc0c3f6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPercent.java @@ -0,0 +1,15 @@ +package com.fr.design.gui.ispinner.chart; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2021-01-21 + */ +public class UISpinnerWithPercent extends UISpinnerWithUnit { + + private static final String UNIT = "%"; + + public UISpinnerWithPercent(double minValue, double maxValue, double dierta, double defaultValue) { + super(minValue, maxValue, dierta, defaultValue, UNIT); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPx.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPx.java new file mode 100644 index 000000000..44397cbc5 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPx.java @@ -0,0 +1,20 @@ +package com.fr.design.gui.ispinner.chart; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2021-01-21 + */ +public class UISpinnerWithPx extends UISpinnerWithUnit { + + private static final String UNIT = "px"; + + public UISpinnerWithPx(double defaultValue) { + this(0, Double.MAX_VALUE, 1, defaultValue); + } + + public UISpinnerWithPx(double minValue, double maxValue, double dierta, double defaultValue) { + super(minValue, maxValue, dierta, defaultValue, UNIT); + this.getTextField().canFillNegativeNumber(false); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java new file mode 100644 index 000000000..d8d8ab849 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java @@ -0,0 +1,31 @@ +package com.fr.design.gui.ispinner.chart; + +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.itextfield.UINumberField; +import com.fr.design.gui.itextfield.UINumberFieldWithUnit; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2021-01-20 + */ +public class UISpinnerWithUnit extends UISpinner { + + private String unit; + + public UISpinnerWithUnit(double minValue, double maxValue, double dierta, double defaultValue, String unit) { + this.unit = unit; + init(minValue, maxValue, dierta); + getTextField().setValue(defaultValue); + } + + @Override + protected UINumberField initNumberField() { + return new UINumberFieldWithUnit(3, unit); + } + + @Override + public UINumberFieldWithUnit getTextField() { + return (UINumberFieldWithUnit) super.getTextField(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java index 12b894ddc..f4437a9c4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java @@ -1,16 +1,15 @@ package com.fr.design.gui.itextfield; import com.fr.base.Utils; -import com.fr.design.gui.ilable.UILabel; import com.fr.general.ComparatorUtils; import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; -import javax.swing.*; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; -import java.awt.*; +import java.awt.Dimension; +import java.awt.Toolkit; /** * Number Field. @@ -193,7 +192,6 @@ public class UINumberField extends UITextField { if (!fillNegativeNumber && strNew.contains("-")) { return true; } - boolean noChange = false; boolean isMinus = strNew.startsWith("-"); strNew = strNew.replaceFirst("-", StringUtils.EMPTY); // 控制能输入负数 String strIntPart; @@ -207,25 +205,27 @@ public class UINumberField extends UITextField { } if (isOverMaxOrMinValue(strIntPart, strDecPart, strNew)) { Toolkit.getDefaultToolkit().beep(); - noChange = true; + return true; } + return checkNumber(strNew, isMinus); + } + protected boolean checkNumber(String strValue, boolean isMinus) { try { - if (!ComparatorUtils.equals(strNew, StringUtils.EMPTY) && !ComparatorUtils.equals(strNew, "-")) {// 控制能输入负数 - double d = Double.parseDouble(strNew) * (isMinus ? -1 : 1); + if (!ComparatorUtils.equals(strValue, StringUtils.EMPTY) && !ComparatorUtils.equals(strValue, "-")) {// 控制能输入负数 + double d = Double.parseDouble(strValue) * (isMinus ? -1 : 1); if (d < minValue || d > maxValue) { throw new Exception(); } } } catch (Exception e) { Toolkit.getDefaultToolkit().beep(); - noChange = true; + return true; } - - return noChange; + return false; } - private boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) { + protected boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) { boolean checkLength = strIntPart.length() > maxIntegerLength || strDecPart.length() > maxDecimalLength; return checkLength || (strNew.length() > 1 && ComparatorUtils.equals(strNew.substring(0, 1), "0") && !ComparatorUtils.equals(strNew.substring(1, 2), ".")); diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberFieldWithUnit.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberFieldWithUnit.java new file mode 100644 index 000000000..e9f412551 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberFieldWithUnit.java @@ -0,0 +1,114 @@ +package com.fr.design.gui.itextfield; + +import com.fr.base.Utils; +import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import java.awt.Toolkit; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2021-01-20 + * 这个控件不会限制输入的数字大小,但是同样不允许输入数字之外的字符 + */ +public class UINumberFieldWithUnit extends UINumberField { + + private String unit; + + private List unitList = new ArrayList<>(); + + public UINumberFieldWithUnit(int columns, String unit) { + super(columns); + this.unit = unit; + initUnitList(); + } + + //对单位的字符进行组合 + private void initUnitList() { + char[] chars = unit.toCharArray(); + Set set = new LinkedHashSet<>(); + initUnitList(chars, 0, StringUtils.EMPTY, set); + unitList.addAll(set); + Collections.sort(unitList, Comparator.comparing(String::length)); + } + + private void initUnitList(char[] chars, int index, String str, Set set) { + if (index == chars.length) { + return; + } + for (int i = index; i < chars.length; i++) { + String newStr = str + chars[i]; + set.add(newStr); + initUnitList(chars, i + 1, newStr, set); + } + } + + public void setFieldDocument() { + setDocument(new NumberDocumentNoLimit()); + } + + public void setValue(double value) { + this.setText(Utils.doubleToString(value) + unit); + } + + public double getValue() throws NumberFormatException { + try { + String text = this.getText(); + if (StringUtils.isEmpty(text)) { + return 0; + } + + return Double.parseDouble(text.replace(getEndString(text), StringUtils.EMPTY)); + } catch (NumberFormatException numberFormatException) { + return UINumberField.ERROR_VALUE; + } + } + + private String getEndString(String text) { + int size = unitList.size(); + for (int i = size - 1; i >= 0; i--) { + String unit = unitList.get(i); + if (text.endsWith(unit)) { + return unit; + + } + } + return StringUtils.EMPTY; + } + + class NumberDocumentNoLimit extends NumberDocument { + + public boolean checkString(int offset, String s, String str) { + return (ComparatorUtils.equals(s, "F") + || ComparatorUtils.equals(s, "f") + || ComparatorUtils.equals(s, "D") + || ComparatorUtils.equals(s, "d") + || (ComparatorUtils.equals(s, ".") && getMaxDecimalLength() == 0)); + + } + + protected boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) { + return super.isOverMaxOrMinValue(strIntPart, strDecPart, strNew.replaceFirst(getEndString(strNew), StringUtils.EMPTY)); + } + + protected boolean checkNumber(String strValue, boolean isMinus) { + try { + if (ComparatorUtils.equals(strValue, StringUtils.EMPTY) || ComparatorUtils.equals(strValue, "-")) { + return false; + } + Double.parseDouble(strValue.replaceFirst(getEndString(strValue), StringUtils.EMPTY)); + } catch (Exception e) { + Toolkit.getDefaultToolkit().beep(); + return true; + } + return false; + } + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java index 1962ab4a9..5c9176504 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java @@ -5,6 +5,7 @@ import com.fr.chart.base.DataSeriesCondition; import com.fr.design.condition.ConditionAttrSingleConditionPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ilable.UILabel; @@ -32,7 +33,7 @@ public class LabelAlphaPane extends ConditionAttrSingleConditionPane { }; } }; - lineWidth = new UISpinner(0.5, Double.MAX_VALUE, 0.5, 0.5); + lineWidth = new UISpinnerWithPx(0.5, Double.MAX_VALUE, 0.5, 0.5); Component[][] components = new Component[][]{ new Component[]{null, null}, diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/component/VanChartBubblePane.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/component/VanChartBubblePane.java index a51f91047..2d95bf272 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/component/VanChartBubblePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/component/VanChartBubblePane.java @@ -4,6 +4,7 @@ import com.fr.design.beans.BasicBeanPane; 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.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -24,8 +25,8 @@ public class VanChartBubblePane extends BasicBeanPane { private UIButtonGroup displayNegative; public VanChartBubblePane(){ - minDiameter = new UISpinner(0,Double.MAX_VALUE,1,0); - maxDiameter = new UISpinner(0,Double.MAX_VALUE,1,0); + minDiameter = new UISpinnerWithPx(0); + maxDiameter = new UISpinnerWithPx(0); shadow = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); displayNegative = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/ColumnBorderAttriPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/ColumnBorderAttriPane.java index c81317a81..af4be834a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/ColumnBorderAttriPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/ColumnBorderAttriPane.java @@ -3,6 +3,7 @@ package com.fr.van.chart.column; import com.fr.design.chart.comp.BorderAttriPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import java.awt.Dimension; @@ -19,7 +20,7 @@ public class ColumnBorderAttriPane extends BorderAttriPane { public ColumnBorderAttriPane(String radiusString) { this.add(new UILabel(radiusString + ":")); - radius = new UISpinner(0,1000,1,0); + radius = new UISpinnerWithPx(0,1000,1,0); this.add(radius); radius.setPreferredSize(new Dimension(60, 18)); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java index eb2c3914a..b83a20f61 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java @@ -3,6 +3,8 @@ package com.fr.van.chart.column; import com.fr.base.background.ImageBackground; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -76,10 +78,10 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane { private JPanel createSeriesStylePane(double[] row, double[] col) { isFixedWidth = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), Toolkit.i18nText("Fine-Design_Chart_NO")}); - columnWidth = new UISpinner(0,1000,1,0); + columnWidth = new UISpinnerWithPx(0,1000,1,0); columnWidth.setBorder(BorderFactory.createEmptyBorder(0, (int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0)); - seriesGap = new UINumberDragPane(-100, 100); - categoryGap = new UINumberDragPane(0, 100); + seriesGap = new UINumberDragPaneWithPercent(-100, 100); + categoryGap = new UINumberDragPaneWithPercent(0, 100); isFillWithImage = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), Toolkit.i18nText("Fine-Design_Chart_NO")}); imagePane = new ImageBackgroundQuickPane(false); imagePane.setBorder(BorderFactory.createEmptyBorder(0,(int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0)); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java index 24400cacd..241798bef 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java @@ -2,6 +2,7 @@ package com.fr.van.chart.designer.component; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; @@ -36,7 +37,7 @@ public class VanChartAreaSeriesFillColorPane extends BasicPane { }; } }; - transparent = new UINumberDragPane(0, 100); + transparent = new UINumberDragPaneWithPercent(0, 100); JPanel transparentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha"), transparent); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java index 10c3308b3..b6119aa64 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java @@ -4,6 +4,7 @@ import com.fr.design.dialog.BasicPane; 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.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.utils.gui.UIComponentUtils; @@ -15,11 +16,11 @@ import com.fr.plugin.chart.type.LineType; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; +import java.util.Arrays; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.Arrays; /** * line相关设置 @@ -74,7 +75,7 @@ public class VanChartLineTypePane extends BasicPane { lineTypeComboBox = createLineType(); - lineWidthSpinner = new UISpinner(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE); + lineWidthSpinner = new UISpinnerWithPx(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE); lineTypeComboBox.addActionListener(new ActionListener() { @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java index eb8bd0f16..dbcdb0e21 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java @@ -7,6 +7,7 @@ import com.fr.design.dialog.BasicPane; 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.chart.UISpinnerWithPx; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; @@ -61,7 +62,7 @@ public class VanChartTrendLinePane extends BasicPane{ trendLineName = new UITextField(); trendLineColor = new ColorSelectBox(PREFERRED_WIDTH); trendLineStyle = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID, LineType.DASHED}); - lineWidthSpinner = new UISpinner(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE); + lineWidthSpinner = new UISpinnerWithPx(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE); trendLineType = new UIComboBox(TYPES); prePeriod = new UISpinner(0, Integer.MAX_VALUE, 1, 0); afterPeriod = new UISpinner(0, Integer.MAX_VALUE, 1, 0); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPane.java index 9a81b6ece..c51ac0fe9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPane.java @@ -4,6 +4,7 @@ import com.fr.base.background.ImageBackground; import com.fr.chart.chartglyph.GeneralInfo; import com.fr.design.dialog.BasicPane; 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.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; @@ -112,7 +113,7 @@ public class VanChartBackgroundPane extends BasicPane { } }); transparentLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")); - transparent = new UINumberDragPane(0, 100); + transparent = new UINumberDragPaneWithPercent(0, 100); } protected Component[][] getPaneComponents() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithOutImageAndShadow.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithOutImageAndShadow.java index 812dd5a09..d854f9917 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithOutImageAndShadow.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithOutImageAndShadow.java @@ -1,10 +1,15 @@ package com.fr.van.chart.designer.component.background; +import com.fr.design.constants.LayoutConstants; +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.backgroundpane.ColorBackgroundQuickPane; import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.Component; @@ -28,10 +33,13 @@ public class VanChartBackgroundPaneWithOutImageAndShadow extends VanChartBackgro double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = { p,p,p}; + double[] columnSize = {f, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH}; + double[] rowSize = {p, p, p}; - return TableLayoutHelper.createTableLayoutPane(getPaneComponents(),rowSize,columnSize); + JPanel tableLayoutPane = TableLayoutHelper.createGapTableLayoutPane(getPaneComponents(), rowSize, columnSize, + TableLayout4VanChartHelper.COMPONENT_INTERVAL, LayoutConstants.VGAP_MEDIUM); + tableLayoutPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 4, 0)); + return tableLayoutPane; } @Override @@ -44,7 +52,7 @@ public class VanChartBackgroundPaneWithOutImageAndShadow extends VanChartBackgro */ @Override public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Default_Name"); + return Toolkit.i18nText("Fine-Design_Chart_Default_Name"); } }); paneList.add(new ColorBackgroundQuickPane()); @@ -54,11 +62,14 @@ public class VanChartBackgroundPaneWithOutImageAndShadow extends VanChartBackgro @Override protected Component[][] getPaneComponents() { return new Component[][]{ - new Component[]{typeComboBox, null}, - new Component[]{centerPane, null}, + new Component[]{new UILabel(labelName()), typeComboBox}, + new Component[]{null, centerPane}, new Component[]{getTransparentLabel(), transparent}, }; } + protected String labelName() { + return Toolkit.i18nText("Fine-Design_Chart_Background"); + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java index 807ee6216..e0e834598 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java @@ -3,6 +3,7 @@ package com.fr.van.chart.designer.component.background; import com.fr.chart.chartglyph.GeneralInfo; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import java.awt.Component; @@ -24,7 +25,7 @@ public class VanChartBackgroundWithOutShadowWithRadiusPane extends VanChartBackg } protected Component[][] getPaneComponents() { - radius = new UISpinner(0, 1000, 1, 0); + radius = new UISpinnerWithPx(0, 1000, 1, 0); return new Component[][]{ new Component[]{null, null}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Fill")), typeComboBox}, diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java index 724cefe92..607bc0da5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.designer.component.border; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; @@ -29,7 +30,7 @@ public class VanChartBorderWithAlphaPane extends VanChartBorderPane{ @Override protected void initComponents() { super.initComponents(); - transparent = new UINumberDragPane(0,100); + transparent = new UINumberDragPaneWithPercent(0,100); } protected void initContent() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java index d6fdf9c69..d92f3c0ee 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java @@ -4,6 +4,7 @@ import com.fr.chart.base.AttrBorder; import com.fr.chart.chartglyph.GeneralInfo; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; @@ -34,7 +35,7 @@ public class VanChartBorderWithRadiusPane extends VanChartBorderPane { @Override protected void initComponents() { super.initComponents(); - radius = new UISpinner(0,1000,1,0); + radius = new UISpinnerWithPx(0,1000,1,0); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java index f40a51f12..292ae55ac 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java @@ -7,6 +7,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.gui.xcombox.MarkerComboBox; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; @@ -58,7 +59,7 @@ public class VanChartBorderWithShapePane extends BasicPane { }); lineColorBox = new ColorSelectBox(100); borderShape = new MarkerComboBox(MarkerFactory.getLabelShapeMarkers()); - borderRadius = new UISpinner(0, 1000, 1, 0); + borderRadius = new UISpinnerWithPx(0, 1000, 1, 0); } private void createBorderPane() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java index 444bebfaa..e2cdf0cb0 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java @@ -4,6 +4,7 @@ import com.fr.chart.chartglyph.Marker; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.gui.xcombox.MarkerComboBox; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; @@ -89,7 +90,7 @@ public class VanChartCommonMarkerPane extends BasicBeanPane }; } }; - radius = new UISpinner(0, 100, 0.5, 0); + radius = new UISpinnerWithPx(0, 100, 0.5, 0); double p = TableLayout.PREFERRED; 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 8a0a62f62..5a16aa4c8 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 @@ -4,11 +4,12 @@ import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Plot; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.UIBubbleFloatPane; +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.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -65,7 +66,7 @@ public class VanChartPlotLegendPane extends BasicPane { //区域显示策略 恢复用注释。下面4行删除。 private UIButtonGroup customSize; - private UISpinner maxProportion; + private UINumberDragPane maxProportion; private JPanel maxProportionPane; //区域显示策略 恢复用注释。取消注释。 //private LimitPane limitPane; @@ -294,7 +295,7 @@ public class VanChartPlotLegendPane extends BasicPane { private JPanel createDisplayStrategy() { //区域显示策略 恢复用注释。开始删除。 - maxProportion = new UISpinner(0, 100, 1, 30); + maxProportion = new UINumberDragPaneWithPercent(0, 100, 1); customSize = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), customSize); @@ -402,7 +403,7 @@ public class VanChartPlotLegendPane extends BasicPane { legend.setLayout(layoutButton.getSelectedItem()); //区域显示策略 恢复用注释。下面2行删除。 legend.setCustomSize(customSize.getSelectedIndex() == 1); - legend.setMaxHeight(maxProportion.getValue()); + legend.setMaxHeight(maxProportion.updateBean()); //区域显示策略 恢复用注释。取消注释。 //legend.setLimitAttribute(limitPane.updateBean()); legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); @@ -427,7 +428,7 @@ public class VanChartPlotLegendPane extends BasicPane { layoutButton.setSelectedItem(legend.getLayout()); //区域显示策略 恢复用注释。下面2行删除。 customSize.setSelectedIndex(legend.isCustomSize() ? 1 : 0); - maxProportion.setValue(legend.getMaxHeight()); + maxProportion.populateBean(legend.getMaxHeight()); //区域显示策略 恢复用注释。取消注释。 //limitPane.populateBean(legend.getLimitAttribute()); if (highlightButton != null) { 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 1c02f342c..59652a4af 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 @@ -7,11 +7,12 @@ import com.fr.chart.base.TextAttr; import com.fr.chartx.config.info.constant.ConfigType; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.frpane.UIBubbleFloatPane; +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.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.chart.PaneTitleConstants; @@ -64,7 +65,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { //区域显示策略 恢复用注释。下面3行删除。 private UIButtonGroup limitSize; - private UISpinner maxProportion; + private UINumberDragPane maxProportion; private JPanel maxProportionPane; //区域显示策略 恢复用注释。取消注释。 //private LimitPane limitPane; @@ -183,7 +184,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { private JPanel createDisplayStrategy() { //区域显示策略 恢复用注释。开始删除。 - maxProportion = new UISpinner(0, 100, 1, 30); + maxProportion = new UINumberDragPaneWithPercent(0, 100, 1); limitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"), limitSize); @@ -320,7 +321,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { customFloatPositionPane.setFloatPosition_y(title.getFloatPercentY()); //区域显示策略 恢复用注释。下面2行删除。 limitSize.setSelectedIndex(title.isLimitSize() ? 0 : 1); - maxProportion.setValue(title.getMaxHeight()); + maxProportion.populateBean(title.getMaxHeight()); //区域显示策略 恢复用注释。取消注释。 //limitPane.populateBean(title.getLimitAttribute()); @@ -357,7 +358,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { title.setFloating(customFloatPositionButton.isSelected()); //区域显示策略 恢复用注释。下面2行删除。 title.setLimitSize(limitSize.getSelectedIndex() == 0); - title.setMaxHeight(maxProportion.getValue()); + title.setMaxHeight(maxProportion.updateBean()); //区域显示策略 恢复用注释。取消注释。 //title.setLimitAttribute(limitPane.updateBean()); title.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index 955be0a8c..9fb0c7e31 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -8,11 +8,11 @@ import com.fr.chart.chartattr.Title; import com.fr.design.beans.FurtherBasicBeanPane; 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.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.style.FormatPane; import com.fr.design.i18n.Toolkit; @@ -97,7 +97,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { //区域显示策略 恢复用注释。下面3行删除。 protected UIButtonGroup axisLimitSize; - protected UISpinner maxProportion; + protected UINumberDragPane maxProportion; protected JPanel maxProportionPane; //区域显示策略 恢复用注释。取消注释。 //private LimitPane limitPane; @@ -465,7 +465,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected JPanel createDisplayStrategy() { //区域显示策略 恢复用注释。删除到return,即除了注释的代码都删除。 - maxProportion = new UISpinner(0, 100, 1, 30); + maxProportion = new UINumberDragPaneWithPercent(0, 100, 1); axisLimitSize = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Limit"), Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), axisLimitSize); @@ -767,7 +767,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { axisLimitSize.setSelectedIndex(axis.isLimitSize() ? 0 : 1); } if (maxProportion != null) { - maxProportion.setValue(axis.getMaxHeight()); + maxProportion.populateBean(axis.getMaxHeight()); } //区域显示策略 恢复用注释。取消注释。 @@ -909,7 +909,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { axis.setLimitSize(axisLimitSize.getSelectedIndex() == 0); } if (maxProportion != null) { - axis.setMaxHeight(maxProportion.getValue()); + axis.setMaxHeight(maxProportion.updateBean()); } //区域显示策略 恢复用注释。取消注释。 // if (limitPane != null) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java index ca59824f6..387d974d2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java @@ -10,6 +10,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup; 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.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import com.fr.design.gui.style.FRFontPane; import com.fr.design.layout.FRGUIPaneFactory; @@ -90,7 +91,7 @@ public class VanChartAlertValuePane extends BasicBeanPane { alertValue.setPreferredSize(new Dimension(VALUE_WD, HT)); alertLineStyle = new LineTypeComboBox(new LineType[]{LineType.SOLID, LineType.DASHED}); - lineWidthSpinner = new UISpinner(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE); + lineWidthSpinner = new UISpinnerWithPx(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE); alertLineColor = new ColorSelectBox(PREFERRED_WIDTH); alertTextPosition = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Axis_Top"), Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom")}); alertText = new TinyFormulaPane(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java index 81aa8d276..ef6dc0e11 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java @@ -5,6 +5,7 @@ import com.fr.base.Utils; import com.fr.design.beans.BasicBeanPane; 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.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; @@ -52,7 +53,7 @@ public class VanChartCustomIntervalBackgroundPane extends BasicBeanPane { protected void initComponents() { textAttrPane = new ChartTextAttrPane(); colorSelectBox4button = new ColorSelectBoxWithOutTransparent(100); - transparent = new UINumberDragPane(0, 100); + transparent = new UINumberDragPaneWithPercent(0, 100); } protected Component[][] getUsedComponents() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index 8a48837cb..aab8f3cf2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java @@ -3,9 +3,11 @@ package com.fr.van.chart.gauge; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; 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.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -257,12 +259,12 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { } private Component[] getThermometerWidth() { - thermometerWidth = new UISpinner(0, Double.MAX_VALUE, 0.1, 10); + thermometerWidth = new UISpinnerWithPx(0, Double.MAX_VALUE, 0.1, 10); return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")),thermometerWidth}; } private Component[] getChutePercent() { - chutePercent = new UINumberDragPane(0, 100, 1); + chutePercent = new UINumberDragPaneWithPercent(0, 100, 1); return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Chute_Percent")),chutePercent}; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java index 1e06db777..0dd9cea31 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java @@ -3,9 +3,11 @@ package com.fr.van.chart.heatmap.designer.style; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; 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.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -31,7 +33,7 @@ import java.awt.Component; public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { private UISpinner radius; - private UISpinner blur; + private UINumberDragPane blur; private UINumberDragPane minOpacity; private UINumberDragPane maxOpacity; @@ -119,8 +121,8 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { } private JPanel createHeatPointStylePane() { - radius = new UISpinner(0, Double.MAX_VALUE, 1, 30); - blur = new UISpinner(0, 100, 1, 30); + radius = new UISpinnerWithPx(0, Double.MAX_VALUE, 1, 30); + blur = new UINumberDragPaneWithPercent(0, 100, 1); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -130,8 +132,8 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { Component[][] components = new Component[][]{ new Component[]{null, null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Heat_Map_Radius")), radius, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Heat_Map_Blur")), blur, new UILabel("%")} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Heat_Map_Radius")), radius, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Heat_Map_Blur")), blur, null} }; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); @@ -141,8 +143,8 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { } private JPanel createOpacityPane() { - maxOpacity = new UINumberDragPane(0, 100); - minOpacity = new UINumberDragPane(0, 100); + maxOpacity = new UINumberDragPaneWithPercent(0, 100); + minOpacity = new UINumberDragPaneWithPercent(0, 100); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -169,7 +171,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { if (plot instanceof VanChartHeatMapPlot) { VanChartHeatMapPlot heatMapPlot = (VanChartHeatMapPlot) plot; radius.setValue(heatMapPlot.getRadius()); - blur.setValue(heatMapPlot.getBlur()); + blur.populateBean(heatMapPlot.getBlur()); maxOpacity.populateBean(heatMapPlot.getMaxOpacity()); minOpacity.populateBean(heatMapPlot.getMinOpacity()); getVanChartValueColorPane().populateBean((VanChartRangeLegend) plot.getLegend()); @@ -187,7 +189,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { if (plot instanceof VanChartHeatMapPlot) { VanChartHeatMapPlot heatMapPlot = (VanChartHeatMapPlot) plot; heatMapPlot.setRadius(radius.getValue()); - heatMapPlot.setBlur(blur.getValue()); + heatMapPlot.setBlur(blur.updateBean()); heatMapPlot.setMaxOpacity(maxOpacity.updateBean()); heatMapPlot.setMinOpacity(minOpacity.updateBean()); getVanChartValueColorPane().updateBean((VanChartRangeLegend) plot.getLegend()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index 8f5a3d178..2d1cb2304 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java @@ -5,6 +5,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.design.constants.LayoutConstants; 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.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; @@ -321,7 +322,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { //不透明度 protected JPanel createAlphaPane() { - setTransparent(new UINumberDragPane(0, 100)); + setTransparent(new UINumberDragPaneWithPercent(0, 100)); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java index c7ddda38b..d34a89b5d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java @@ -3,6 +3,7 @@ package com.fr.van.chart.map.designer.style.series; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -20,7 +21,7 @@ public class VanChartMapAnchorMarkerPane extends BasicBeanPane{ } private void initComponents(){ - lineWidth = new UISpinner(0, MAX_WIDTH, STEP, 0.5); + lineWidth = new UISpinnerWithPx(0, MAX_WIDTH, STEP, 0.5); bending = new UINumberDragPane(0, 100); - lineAlphaPane = new UINumberDragPane(0, 100); + lineAlphaPane = new UINumberDragPaneWithPercent(0, 100); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java index 4fa61802d..6c1575cfd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.multilayer.style; import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; @@ -46,7 +47,7 @@ public class VanChartMultiPieSeriesPane extends VanChartPieSeriesPane { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gradual_Deep")}); startAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); endAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); - innerRadius = new UISpinner(0, 100, 1, 0); + innerRadius = new UINumberDragPaneWithPercent(0, 100, 1); supportRotation = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); supportDrill = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), @@ -72,7 +73,7 @@ public class VanChartMultiPieSeriesPane extends VanChartPieSeriesPane { gradualLevel.setSelectedIndex(multiPiePlot.isLight() ? 0 : 1); startAngle.setValue(multiPiePlot.getStartAngle()); endAngle.setValue(multiPiePlot.getEndAngle()); - innerRadius.setValue(multiPiePlot.getInnerRadiusPercent()); + innerRadius.populateBean(multiPiePlot.getInnerRadiusPercent()); supportDrill.setSelectedIndex(multiPiePlot.isSupportDrill() ? 0 : 1); supportRotation.setSelectedIndex(multiPiePlot.isSupportRotation() ? 0 : 1); } @@ -85,7 +86,7 @@ public class VanChartMultiPieSeriesPane extends VanChartPieSeriesPane { multiPiePlot.setLight(gradualLevel.getSelectedIndex() == 0); multiPiePlot.setStartAngle(startAngle.getValue()); multiPiePlot.setEndAngle(endAngle.getValue()); - multiPiePlot.setInnerRadiusPercent(innerRadius.getValue()); + multiPiePlot.setInnerRadiusPercent(innerRadius.updateBean()); multiPiePlot.setSupportDrill(supportDrill.getSelectedIndex() == 0); multiPiePlot.setSupportRotation(supportRotation.getSelectedIndex() == 0); } 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 4932eddb4..7befd40e7 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 @@ -4,9 +4,10 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import com.fr.plugin.chart.attr.radius.VanChartRadiusPlot; import com.fr.plugin.chart.base.VanChartRadius; import com.fr.plugin.chart.type.RadiusType; @@ -14,11 +15,11 @@ import com.fr.van.chart.layout.VanChartCardLayoutPane; import javax.swing.BorderFactory; import javax.swing.JPanel; +import java.util.HashMap; +import java.util.Map; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; -import java.util.HashMap; -import java.util.Map; /** * Created by hufan on 2016/10/25. @@ -40,8 +41,8 @@ public class RadiusCardLayoutPane extends BasicBeanPane { Map paneList = new HashMap(); - radiusType = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fixed")}); - radius = new UISpinner(MIN_RADIUS, MAX_RADIUS, 1, 100); + radiusType = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Fixed")}); + radius = new UISpinnerWithPx(100); radiusContent = new JPanel(new BorderLayout()); radiusContent.add(radius, BorderLayout.CENTER); diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java index a6a1a5e28..6253190da 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java @@ -2,6 +2,8 @@ package com.fr.van.chart.pie; import com.fr.chart.chartattr.Plot; +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.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; @@ -27,7 +29,7 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { protected UISpinner startAngle; protected UISpinner endAngle; - protected UISpinner innerRadius; + protected UINumberDragPane innerRadius; private UIButtonGroup supportRotation; public VanChartPieSeriesPane(ChartStylePane parent, Plot plot) { @@ -52,7 +54,7 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { protected JPanel createSeriesStylePane(double[] row, double[] col) { startAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); endAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); - innerRadius = new UISpinner(0, 100, 1, 0); + innerRadius = new UINumberDragPaneWithPercent(0, 100, 1); supportRotation = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); @@ -86,7 +88,7 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { PiePlot4VanChart piePlot4VanChart = (PiePlot4VanChart) plot; startAngle.setValue(piePlot4VanChart.getStartAngle()); endAngle.setValue(piePlot4VanChart.getEndAngle()); - innerRadius.setValue(piePlot4VanChart.getInnerRadiusPercent()); + innerRadius.populateBean(piePlot4VanChart.getInnerRadiusPercent()); supportRotation.setSelectedIndex(piePlot4VanChart.isSupportRotation() == true ?0:1); } } @@ -107,7 +109,7 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { PiePlot4VanChart piePlot4VanChart = (PiePlot4VanChart)plot; piePlot4VanChart.setStartAngle(startAngle.getValue()); piePlot4VanChart.setEndAngle(endAngle.getValue()); - piePlot4VanChart.setInnerRadiusPercent(innerRadius.getValue()); + piePlot4VanChart.setInnerRadiusPercent(innerRadius.updateBean()); piePlot4VanChart.setSupportRotation(supportRotation.getSelectedItem()); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java index 610c616d9..333646c3c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java @@ -3,13 +3,15 @@ package com.fr.van.chart.structure.desinger.style; import com.fr.base.background.ImageBackground; import com.fr.design.beans.BasicBeanPane; 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.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; - import com.fr.plugin.chart.base.AttrNode; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.background.VanChartMarkerBackgroundPane; @@ -42,38 +44,46 @@ public class StructureNodeStylePane extends BasicBeanPane { double[] columnSize = {f, e}; double[] rowSize = {p, p, p, p, p}; - nodeRadiusType = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); - nodeRadius = new UISpinner(0,Double.MAX_VALUE,0.5,0); - nodeBorderWidth = new UISpinner(0,Double.MAX_VALUE,0.5,0); - nodeBorderColor = new VanChartMarkerBackgroundPane(); - nodeOpacity = new UINumberDragPane(0,100); + nodeRadiusType = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), + Toolkit.i18nText("Fine-Design_Chart_Custom")}); + nodeRadius = new UISpinnerWithPx(0, Double.MAX_VALUE, 0.5, 0); + nodeBorderWidth = new UISpinnerWithPx(0, Double.MAX_VALUE, 0.5, 0); + nodeBorderColor = new VanChartMarkerBackgroundPane() { + protected Component[][] getPaneComponents() { + return new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Node_Radius")), typeComboBox}, + new Component[]{null, centerPane}, + }; + } + }; + nodeOpacity = new UINumberDragPaneWithPercent(0, 100); JPanel jPanel = new JPanel(new BorderLayout()); - jPanel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Node_Radius"), nodeRadiusType), BorderLayout.NORTH); + jPanel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Node_Radius"), nodeRadiusType), BorderLayout.NORTH); nodeRadiusPane = TableLayout4VanChartHelper.createGapTableLayoutPane("", nodeRadius); jPanel.add(nodeRadiusPane, BorderLayout.CENTER); Component[][] components1 = new Component[][]{ new Component[]{null, null}, new Component[]{jPanel, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border_Width")), nodeBorderWidth}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Color")), nodeBorderColor}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), nodeOpacity} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Border_Width")), nodeBorderWidth}, + new Component[]{nodeBorderColor, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), nodeOpacity} }; JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(components1, rowSize, columnSize); - useImage = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_YES"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_NO")}); + useImage = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), + Toolkit.i18nText("Fine-Design_Chart_NO")}); imagePane = new ImageBackgroundQuickPane(false); - imagePane.setBorder(BorderFactory.createEmptyBorder(0,(int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0)); + imagePane.setBorder(BorderFactory.createEmptyBorder(0, (int) TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL, 0, 0)); Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Filled_With_Image")),useImage}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Filled_With_Image")), useImage}, }; JPanel useImagePane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, columnSize); - JPanel panel2 = new JPanel(new BorderLayout(0,6)); + JPanel panel2 = new JPanel(new BorderLayout(0, 6)); panel2.add(useImagePane, BorderLayout.NORTH); panel2.add(imagePane, BorderLayout.CENTER); @@ -91,7 +101,7 @@ public class StructureNodeStylePane extends BasicBeanPane { } }); - this.setLayout(new BorderLayout(0,6)); + this.setLayout(new BorderLayout(0, 6)); this.add(panel1, BorderLayout.NORTH); this.add(panel2, BorderLayout.CENTER); } @@ -112,7 +122,7 @@ public class StructureNodeStylePane extends BasicBeanPane { nodeBorderColor.populate(ob.getBorderColor()); nodeOpacity.populateBean(ob.getOpacity()); useImage.setSelectedIndex(ob.isUseImage() ? 0 : 1); - if(ob.getImageBackground() != null) { + if (ob.getImageBackground() != null) { imagePane.populateBean(ob.getImageBackground()); } checkRadius(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java index ee2cda46a..daa0eaa6e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java @@ -3,9 +3,12 @@ package com.fr.van.chart.structure.desinger.style; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; 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.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -43,7 +46,7 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {f}; - double[] rowSize = {p,p,p}; + double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ new Component[]{createLinkPane()}, new Component[]{createNodePane()} @@ -57,10 +60,10 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane private JPanel createLinkPane() { linkColor = new ColorSelectBox(100); - linkWidthType = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); - linkWidth = new UISpinner(0,Double.MAX_VALUE,0.5,0); - linkOpacity = new UINumberDragPane(0,100); + linkWidthType = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), + Toolkit.i18nText("Fine-Design_Chart_Custom")}); + linkWidth = new UISpinnerWithPx(0, Double.MAX_VALUE, 0.5, 0); + linkOpacity = new UINumberDragPaneWithPercent(0, 100); linkWidthType.addChangeListener(new ChangeListener() { @Override @@ -73,10 +76,10 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double[] columnSize = {f, e}; - double[] rowSize = {p,p,p,p}; + double[] rowSize = {p, p, p, p}; JPanel jPanel = new JPanel(new BorderLayout()); - jPanel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_Width")+" ", linkWidthType), BorderLayout.NORTH); + jPanel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Tree_Width") + " ", linkWidthType), BorderLayout.NORTH); linkWidthPane = TableLayout4VanChartHelper.createGapTableLayoutPane(" ", linkWidth); jPanel.add(linkWidthPane, BorderLayout.CENTER); @@ -104,8 +107,8 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane @Override public void populateBean(Plot plot) { super.populateBean(plot); - if(plot instanceof VanChartStructurePlot){ - VanChartStructurePlot structurePlot = (VanChartStructurePlot)plot; + if (plot instanceof VanChartStructurePlot) { + VanChartStructurePlot structurePlot = (VanChartStructurePlot) plot; linkColor.setSelectObject(structurePlot.getLinkColor()); linkWidthType.setSelectedIndex(structurePlot.isAutoLinkWidth() ? 0 : 1); linkWidth.setValue(structurePlot.getLinkWidth()); @@ -117,8 +120,8 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane @Override public void updateBean(Plot plot) { super.updateBean(plot); - if(plot instanceof VanChartStructurePlot){ - VanChartStructurePlot structurePlot = (VanChartStructurePlot)plot; + if (plot instanceof VanChartStructurePlot) { + VanChartStructurePlot structurePlot = (VanChartStructurePlot) plot; structurePlot.setLinkColor(linkColor.getSelectObject()); structurePlot.setAutoLinkWidth(linkWidthType.getSelectedIndex() == 0); structurePlot.setLinkWidth(linkWidth.getValue()); @@ -126,16 +129,16 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane } } - protected void populateCondition(ConditionAttr defaultAttr){ - if(nodeStylePane != null){ + protected void populateCondition(ConditionAttr defaultAttr) { + if (nodeStylePane != null) { AttrNode attrNode = defaultAttr.getExisted(AttrNode.class); nodeStylePane.populateBean(attrNode); } } - protected void updateCondition(ConditionAttr defaultAttr){ - if(nodeStylePane != null){ - AttrNode attrNode =defaultAttr.getExisted(AttrNode.class); + protected void updateCondition(ConditionAttr defaultAttr) { + if (nodeStylePane != null) { + AttrNode attrNode = defaultAttr.getExisted(AttrNode.class); if (attrNode != null) { defaultAttr.remove(attrNode); defaultAttr.addDataSeriesCondition(nodeStylePane.updateBean()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java index 4e9c612c0..543b8139f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java @@ -4,10 +4,12 @@ import com.fr.base.Utils; import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground; import com.fr.chart.chartattr.Plot; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIButtonGroup; 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.chart.UISpinnerWithPx; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; @@ -61,7 +63,7 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {f}; - double[] rowSize = {p,p,p}; + double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ new Component[]{createWordCloudStylePane()}, }; @@ -71,42 +73,43 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { return contentPane; } - private JPanel createWordCloudStylePane(){ + private JPanel createWordCloudStylePane() { double labelSize = LABEL_SIZE; double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] centerC = {labelSize,f,p,f}; + double[] centerC = {labelSize, f, p, f}; double[] centerR = {p}; - minRotation = new UISpinner(-MAX_ROTATION,MAX_ROTATION,1,0); + minRotation = new UISpinner(-MAX_ROTATION, MAX_ROTATION, 1, 0); maxRotation = new - UISpinner(-MAX_ROTATION,MAX_ROTATION,1,0); + UISpinner(-MAX_ROTATION, MAX_ROTATION, 1, 0); Component[][] centerComps = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Rotation_Angle")), minRotation, new UILabel("-"), maxRotation}, }; - JPanel centerPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(centerComps,centerR,centerC); + JPanel centerPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(centerComps, centerR, centerC); double[] northC = {f, e}; - double[] northR = {p,p}; + double[] northR = {p, p}; fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); defineFontSize = new UIButtonGroup(new String[]{AUTO_FONT_SIZE, CUSTOM_FONT_SIZE}); Component[][] northComps = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font")), fontNameComboBox}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")), defineFontSize } + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")), defineFontSize} }; - JPanel northPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(northComps,northR,northC); + JPanel northPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(northComps, northR, northC); - minFontSize = new UISpinner(0,Double.MAX_VALUE,1,10); - maxFontSize = new UISpinner(0,Double.MAX_VALUE,1,100); + minFontSize = new UISpinnerWithPx(10); + maxFontSize = new UISpinnerWithPx(100); Component[][] fontComps = new Component[][]{ new Component[]{null, minFontSize, new UILabel("-"), maxFontSize}, }; - fontPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(fontComps,centerR,centerC); + fontPanel = TableLayoutHelper.createGapTableLayoutPane(fontComps, centerR, centerC, + 6, LayoutConstants.VGAP_LARGE); double[] columnSize = {f}; double[] rowSize = {p, p, p, p}; @@ -132,27 +135,27 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { private JPanel createCloudShapePane() { cloudShape = new UIComboBox(CloudShapeType.getTypes()); - imageBackgroundQuickPane = new ImageBackgroundQuickPane(false){ + imageBackgroundQuickPane = new ImageBackgroundQuickPane(false) { @Override public Dimension getPreferredSize() { - if(cloudShape.getSelectedItem() == CloudShapeType.DEFAULT){ - return new Dimension(0,0); + if (cloudShape.getSelectedItem() == CloudShapeType.DEFAULT) { + return new Dimension(0, 0); } else { return super.getPreferredSize(); } } }; - JPanel panel = new JPanel(new BorderLayout(0,4)); + JPanel panel = new JPanel(new BorderLayout(0, 4)); panel.add(cloudShape, BorderLayout.NORTH); panel.add(imageBackgroundQuickPane, BorderLayout.CENTER); cloudShape.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - CloudShapeType type = (CloudShapeType)cloudShape.getSelectedItem(); + CloudShapeType type = (CloudShapeType) cloudShape.getSelectedItem(); String path = type.getImageUrl(); - if(path != null) { + if (path != null) { ImageFileBackground imageBackground = new ImageFileBackground(IOUtils.readImage(path)); imageBackgroundQuickPane.populateBean(imageBackground); } else { @@ -181,8 +184,8 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { @Override public void populateBean(Plot plot) { super.populateBean(plot); - if(plot instanceof VanChartWordCloudPlot){ - VanChartWordCloudPlot wordCloudPlot = (VanChartWordCloudPlot)plot; + if (plot instanceof VanChartWordCloudPlot) { + VanChartWordCloudPlot wordCloudPlot = (VanChartWordCloudPlot) plot; fontNameComboBox.setSelectedItem(wordCloudPlot.getFont().getFamily()); minRotation.setValue(wordCloudPlot.getMinRotation()); maxRotation.setValue(wordCloudPlot.getMaxRotation()); @@ -193,7 +196,7 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { cloudShape.setSelectedItem(wordCloudPlot.getShapeType()); ImageBackground imageBackground = wordCloudPlot.getShapeImage(); - if(imageBackground != null) { + if (imageBackground != null) { imageBackgroundQuickPane.populateBean(imageBackground); } } @@ -209,8 +212,8 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { @Override public void updateBean(Plot plot) { super.updateBean(plot); - if(plot instanceof VanChartWordCloudPlot){ - VanChartWordCloudPlot wordCloudPlot = (VanChartWordCloudPlot)plot; + if (plot instanceof VanChartWordCloudPlot) { + VanChartWordCloudPlot wordCloudPlot = (VanChartWordCloudPlot) plot; wordCloudPlot.setFont(FRFont.getInstance(fontNameComboBox.getSelectedItem().toString(), Font.PLAIN, 9)); wordCloudPlot.setMinRotation(minRotation.getValue()); wordCloudPlot.setMaxRotation(maxRotation.getValue()); @@ -220,7 +223,7 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { wordCloudPlot.setMaxFontSize(maxFontSize.getValue()); wordCloudPlot.setShapeType((CloudShapeType) cloudShape.getSelectedItem()); - if(wordCloudPlot.getShapeType() != CloudShapeType.DEFAULT) { + if (wordCloudPlot.getShapeType() != CloudShapeType.DEFAULT) { wordCloudPlot.setShapeImage((ImageBackground) imageBackgroundQuickPane.updateBean()); } else { wordCloudPlot.setShapeImage(null); From d91bbc8cd706d42055f3fdee234f481c7edbdd60 Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 25 Jan 2021 16:49:09 +0800 Subject: [PATCH 093/147] =?UTF-8?q?CHART-18006=20design=20=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=20=E6=8F=90=E7=A4=BA=E4=B8=8B=E8=BD=BD=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/chart/ChartDesignerActivator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java index 0cd81f783..446ed1e61 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java @@ -14,6 +14,7 @@ import com.fr.locale.LocaleMarker; import com.fr.locale.LocaleScope; import com.fr.module.Activator; import com.fr.module.extension.Prepare; +import com.fr.plugin.chart.DownloadSourcesHelper; import com.fr.plugin.chart.vanchart.export.ImagePainter; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; @@ -44,7 +45,7 @@ public class ChartDesignerActivator extends Activator implements Prepare { DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption()); - ImagePainter.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); + DownloadSourcesHelper.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); ImagePainter.registerDefaultCallbackEvent(HistoryTemplateListCache.getInstance()); ChartTypeInterfaceManager.addPluginChangedListener(); From f5509f100b3134c0bfcbfd8624463c8e2a7e17d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 25 Jan 2021 17:19:41 +0800 Subject: [PATCH 094/147] =?UTF-8?q?CHART-17775=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java index d8d8ab849..84ac5fbcb 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java @@ -23,9 +23,4 @@ public class UISpinnerWithUnit extends UISpinner { protected UINumberField initNumberField() { return new UINumberFieldWithUnit(3, unit); } - - @Override - public UINumberFieldWithUnit getTextField() { - return (UINumberFieldWithUnit) super.getTextField(); - } } From 2ad39c8eec604157768fa4f92428c19327686033 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 25 Jan 2021 17:28:06 +0800 Subject: [PATCH 095/147] =?UTF-8?q?CHART-18050=20=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=BC=B9=E7=AA=97=E7=95=8C=E9=9D=A2=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=BA=E5=8F=AF=E6=8B=96=E6=8B=BD=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/component/richText/VanChartRichTextDialog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java index 2cf7050dc..e95ce977f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java @@ -18,7 +18,7 @@ public class VanChartRichTextDialog extends BasicDialog { this.setTitle(Toolkit.i18nText("Fine-Design_Report_RichTextEditor")); this.setBasicDialogSize(DEFAULT); GUICoreUtils.centerWindow(this); - this.setResizable(false); + this.setResizable(true); this.setModal(true); } From 380e67d9e15ab35abd35795c8ae3ff3651bab21b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 25 Jan 2021 20:03:40 +0800 Subject: [PATCH 096/147] =?UTF-8?q?CHART-18050=20=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=8F=8C=E5=88=97=E7=BD=91=E6=A0=BC=E5=B8=83=E5=B1=80=E4=BB=A3?= =?UTF-8?q?=E6=9B=BF=E6=B5=81=E5=BC=8F=E5=B8=83=E5=B1=80=EF=BC=8C=E8=A1=A5?= =?UTF-8?q?=E5=85=85=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/richText/VanChartFieldListPane.java | 2 +- .../component/richText/VanChartRichTextDialog.java | 2 +- .../designer/component/richText/VanChartRichTextPane.java | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index 6e0e587be..61d7cfb25 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -162,7 +162,7 @@ public class VanChartFieldListPane extends JPanel { tableField.setPreferredSize(new Dimension(FIELD_ADD_W, tableFieldNameList.size() * FIELD_ADD_H)); - return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); + return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap(Toolkit.i18nText("Fine-Design_Report_Table_Field"), tableField); } protected List getDefaultFieldButtonList() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java index e95ce977f..2cf7050dc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java @@ -18,7 +18,7 @@ public class VanChartRichTextDialog extends BasicDialog { this.setTitle(Toolkit.i18nText("Fine-Design_Report_RichTextEditor")); this.setBasicDialogSize(DEFAULT); GUICoreUtils.centerWindow(this); - this.setResizable(true); + this.setResizable(false); this.setModal(true); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java index b7c4e968d..d2d0769ee 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.designer.component.richText; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; @@ -38,7 +39,8 @@ public class VanChartRichTextPane extends BasicBeanPane { } private JPanel createFieldContentPane() { - JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + JPanel fieldPane = new JPanel(); + fieldPane.setLayout(FRGUIPaneFactory.create2ColumnGridLayout()); // 新增字段目录 JPanel fieldListContent = new JPanel(); @@ -48,12 +50,12 @@ public class VanChartRichTextPane extends BasicBeanPane { JScrollPane fieldListScrollPane = new JScrollPane(fieldListContent); fieldListScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); fieldListScrollPane.setHorizontalScrollBar(null); - fieldListScrollPane.setBorder(BorderFactory.createTitledBorder("添加字段")); + fieldListScrollPane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Add_Field"))); // 字段格式和汇总 JScrollPane fieldAttrScrollPane = new JScrollPane(fieldAttrPane); fieldAttrScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); - fieldAttrScrollPane.setBorder(BorderFactory.createTitledBorder("字段设置")); + fieldAttrScrollPane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Field_Setting"))); fieldPane.add(fieldListScrollPane); fieldPane.add(fieldAttrScrollPane); From 8eaff4a29aa55a3d018ea7f1ede1218fdf046c86 Mon Sep 17 00:00:00 2001 From: rinoux Date: Tue, 26 Jan 2021 10:58:37 +0800 Subject: [PATCH 097/147] =?UTF-8?q?esd-design=E5=86=85=E7=BD=AE=E8=9E=8D?= =?UTF-8?q?=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/ESDStrategyConfigPane.java | 18 ++++---- .../data/datapane/TableDataTreePane.java | 11 +---- .../tabledatapane/DBTableDataPane.java | 44 +++++++++---------- 3 files changed, 31 insertions(+), 42 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java index 6f50e6ba2..1d2386b6c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java @@ -56,18 +56,18 @@ public class ESDStrategyConfigPane extends BasicBeanPane { private void init() { setLayout(FRGUIPaneFactory.createM_BorderLayout()); - this.selectAutoUpdate = new UIRadioButton(InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Every-Interval")); + this.selectAutoUpdate = new UIRadioButton(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Every_Interval")); this.updateInterval = new UITextField(4); - this.shouldEvolve = new UICheckBox(InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Auto-Evolved-Strategy"), false); + this.shouldEvolve = new UICheckBox(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Auto_Evolved_Strategy"), false); this.shouldEvolve.setEnabled(false); - this.updateIntervalCheckTips = new UILabel(InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Error-Interval-Format")); + this.updateIntervalCheckTips = new UILabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Interval_Format")); this.updateIntervalCheckTips.setForeground(Color.RED); this.updateIntervalCheckTips.setVisible(false); - this.selectBySchema = new UIRadioButton(InterProviderFactory.getProvider().getLocText("ESD_Config-pane-Cron")); + this.selectBySchema = new UIRadioButton(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cron")); this.schemaTime = new UITextField(10); - this.schemaTimeCheckTips = new UILabel(InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Error-Time-Format")); + this.schemaTimeCheckTips = new UILabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Time_Format")); this.schemaTimeCheckTips.setVisible(false); this.schemaTimeCheckTips.setForeground(Color.RED); @@ -90,19 +90,19 @@ public class ESDStrategyConfigPane extends BasicBeanPane { } }); - JPanel pane = FRGUIPaneFactory.createVerticalTitledBorderPane(InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Cache-Update-Strategy")); + JPanel pane = FRGUIPaneFactory.createVerticalTitledBorderPane(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cache_Update_Strategy")); add(pane, BorderLayout.NORTH); JPanel row1 = GUICoreUtils.createFlowPane(new Component[]{ this.selectAutoUpdate, this.updateInterval, - new UILabel(InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Minute-Update-Cache")), + new UILabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Minute_Update_Cache")), this.shouldEvolve, this.updateIntervalCheckTips }, 0, 5); pane.add(row1); - ActionLabel actionLabel = new ActionLabel(InterProviderFactory.getProvider().getLocText("ESD_config-pane-Cron-Help")); + ActionLabel actionLabel = new ActionLabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cron_Help")); actionLabel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -220,6 +220,6 @@ public class ESDStrategyConfigPane extends BasicBeanPane { protected String title4PopupWindow() { - return InterProviderFactory.getProvider().getLocText("ESD_Config-Pane-Cache-Strategy-Config-Title"); + return InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cache_Strategy_Config_Title"); } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 8cb580b5d..9fd8cfa09 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -12,11 +12,6 @@ import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.data.BasicTableDataUtils; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignerStrategyConfigUtils; -import com.fr.design.data.datapane.TableDataCreatorProducer; -import com.fr.design.data.datapane.TableDataNameObjectCreator; -import com.fr.design.data.datapane.TableDataSourceOP; -import com.fr.design.data.datapane.TableDataTree; -import com.fr.design.data.datapane.TableDataTreeDragSource; import com.fr.design.data.tabledata.StoreProcedureWorkerListener; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane; @@ -37,7 +32,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.icon.IconPathConstants; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.WestRegionContainerPane; import com.fr.design.menu.LineSeparator; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; @@ -56,7 +50,6 @@ import org.jetbrains.annotations.NotNull; import javax.swing.BorderFactory; import javax.swing.Icon; -import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.SwingUtilities; @@ -609,7 +602,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { @Override public String getName() { - return Toolkit.i18nText("ESD_Batch-Enable"); + return Toolkit.i18nText("Fine-Design_ESD_Batch_Enable"); } @Override @@ -656,7 +649,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { @Override public String getName() { - return Toolkit.i18nText("ESD_Batch-Disable"); + return Toolkit.i18nText("Fine-Design_ESD_Batch_Disable"); } @Override diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index cd03336f9..a570f1da1 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -5,6 +5,8 @@ import com.fr.base.ParameterHelper; import com.fr.data.core.db.TableProcedure; import com.fr.data.impl.Connection; import com.fr.data.impl.DBTableData; +import com.fr.data.impl.JDBCDatabaseConnection; +import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.impl.NameDatabaseConnection; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; @@ -119,8 +121,8 @@ public class DBTableDataPane extends AbstractTableDataPane { @Override protected void filter(Connection connection, String conName, List nameList) { connection.addConnection(nameList, conName, new Class[]{ - com.fr.data.impl.JDBCDatabaseConnection.class, - com.fr.data.impl.JNDIDatabaseConnection.class + JDBCDatabaseConnection.class, + JNDIDatabaseConnection.class }); } @@ -258,14 +260,14 @@ public class DBTableDataPane extends AbstractTableDataPane { toolBarDef.addShortCut(this.dbTableDataMenuHandler.createQueryAction()); } - UILabel esdSettingsLabel = new UILabel(Toolkit.i18nText("ESD_DBTableData-Pane-Cache-Settings")); + UILabel esdSettingsLabel = new UILabel(Toolkit.i18nText("Fine-Design_ESD_Cache_Settings")); this.configFromList = new UIComboBox(ConfigFrom.values()); - this.esdEnabled = new UICheckBox(Toolkit.i18nText("ESD_DBTableData-Pane-Enable-Cache")); + this.esdEnabled = new UICheckBox(Toolkit.i18nText("Fine-Design_ESD_Enable_Cache")); this.barErrorTips = new UILabel(); this.barErrorTips.setForeground(Color.RED); this.barErrorTips.setVisible(false); - esdSettingsBtn = new UIButton(Toolkit.i18nText("ESD_DBTableData-Pane-Strategy-Config")); + esdSettingsBtn = new UIButton(Toolkit.i18nText("Fine-Design_ESD_Strategy_Config")); esdSettingsBtn.addActionListener(new ActionListener() { @@ -301,12 +303,7 @@ public class DBTableDataPane extends AbstractTableDataPane { }); this.configFromList.setSelectedIndex(DBTableDataPane.ConfigFrom.GLOBAL.getIndex()); - this.configFromList.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - setEsdEnabled(); - } - }); + this.configFromList.addActionListener(e -> setEsdEnabled()); UIToolbar editToolBar = ToolBarDef.createJToolBar(); toolBarDef.updateToolBar(editToolBar); @@ -405,7 +402,6 @@ public class DBTableDataPane extends AbstractTableDataPane { Connection db = dbTableData.getDatabase(); String query = dbTableData.getQuery(); - boolean isShare = dbTableData.isShare(); this.pageQuery = dbTableData.getPageQuerySql(); this.connectionTableProcedurePane.setSelectedDatabaseConnection(db); this.sqlTextPane.setText(query); @@ -433,19 +429,19 @@ public class DBTableDataPane extends AbstractTableDataPane { protected StrategyConfig mapStrategyConfig(DBTableData dbTableData) { - //获取配置,如果是模版数据集,dbTableData实例应该是ESDBTableData,如果是服务器数据集是DBTableData + //获取配置,如果是模版数据集,dbTableData实例应该是DBTableData,如果是服务器数据集是DBTableData StrategyConfig strategyConfig = null; - if (dbTableData instanceof DBTableData) { + if (dbTableData != null) { //设置保存数据集的事件检查钩子 String tplPath = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath(); //新建模版此时不存在,不需要注册钩子 - if (((DBTableData) dbTableData).getXmlSavedHook() == null && WorkContext.getWorkResource().exist(tplPath)) { - ((DBTableData) dbTableData).setXmlSavedHook(new ESDBTableDataSavedHook(tplPath, (DBTableData) dbTableData)); + if (dbTableData.getXmlSavedHook() == null && WorkContext.getWorkResource().exist(tplPath)) { + dbTableData.setXmlSavedHook(new DBTableDataSavedHook(tplPath, dbTableData)); } //获取当前的缓存配置,没有就创建一份 - String dsName = ((DBTableData) this.dbTableData).getDsName(); + String dsName = this.dbTableData.getDsName(); strategyConfig = DesignerStrategyConfigUtils.getStrategyConfig(dsName); if (strategyConfig == null && dbTableData.isShare()) { strategyConfig = StrategyConfigHelper.createStrategyConfig(true, false, true); @@ -603,9 +599,9 @@ public class DBTableDataPane extends AbstractTableDataPane { enum ConfigFrom { - GLOBAL(0, Toolkit.i18nText("ESD_DBTableData-Pane-Use-Global-Settings")), + GLOBAL(0, Toolkit.i18nText("Fine-Design_ESD_Use_Global_Settings")), - INDIVIDUAL(1, Toolkit.i18nText("ESD_DBTableData-Pane-Use-Individual-Settings")); + INDIVIDUAL(1, Toolkit.i18nText("Fine-Design_ESD_Use_Individual_Settings")); int index; @@ -637,7 +633,7 @@ public class DBTableDataPane extends AbstractTableDataPane { } - private static class ESDBTableDataSavedHook implements XMLSavedHook { + private static class DBTableDataSavedHook implements XMLSavedHook { private static final long serialVersionUID = 4925391747683335372L; @@ -648,11 +644,11 @@ public class DBTableDataPane extends AbstractTableDataPane { private String origQuery; - public ESDBTableDataSavedHook(String tplPath, DBTableData origESDBTableData) { + public DBTableDataSavedHook(String tplPath, DBTableData origDBTableData) { this.tplPath = tplPath; - this.origName = origESDBTableData.getDsName(); - this.origConnection = origESDBTableData.getDatabase().toString(); - this.origQuery = origESDBTableData.getQuery(); + this.origName = origDBTableData.getDsName(); + this.origConnection = origDBTableData.getDatabase().toString(); + this.origQuery = origDBTableData.getQuery(); } @Override From a3603b0fa47f8846bd994486eb1b36fdad5100f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 26 Jan 2021 11:33:49 +0800 Subject: [PATCH 098/147] =?UTF-8?q?CHART-17983=20=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E7=9B=98=E7=9B=AE=E6=A0=87=E5=80=BC=E9=BB=98=E8=AE=A4=20&&=20C?= =?UTF-8?q?HART-18024=20=E6=95=B0=E6=8D=AE=E9=9B=86=E6=94=B9=E5=8F=98?= =?UTF-8?q?=EF=BC=8C=E7=9B=91=E5=90=AC=E9=87=8D=E5=A4=8D=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/data/DatabaseTableDataPane.java | 15 ++++++++++----- .../data/table/MeterPlotTableDataContentPane.java | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java index 3c5ebf535..40983c56b 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java @@ -58,7 +58,7 @@ public class DatabaseTableDataPane extends BasicPane{ * 返回选中的数据源. */ public TableDataWrapper getTableDataWrapper() { - return tableNameCombox.getSelectedItem(); + return tableNameCombox.getSelectedItem(); } public void populateBean(TableData nameTableData) { @@ -68,12 +68,12 @@ public class DatabaseTableDataPane extends BasicPane{ tableNameCombox.setSelectedTableDataByName(((NameTableData)nameTableData).getName()); } } - + @Override protected String title4PopupWindow() { return null; } - + /** * 数据集列表选中后的事件 */ @@ -82,7 +82,12 @@ public class DatabaseTableDataPane extends BasicPane{ } private void initTableCombox() { - tableNameCombox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); + tableNameCombox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()){ + //图表的数据集选择下拉框,不需要注册监听,chartEditPane已经注册了。 + public void registerDSChangeListener() { + + } + }; tableNameCombox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { @@ -94,7 +99,7 @@ public class DatabaseTableDataPane extends BasicPane{ } }); } - + private void initReviewButton() { reviewButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/search.png")); reviewButton.setBorder(new LineBorder(UIConstants.LINE_COLOR)); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java index c7830f246..bc18fafda 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java @@ -56,6 +56,7 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane this.setLayout(new BorderLayout()); nameBox = new UIComboBoxWithNone(); + nameBox.setSelectedIndex(nameBox.getItemCount() -1); valueBox = new UIComboBox(); targetBox = new UIComboBox(); custom = new TinyFormulaPane(); From 8150429bb4292d9ec828b23a22ac5e855799b820 Mon Sep 17 00:00:00 2001 From: Yvan Date: Tue, 26 Jan 2021 14:04:14 +0800 Subject: [PATCH 099/147] =?UTF-8?q?REPORT-43833=20=E3=80=9010.0.14?= =?UTF-8?q?=E3=80=91=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5/=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E5=A2=9E=E5=8A=A0=E9=94=81=E5=AE=9A=20?= =?UTF-8?q?=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91=E5=9C=A8?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8=E7=9A=84=E8=BF=87?= =?UTF-8?q?=E7=A8=8B=E4=B8=AD=EF=BC=8CUILockButton=E4=BC=9A=E8=B0=83?= =?UTF-8?q?=E7=94=A8isLocked=E6=96=B9=E6=B3=95=EF=BC=8C=E6=AD=A4=E6=97=B6?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4=E5=AF=B9=E8=B1=A1=E6=B1=A0?= =?UTF-8?q?=E4=B8=AD=E8=BF=98=E6=B2=A1=E6=9C=89=E5=AF=B9=E8=B1=A1=EF=BC=8C?= =?UTF-8?q?=E5=9B=A0=E6=AD=A4=E8=8E=B7=E5=8F=96=E5=88=B0=E7=9A=84operator?= =?UTF-8?q?=E6=98=AFnull=EF=BC=8C=E4=BC=9A=E6=8A=A5npe=20=E3=80=90?= =?UTF-8?q?=E6=94=B9=E5=8A=A8=E6=96=B9=E6=A1=88=E3=80=91=E5=81=9A=E4=B8=AA?= =?UTF-8?q?=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/design/editlock/EditLockUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java index 2ab10fb92..4f332a170 100644 --- a/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java @@ -74,6 +74,8 @@ public class EditLockUtils { } public static boolean isLocked(LockItem lockItem) { - return WorkContext.getCurrent().get(EditLockOperator.class).isLocked(lockItem); + EditLockOperator operator = WorkContext.getCurrent().get(EditLockOperator.class); + // 启动过程中UILockButton初始化的时候会调用这个方法,但是此时workObjectPool中还没有对象,会报npe + return operator != null && operator.isLocked(lockItem); } } From 0a54abe4727ff07eb2ae843eddf0bf140e00374b Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 27 Jan 2021 10:37:52 +0800 Subject: [PATCH 100/147] =?UTF-8?q?REPORT-45901=20=E3=80=9010.0.14?= =?UTF-8?q?=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=A4=9A=E5=BC=80=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 6 +++ .../design/fun/DesignerLifecycleMonitor.java | 31 ++++++++++++ .../fr/design/fun/DesignerPortProvider.java | 31 ++++++++++++ .../DesignerLifecycleMonitorContext.java | 47 +++++++++++++++++++ .../com/fr/design/utils/DesignerPort.java | 7 ++- .../main/java/com/fr/exit/DesignerExiter.java | 4 +- .../main/java/com/fr/start/BaseDesigner.java | 2 + .../main/java/com/fr/start/MainDesigner.java | 2 + 8 files changed, 127 insertions(+), 3 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/DesignerLifecycleMonitor.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/DesignerPortProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/monitor/DesignerLifecycleMonitorContext.java diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 791d679b3..4adcfc1b3 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -15,6 +15,7 @@ import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.fun.DesignerPortProvider; import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.mainframe.vcs.VcsConfigManager; @@ -42,6 +43,7 @@ import com.fr.stable.ListMap; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; +import com.fr.stable.bridge.StableFactory; import com.fr.stable.core.UUID; import com.fr.stable.project.ProjectConstants; import com.fr.stable.xml.XMLPrintWriter; @@ -842,6 +844,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * 返回Jetty服务器的端口号 */ public int getEmbedServerPort() { + DesignerPortProvider portProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); + if (portProvider != null) { + return portProvider.embeddedServerPort(); + } return this.jettyServerPort; } diff --git a/designer-base/src/main/java/com/fr/design/fun/DesignerLifecycleMonitor.java b/designer-base/src/main/java/com/fr/design/fun/DesignerLifecycleMonitor.java new file mode 100644 index 000000000..812ef8ac6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/DesignerLifecycleMonitor.java @@ -0,0 +1,31 @@ +package com.fr.design.fun; + +/** + * 设计器生命周期接口 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/1/26 + */ +public interface DesignerLifecycleMonitor { + + String MARK_STRING = "DesignerLifecycleMonitor"; + + int CURRENT_LEVEL = 1; + + /** + * 设计器启动之前 + */ + void beforeStart(); + + /** + * 设计器启动完成 界面出现之后 + */ + void afterStart(); + + /** + * 设计器关闭退出之前 + */ + void beforeStop(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/DesignerPortProvider.java b/designer-base/src/main/java/com/fr/design/fun/DesignerPortProvider.java new file mode 100644 index 000000000..2b0178c61 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/DesignerPortProvider.java @@ -0,0 +1,31 @@ +package com.fr.design.fun; + +/** + * 设计器所有端口获取 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/1/18 + */ +public interface DesignerPortProvider { + + String MARK_STRING = "DesignerPortProvider"; + + int CURRENT_LEVEL = 1; + + + /** + * 设计器自身端口 + * + * @return + */ + int messagePort(); + + /** + * 内置服务器端口 + * + * @return + */ + int embeddedServerPort(); + +} diff --git a/designer-base/src/main/java/com/fr/design/monitor/DesignerLifecycleMonitorContext.java b/designer-base/src/main/java/com/fr/design/monitor/DesignerLifecycleMonitorContext.java new file mode 100644 index 000000000..a50a04819 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/monitor/DesignerLifecycleMonitorContext.java @@ -0,0 +1,47 @@ +package com.fr.design.monitor; + +import com.fr.design.fun.DesignerLifecycleMonitor; +import com.fr.stable.bridge.StableFactory; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/27 + */ +public class DesignerLifecycleMonitorContext { + + private static DesignerLifecycleMonitor monitor; + + static { + DesignerLifecycleMonitor designerLifecycleMonitor = StableFactory.getMarkedInstanceObjectFromClass(DesignerLifecycleMonitor.MARK_STRING, DesignerLifecycleMonitor.class); + if (designerLifecycleMonitor != null) { + monitor = designerLifecycleMonitor; + } else { + monitor = new EmptyDesignerLifecycleMonitor(); + } + } + + public static DesignerLifecycleMonitor getMonitor() { + return monitor; + } + + static class EmptyDesignerLifecycleMonitor implements DesignerLifecycleMonitor { + + @Override + public void beforeStart() { + + } + + @Override + public void afterStart() { + + } + + @Override + public void beforeStop() { + + } + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java index 1ad1948bf..474c29a8f 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java @@ -4,6 +4,7 @@ import com.fr.common.report.ReportState; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; import com.fr.design.dialog.TipDialog; +import com.fr.design.fun.DesignerPortProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; @@ -13,10 +14,10 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.exit.DesignerExiter; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; -import com.fr.process.ProcessEventPipe; import com.fr.process.engine.core.CarryMessageEvent; import com.fr.process.engine.core.FineProcessContext; import com.fr.stable.StringUtils; +import com.fr.stable.bridge.StableFactory; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLWriter; @@ -58,6 +59,10 @@ public class DesignerPort implements XMLReadable, XMLWriter { private int debugMessagePort = 51463; public int getMessagePort() { + DesignerPortProvider portProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); + if (portProvider != null) { + return portProvider.messagePort(); + } return messagePort; } diff --git a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java index b9067a22e..cda2e015b 100644 --- a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java +++ b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java @@ -1,10 +1,9 @@ package com.fr.exit; import com.fr.design.env.DesignerWorkspaceGenerator; +import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.process.engine.core.FineProcessContext; import com.fr.process.engine.core.FineProcessEngineEvent; -import com.fr.stable.StableUtils; - /** * @author hades @@ -20,6 +19,7 @@ public class DesignerExiter { } public void execute() { + DesignerLifecycleMonitorContext.getMonitor().beforeStop(); beforeExit(); if (FineProcessContext.getParentPipe() != null) { FineProcessContext.getParentPipe().syncFire(FineProcessEngineEvent.DESTROY); diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 7808bd7ec..5eaab74a5 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -14,6 +14,7 @@ import com.fr.design.fun.DesignerStartOpenFileProcessor; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; +import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.design.ui.util.UIUtil; import com.fr.event.Event; import com.fr.event.EventDispatcher; @@ -75,6 +76,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { @Override public void on(Event event, Null param) { + DesignerLifecycleMonitorContext.getMonitor().afterStart(); EventDispatcher.stopListen(this); // 启动完成 停止监听 ProcessEventPipe eventPipe = FineProcessContext.getParentPipe(); 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 a9a1ccbd1..162a2044f 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -36,6 +36,7 @@ import com.fr.design.menu.ShortCut; import com.fr.design.module.ChartEmptyDataStyleAction; import com.fr.design.module.ChartPreStyleAction; import com.fr.design.module.DesignModuleFactory; +import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.event.Event; @@ -102,6 +103,7 @@ public class MainDesigner extends BaseDesigner { StopWatch watch = new StopWatch(); watch.start(); + DesignerLifecycleMonitorContext.getMonitor().beforeStart(); //启动运行时 FineRuntime.start(); DesignerSubListener.getInstance().start(); From 1f5f4613a1f8d589b43e8643f3af04739d763e0d Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 27 Jan 2021 11:40:29 +0800 Subject: [PATCH 101/147] =?UTF-8?q?REPORT-45901=20=E3=80=9010.0.14?= =?UTF-8?q?=E3=80=91oem=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=A4=9A=E5=BC=80?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20--=E5=8A=A0=E4=B8=8A=E7=AB=AF=E5=8F=A3?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 7 ++-- .../fr/design/port/DesignerPortContext.java | 32 +++++++++++++++++++ .../com/fr/design/utils/DesignerPort.java | 11 ++++--- 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 4adcfc1b3..b8951ea8b 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -20,6 +20,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.notification.SnapChatConfig; +import com.fr.design.port.DesignerPortContext; import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.utils.DesignUtils; @@ -844,9 +845,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * 返回Jetty服务器的端口号 */ public int getEmbedServerPort() { - DesignerPortProvider portProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); - if (portProvider != null) { - return portProvider.embeddedServerPort(); + int embeddedServerPort = DesignerPortContext.getEmbeddedServerPort(); + if (embeddedServerPort >= DesignerPort.MIN_PORT && embeddedServerPort <= DesignerPort.MAX_PORT) { + return embeddedServerPort; } return this.jettyServerPort; } diff --git a/designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java b/designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java new file mode 100644 index 000000000..e1e40ddfb --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java @@ -0,0 +1,32 @@ +package com.fr.design.port; + +import com.fr.design.fun.DesignerPortProvider; +import com.fr.stable.bridge.StableFactory; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/27 + */ +public class DesignerPortContext { + + private static int messagePort = -1; + + private static int embeddedServerPort = -1; + + static { + DesignerPortProvider designerPortProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); + if (designerPortProvider != null) { + messagePort = designerPortProvider.messagePort(); + embeddedServerPort = designerPortProvider.embeddedServerPort(); + } + } + + public static int getMessagePort() { + return messagePort; + } + + public static int getEmbeddedServerPort() { + return embeddedServerPort; + } +} diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java index 474c29a8f..28ab5e4c1 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java @@ -10,6 +10,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.port.DesignerPortContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.exit.DesignerExiter; import com.fr.general.ComparatorUtils; @@ -36,8 +37,8 @@ import java.awt.event.ActionListener; public class DesignerPort implements XMLReadable, XMLWriter { public static final String XML_TAG = "DesignerPort"; - private static final int MIN_PORT = 1024; - private static final int MAX_PORT = 65535; + public static final int MIN_PORT = 1024; + public static final int MAX_PORT = 65535; public static final DesignerPort INSTANCE = new DesignerPort(); @@ -59,9 +60,9 @@ public class DesignerPort implements XMLReadable, XMLWriter { private int debugMessagePort = 51463; public int getMessagePort() { - DesignerPortProvider portProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); - if (portProvider != null) { - return portProvider.messagePort(); + int extraMessagePort = DesignerPortContext.getMessagePort(); + if (extraMessagePort >= MIN_PORT && extraMessagePort <= MAX_PORT) { + return extraMessagePort; } return messagePort; } From 8173e27685e900e81f3270ee477c244678f55b6f Mon Sep 17 00:00:00 2001 From: Yvan Date: Wed, 27 Jan 2021 14:56:27 +0800 Subject: [PATCH 102/147] =?UTF-8?q?REPORT-43833=20=E3=80=9010.0.14?= =?UTF-8?q?=E3=80=91=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5/=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E5=A2=9E=E5=8A=A0=E9=94=81=E5=AE=9A=20?= =?UTF-8?q?=E6=BC=8F=E6=8E=89=E4=BA=86=E8=BF=99=E4=B8=AApanel=EF=BC=8C?= =?UTF-8?q?=E5=B0=86=E8=A7=A3=E9=94=81=E6=94=BE=E5=88=B0aftercommit()?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/connect/ConnectionComboBoxPanel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index afd65f3e5..d441984c2 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -144,8 +144,6 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { connectionListDialog.setDoOKSucceed(false); return; } - // 关闭定义数据连接页面,为其解锁 - EditLockUtils.unlock(LockItem.CONNECTION); Configurations.modify(new WorkerFacade(ConnectionConfig.class) { @Override public void run() { @@ -161,6 +159,8 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { @Override public void afterCommit() { DesignerContext.getDesignerBean("databasename").refreshBeanElement(); + // 关闭定义数据连接页面,为其解锁 + EditLockUtils.unlock(LockItem.CONNECTION); } })); From c0c2e2e34e6954e01ef4770df1337ddd406a1d0d Mon Sep 17 00:00:00 2001 From: lucian Date: Wed, 27 Jan 2021 17:54:24 +0800 Subject: [PATCH 103/147] =?UTF-8?q?REPORT-47193=20=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=8F=90=E7=A4=BA=E5=BC=B9=E7=AA=97=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exe/callback/InstallFromDiskCallback.java | 14 ++++------- .../exe/callback/InstallOnlineCallback.java | 18 +++++++------- .../exe/callback/UninstallPluginCallback.java | 14 ++++------- .../exe/callback/UpdateFromDiskCallback.java | 24 ++++++++----------- 4 files changed, 28 insertions(+), 42 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java index 81e76fa45..dd7f00b48 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java @@ -64,20 +64,16 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback { } PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback)); } else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){ - int rv = FineJOptionPane.showOptionDialog( + int rv = FineJOptionPane.showConfirmDialog( null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - FineJOptionPane.YES_NO_CANCEL_OPTION, - FineJOptionPane.INFORMATION_MESSAGE, - null, - FineJOptionPane.OPTION_YES_NO_CANCEL, - null + FineJOptionPane.OK_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE ); - if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { - return; + if (rv == FineJOptionPane.OK_OPTION) { + PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback); } - PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback); }else { jsCallback.execute("failed"); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed")); diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java index c7059f50d..4c94a9f42 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java @@ -41,22 +41,20 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback { FineLoggerFactory.getLogger().info(successInfo); FineJOptionPane.showMessageDialog(null, successInfo); } else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){ - int rv = FineJOptionPane.showOptionDialog( + int rv = FineJOptionPane.showConfirmDialog( null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - FineJOptionPane.YES_NO_CANCEL_OPTION, - FineJOptionPane.INFORMATION_MESSAGE, - null, - FineJOptionPane.OPTION_YES_NO_CANCEL, - null + FineJOptionPane.OK_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE ); - if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { + if (rv == FineJOptionPane.OK_OPTION) { + PluginMarker pluginMarker = result.getCurrentTask().getMarker(); + PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback); + } + else { jsCallback.execute("success"); - return; } - PluginMarker pluginMarker = result.getCurrentTask().getMarker(); - PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback); } else { jsCallback.execute("failed"); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed")); diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java index df3839427..6fba685d7 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java @@ -31,20 +31,16 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback { FineLoggerFactory.getLogger().info(successInfo); FineJOptionPane.showMessageDialog(null, successInfo); }else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) { - int rv = FineJOptionPane.showOptionDialog( + int rv = FineJOptionPane.showConfirmDialog( null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Dependence"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - FineJOptionPane.YES_NO_CANCEL_OPTION, - FineJOptionPane.INFORMATION_MESSAGE, - null, - FineJOptionPane.OPTION_YES_NO_CANCEL, - null + FineJOptionPane.OK_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE ); - if (rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { - return; + if (rv == FineJOptionPane.OK_OPTION) { + PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback)); } - PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback)); } else { jsCallback.execute("failed"); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Failed")); diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java index e5396d35c..bb64cec2c 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java @@ -43,25 +43,21 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback { FineLoggerFactory.getLogger().info(successInfo); FineJOptionPane.showMessageDialog(null, successInfo); } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { - int rv = FineJOptionPane.showOptionDialog( + int rv = FineJOptionPane.showConfirmDialog( null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Dependence"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - FineJOptionPane.YES_NO_CANCEL_OPTION, - FineJOptionPane.INFORMATION_MESSAGE, - null, - FineJOptionPane.OPTION_YES_NO_CANCEL, - null + FineJOptionPane.OK_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE ); - if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { - return; - } - List pluginTasks = result.getPreTasks(); - for(PluginTask pluginTask : pluginTasks){ - PluginMarker marker = pluginTask.getMarker(); - PluginOperateUtils.updatePluginOnline(marker, jsCallback); + if (rv == FineJOptionPane.OK_OPTION) { + List pluginTasks = result.getPreTasks(); + for(PluginTask pluginTask : pluginTasks){ + PluginMarker marker = pluginTask.getMarker(); + PluginOperateUtils.updatePluginOnline(marker, jsCallback); + } + PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback)); } - PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback)); } else if(result.errorCode() == PluginErrorCode.NoPluginToUpdate){ int rv = FineJOptionPane.showOptionDialog( null, From ea33914d7adcb4787bc0b0cd790228c5b5e9a85d Mon Sep 17 00:00:00 2001 From: lucian Date: Wed, 27 Jan 2021 18:13:47 +0800 Subject: [PATCH 104/147] =?UTF-8?q?REPORT-47193=20=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=8F=90=E7=A4=BA=E5=BC=B9=E7=AA=97=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exe/callback/InstallFromDiskCallback.java | 28 ++++++++----------- .../exe/callback/UpdateFromDiskCallback.java | 14 ++++------ 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java index dd7f00b48..92fdd4878 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java @@ -44,25 +44,21 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback { FineLoggerFactory.getLogger().info(successInfo); FineJOptionPane.showMessageDialog(null, successInfo); } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { - int rv = FineJOptionPane.showOptionDialog( - null, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Dependence"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - FineJOptionPane.YES_NO_CANCEL_OPTION, - FineJOptionPane.INFORMATION_MESSAGE, + int rv = FineJOptionPane.showConfirmDialog( null, - FineJOptionPane.OPTION_YES_NO_CANCEL, - null + Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Dependence"), + Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + FineJOptionPane.OK_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE ); - if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { - return; - } - List pluginTasks = result.getPreTasks(); - for(PluginTask pluginTask : pluginTasks){ - PluginMarker marker = pluginTask.getMarker(); - PluginOperateUtils.installPluginOnline(marker, jsCallback); + if (rv == FineJOptionPane.OK_OPTION) { + List pluginTasks = result.getPreTasks(); + for(PluginTask pluginTask : pluginTasks){ + PluginMarker marker = pluginTask.getMarker(); + PluginOperateUtils.installPluginOnline(marker, jsCallback); + } + PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback)); } - PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback)); } else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){ int rv = FineJOptionPane.showConfirmDialog( null, diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java index bb64cec2c..21c7871f5 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java @@ -59,20 +59,16 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback { PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback)); } } else if(result.errorCode() == PluginErrorCode.NoPluginToUpdate){ - int rv = FineJOptionPane.showOptionDialog( + int rv = FineJOptionPane.showConfirmDialog( null, Toolkit.i18nText("Fine-Design_Basic_Plugin_No_Plugin_Update"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - FineJOptionPane.YES_NO_CANCEL_OPTION, - FineJOptionPane.INFORMATION_MESSAGE, - null, - FineJOptionPane.OPTION_YES_NO_CANCEL, - null + FineJOptionPane.OK_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE ); - if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { - return; + if (rv == FineJOptionPane.OK_OPTION) { + PluginOperateUtils.installPluginFromDisk(zipFile, jsCallback); } - PluginOperateUtils.installPluginFromDisk(zipFile, jsCallback); }else { jsCallback.execute("failed"); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed")); From 19767ee33b43f500e31a1d5e226f567746690fca Mon Sep 17 00:00:00 2001 From: pengda Date: Thu, 28 Jan 2021 11:26:01 +0800 Subject: [PATCH 105/147] =?UTF-8?q?REPORT-47606=20=E8=81=9A=E5=90=88?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E6=8B=96=E6=8B=BD=E6=97=B6=E5=81=9C=E6=AD=A2?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=BC=9A=E5=9B=9E=E9=80=80=E5=88=B0=E5=8E=9F?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/poly/PolyBlockProperPane.java | 2 +- .../com/fr/poly/PolyBlockProperTable.java | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/poly/PolyBlockProperPane.java b/designer-realize/src/main/java/com/fr/poly/PolyBlockProperPane.java index 316e86c28..24a9272ab 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyBlockProperPane.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyBlockProperPane.java @@ -41,7 +41,7 @@ public class PolyBlockProperPane extends DockingView { } public void update(){ - polyBlockProperTable.update(); + polyBlockProperTable.setBlockName(this.designer.getEditingTarget()); } @Override diff --git a/designer-realize/src/main/java/com/fr/poly/PolyBlockProperTable.java b/designer-realize/src/main/java/com/fr/poly/PolyBlockProperTable.java index cd98e6622..fa786dc1e 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyBlockProperTable.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyBlockProperTable.java @@ -111,12 +111,7 @@ public class PolyBlockProperTable extends JPanel { if (isPopulating || block == null) { return; } - if (blockPropertyPane.getWidgetNameField() != null) { - String toSetWidgetName = blockPropertyPane.getWidgetNameField().getText(); - if (isBlockNameValid(toSetWidgetName, block.getBlockName())) { - block.setBlockName(toSetWidgetName); - } - } + setBlockName(block); PolyBoundsGroup boundsgroup = new PolyBoundsGroup(block, designer.getTarget()); boundsgroup.setValue(x.getValue(), 0, 1); boundsgroup.setValue(y.getValue(), 1, 1); @@ -125,6 +120,18 @@ public class PolyBlockProperTable extends JPanel { firePropertyEdit(); } + public void setBlockName(TemplateBlock block){ + if (isPopulating || block == null || blockPropertyPane == null) { + return; + } + if (blockPropertyPane.getWidgetNameField() != null) { + String toSetWidgetName = blockPropertyPane.getWidgetNameField().getText(); + if (isBlockNameValid(toSetWidgetName, block.getBlockName())) { + block.setBlockName(toSetWidgetName); + } + } + } + /** *校验一下要设置的名称,不能为空,不能重名 * From 001e68b41c1b5e03ad1ddfdef85dba23510ade02 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 28 Jan 2021 16:44:10 +0800 Subject: [PATCH 106/147] =?UTF-8?q?REPORT-47632=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E9=94=81=E5=AE=9A-=E4=BB=8E=E8=BF=9C=E7=A8=8B=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=88=B0=E6=9C=AC=E5=9C=B0=E5=90=8E=EF=BC=8C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E7=AA=97=E5=8F=A3=E7=9A=84=E9=94=81=E5=AE=9A?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E4=B8=8D=E6=B6=88=E5=A4=B1=20=E3=80=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91=E4=B8=8D=E5=AE=8C=E5=96=84=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=A4=84=E4=BA=8E=E8=BF=9C=E7=A8=8B=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=8B=E6=98=AF=E9=94=81=E5=AE=9A=E7=9A=84=EF=BC=8C?= =?UTF-8?q?isLock=E5=8F=98=E9=87=8F=E4=B8=BAtrue=EF=BC=8C=E7=84=B6?= =?UTF-8?q?=E5=90=8E=E5=88=87=E5=9B=9E=E6=9C=AC=E5=9C=B0=E4=BA=86=EF=BC=8C?= =?UTF-8?q?=E8=BF=99=E4=B8=AA=E5=8F=98=E9=87=8F=E6=B2=A1=E6=9C=89=E8=A2=AB?= =?UTF-8?q?=E7=BD=AE=E4=B8=BAfalse=EF=BC=8C=E4=BC=9A=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E7=AA=97=E5=8F=A3=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E4=B8=80=E7=9B=B4=E4=B8=BA=E9=94=81=E5=AE=9A=E7=8A=B6=E6=80=81?= =?UTF-8?q?=20=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91?= =?UTF-8?q?=E5=8A=A0=E4=B8=AA=E5=88=A4=E6=96=AD=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E4=B8=8D=E6=98=AF=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=94isLock=E4=B8=BAtrue=EF=BC=8C=E5=B0=86?= =?UTF-8?q?=E5=85=B6=E7=BD=AE=E4=B8=BAfalse=EF=BC=8C=E5=86=8D=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E8=A7=82=E5=AF=9F=E8=80=85=E4=BB=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/editlock/EditLockChangeChecker.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java index 8f276dfe8..d45c4c181 100644 --- a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java @@ -40,13 +40,17 @@ public abstract class EditLockChangeChecker { try { EditLockOperator operator = WorkContext.getCurrent().get(EditLockOperator.class); boolean locked = operator.isLocked(lockItem); - if (isLocked != locked) { - isLocked = locked; + if (isLocked() != locked) { + setLocked(locked); fireChange(); } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } + } else if (isLocked()){ + // 如果不是远程环境,且此前的远程状态下为锁定的话,切换回来后需要将其修改为不锁定 + setLocked(false); + fireChange(); } } }, 0, INTERVAL, TimeUnit.MILLISECONDS); @@ -65,9 +69,17 @@ public abstract class EditLockChangeChecker { @Override public void run() { for (EditLockChangeListener listener : EditLockChangeChecker.this.listeners) { - listener.updateLockedState(new EditLockChangeEvent(isLocked)); + listener.updateLockedState(new EditLockChangeEvent(isLocked())); } } }); } + + public boolean isLocked() { + return this.isLocked; + } + + public void setLocked(boolean locked) { + this.isLocked = locked; + } } From fc7396c62efe2a930a4415f1dd05e8ea0902cb5c Mon Sep 17 00:00:00 2001 From: loy Date: Tue, 19 Jan 2021 09:52:30 +0800 Subject: [PATCH 107/147] =?UTF-8?q?REPORT-46916=20=E6=96=B0=E5=BC=95?= =?UTF-8?q?=E6=93=8E=E5=86=85=E7=BD=AE=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 + .../java/com/fr/plugin/designer/CptxApp.java | 59 +++++ .../designer/EnginexSupportedFileUIImpl.java | 51 ++++ .../com/fr/plugin/designer/JStreamBook.java | 109 +++++++++ .../com/fr/plugin/designer/StartupAssist.java | 95 ++++++++ .../com/fr/plugin/designer/WritableCptx.java | 29 +++ .../designer/cell/CellTreeAttrPanel.java | 109 +++++++++ .../cell/CellTreeAttrPanelProvider.java | 30 +++ .../designer/clean/CompileCleanManager.java | 133 +++++++++++ .../cptx/io/DesignReadWritableProvider.java | 61 +++++ .../designer/menu/BatchCompileAction.java | 47 ++++ .../designer/menu/BatchCompileMenu.java | 36 +++ .../designer/menu/CalculateAttrAction.java | 76 ++++++ .../designer/menu/CalculateAttrMenu.java | 69 ++++++ .../designer/menu/CalculateAttrPane.java | 200 ++++++++++++++++ .../designer/menu/FeatureFlagsPanel.java | 73 ++++++ .../designer/menu/LocalAnalyzerAction.java | 49 ++++ .../designer/menu/LocalAnalyzerMenu.java | 37 +++ .../designer/menu/bean/FeatureFlagBean.java | 36 +++ .../monitor/DesignerMetricRecorder.java | 176 ++++++++++++++ .../designer/toolbar/CompileAction.java | 116 +++++++++ .../designer/toolbar/TemplateTransformer.java | 221 +++++++++++++++++ .../toolbar/TemplateTransformerUIButton.java | 20 ++ .../designer/toolbar/TransformResult.java | 55 +++++ .../designer/toolbar/TransformResultInfo.java | 64 +++++ .../transform/BatchTransformProgress.java | 25 ++ .../transform/BatchTransformUtil.java | 25 ++ .../designer/transform/BatchTransformer.java | 71 ++++++ .../designer/transform/UpdateCallBack.java | 22 ++ .../transform/ui/BatchTransformDialog.java | 61 +++++ .../transform/ui/BatchTransformPane.java | 223 ++++++++++++++++++ .../ui/PrepareTransformFileList.java | 79 +++++++ .../transform/ui/TransformFileTree.java | 204 ++++++++++++++++ .../transform/ui/TransformPreparePane.java | 130 ++++++++++ .../transform/ui/TransformResultList.java | 70 ++++++ .../transform/ui/TransformResultPane.java | 110 +++++++++ .../ui/UIListControlCellRenderer.java | 86 +++++++ .../transform/ui/UpdateProgressDialog.java | 70 ++++++ .../transform/ui/UpdateProgressPane.java | 72 ++++++ .../designer/utils/CompileTransformUtil.java | 55 +++++ .../designer/utils/DesignerCptxFileUtils.java | 79 +++++++ .../com/fr/plugin/designer/CptxAppTest.java | 55 +++++ .../EnginexSupportedFileUIImplTest.java | 26 ++ .../fr/plugin/designer/JStreamBookTest.java | 121 ++++++++++ .../clean/CompileCleanManagerTest.java | 41 ++++ .../designer/menu/BatchCompileMenuTest.java | 16 ++ .../toolbar/TemplateTransformerTest.java | 85 +++++++ .../toolbar/TransformResultInfoTest.java | 32 +++ .../transform/BatchTransformProgressTest.java | 27 +++ .../transform/BatchTransformUtilTest.java | 35 +++ .../transform/BatchTransformerTest.java | 124 ++++++++++ .../utils/CompileTransformUtilTest.java | 58 +++++ 52 files changed, 3954 insertions(+) create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/CptxApp.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/EnginexSupportedFileUIImpl.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/JStreamBook.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/StartupAssist.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/WritableCptx.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/clean/CompileCleanManager.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileAction.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileMenu.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrAction.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrMenu.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrPane.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/menu/FeatureFlagsPanel.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerAction.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerMenu.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/menu/bean/FeatureFlagBean.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformerUIButton.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java create mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/CptxAppTest.java create mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/EnginexSupportedFileUIImplTest.java create mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/JStreamBookTest.java create mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java create mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/menu/BatchCompileMenuTest.java create mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java create mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java create mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java create mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java create mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java create mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java diff --git a/build.gradle b/build.gradle index 617b9d0fa..8399410db 100644 --- a/build.gradle +++ b/build.gradle @@ -73,6 +73,7 @@ allprojects { implementation 'com.fr.decision:fine-decision:' + frVersion implementation 'com.fr.schedule:fine-schedule:' + frVersion implementation 'com.fr.report:engine-report:' + frDevVersion + implementation 'com.fr.report:engine-x:' + frDevVersion implementation 'com.fr.report:engine-chart:' + frDevVersion implementation 'com.fr.report:engine-i18n:' + frDevVersion implementation 'com.fr.design:design-i18n:' + frDevVersion diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/CptxApp.java b/designer-realize/src/main/java/com/fr/plugin/designer/CptxApp.java new file mode 100644 index 000000000..cdad02a78 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/CptxApp.java @@ -0,0 +1,59 @@ +package com.fr.plugin.designer; + +import com.fr.base.extension.FileExtension; +import com.fr.design.mainframe.AbstractAppProvider; +import com.fr.design.mainframe.JTemplate; +import com.fr.file.FILE; +import com.fr.main.impl.WorkBook; +import com.fr.plugin.designer.utils.DesignerCptxFileUtils; + +/** + * 支持设计器打开cptx文件 + */ +public class CptxApp extends AbstractAppProvider { + + static { + // 保证设计器默认 cptx 启动正常 + StartupAssist.init(); + } + + + public CptxApp() { + StartupAssist.initDesignModule(); + } + + @Override + public String[] defaultExtensions() { + return new String[]{FileExtension.CPTX.getExtension()}; + } + + @Override + public void process() { + super.process(); + StartupAssist.reloadTemplate(); + } + + /** + * 该方法只是为了读到cptx中的cpt + * + * @param tplFile file + * @return template + */ + @Override + public JTemplate openTemplate(FILE tplFile) { + WorkBook workBook = DesignerCptxFileUtils.getWorkBook(tplFile); + if (workBook == null) { + workBook = new WorkBook(); + } + return new JStreamBook(workBook, tplFile); + } + + @Override + public WorkBook asIOFile(FILE file) { + WorkBook workBook = DesignerCptxFileUtils.getWorkBook(file); + if (workBook == null) { + workBook = new WorkBook(); + } + return workBook; + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/EnginexSupportedFileUIImpl.java b/designer-realize/src/main/java/com/fr/plugin/designer/EnginexSupportedFileUIImpl.java new file mode 100644 index 000000000..ae9ec9796 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/EnginexSupportedFileUIImpl.java @@ -0,0 +1,51 @@ +package com.fr.plugin.designer; + +import com.fr.base.BaseUtils; +import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; +import com.fr.design.fun.impl.AbstractReportSupportedFileUIProvider; +import com.fr.design.mainframe.JTemplate; +import com.fr.file.FILEChooserPane; +import com.fr.file.filter.ChooseFileFilter; +import com.fr.plugin.designer.toolbar.TemplateTransformer; +import com.fr.stable.ProductConstants; + +import javax.swing.Icon; + + +/** + * Created by kerry on 2019-10-14 + */ +public class EnginexSupportedFileUIImpl extends AbstractReportSupportedFileUIProvider { + public static final Icon CPTX_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/cptx_file_icon.png"); + public static final Icon CPTX_LOCKED_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/cptx_file_icon_locked.png"); + + @Override + public void addChooseFileFilter(FILEChooserPane fileChooser, String suffix) { + String filterDescription = ProductConstants.APP_NAME + Toolkit.i18nText("Fine-Design_Report_Template_File"); + ChooseFileFilter cptxChooserFilter = new ChooseFileFilter(FileExtension.CPTX, filterDescription); + fileChooser.addChooseFILEFilter(cptxChooserFilter); + } + + @Override + public Icon getFileIcon(String path, boolean isShowLock) { + if (!FileExtension.CPTX.matchExtension(path)) { + return null; + } + if (isShowLock) { + return CPTX_LOCKED_ICON; + } + return CPTX_ICON; + } + + + @Override + public boolean saveToNewFile(String targetPath, JTemplate jTemplate) { + if (FileExtension.CPTX.matchExtension(targetPath)) { + TemplateTransformer.TO_CPTX.transform(jTemplate); + return true; + } + return false; + } + +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/JStreamBook.java b/designer-realize/src/main/java/com/fr/plugin/designer/JStreamBook.java new file mode 100644 index 000000000..d52568541 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/JStreamBook.java @@ -0,0 +1,109 @@ +package com.fr.plugin.designer; + +import com.fr.base.extension.FileExtension; +import com.fr.design.actions.file.export.CSVExportAction; +import com.fr.design.actions.file.export.PDFExportAction; +import com.fr.design.actions.file.export.SVGExportAction; +import com.fr.design.actions.file.export.TextExportAction; +import com.fr.design.actions.file.export.WordExportAction; +import com.fr.design.mainframe.JWorkBook; +import com.fr.design.menu.MenuDef; +import com.fr.file.FILE; +import com.fr.general.ComparatorUtils; +import com.fr.locale.InterProviderFactory; +import com.fr.log.FineLoggerFactory; +import com.fr.main.impl.WorkBook; +import com.fr.nx.cptx.entry.metadata.CptxMetadata; +import com.fr.plugin.designer.toolbar.TemplateTransformer; +import com.fr.plugin.designer.toolbar.TransformResult; +import com.fr.plugin.designer.toolbar.TransformResultInfo; +import com.fr.plugin.designer.utils.DesignerCptxFileUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; + +public class JStreamBook extends JWorkBook { + + + public JStreamBook(WorkBook workBook, FILE file) { + super(workBook, file); + } + + @Override + protected boolean saveFile() { + boolean saved; + TransformResultInfo resultInfo = TemplateTransformer.compileCPTX(getTarget(), getEditingFILE()); + saved = resultInfo.isSaved(); + this.setSaved(saved); + if (saved) { + this.fireJTemplateSaved(); + } + return saved; + } + + @Override + protected boolean saveToNewFile(String oldName) { + String path = this.getEditingFILE().getPath(); + try { + if (!path.startsWith(ProjectConstants.REPORTLETS_NAME)) { + File file = new File(path); + if (file.getParentFile() != null && !file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + file.createNewFile(); + OutputStream outputStream = new FileOutputStream(file); + this.getTarget().export(outputStream); + return true; + }else { + TransformResult result; + if (FileExtension.CPT.matchExtension(path)) { + result = TemplateTransformer.TO_CPT.transform(this); + } else { + result = TemplateTransformer.TO_CPTX.transform(this); + } + return ComparatorUtils.equals(TransformResult.SUCCESS, result); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return false; + } + + + /** + * 保存文件的后缀名 + * + * @return 后缀的字符串 + */ + @Override + public String suffix() { + return ".cptx"; + } + + @Override + protected void addShortCut(MenuDef exportMenuDef, MenuDef excelExportMenuDef) { + exportMenuDef.addShortCut(excelExportMenuDef, new PDFExportAction(this), new WordExportAction(this), new SVGExportAction(this), + new CSVExportAction(this), new TextExportAction(this)); + } + + + @Override + public String getPath() { + return getEditingFILE().getPath() + getSuffix(); + } + + public String getTemplateName() { + return getEditingFILE().getName() + getSuffix(); + } + + private String getSuffix() { + CptxMetadata metadata = DesignerCptxFileUtils.getMetadata(this.getEditingFILE()); + if (metadata != null && metadata.isForceCpt()) { + return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Compatibility_Mode"); + } + return StringUtils.EMPTY; + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/StartupAssist.java b/designer-realize/src/main/java/com/fr/plugin/designer/StartupAssist.java new file mode 100644 index 000000000..5f2795244 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/StartupAssist.java @@ -0,0 +1,95 @@ +package com.fr.plugin.designer; + +import com.fr.base.Parameter; +import com.fr.base.extension.FileExtension; +import com.fr.common.annotations.Negative; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.JTemplateFactory; +import com.fr.design.module.DesignModuleFactory; +import com.fr.design.parameter.AbstractParameterReader; +import com.fr.design.ui.util.UIUtil; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; +import com.fr.log.FineLoggerFactory; +import com.fr.main.impl.WorkBook; +import com.fr.nx.cptx.CptxIOManager; +import com.fr.nx.cptx.io.handle.CptxTemplateHandle; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.observer.PluginEventType; + +/** + * 保证设计器默认 cptx 启动正常 + * + * @author yaohwu + * created by yaohwu at 2020/6/5 16:28 + */ +public class StartupAssist { + + public static void init() { + listenInitDesignModule(); + } + + + public static void initDesignModule() { + DesignModuleFactory.registerParameterReader(new AbstractParameterReader() { + @Override + public Parameter[] readParameterFromPath(String tplPath) { + if (accept(tplPath, FileExtension.CPTX.getSuffix())) { + try { + CptxTemplateHandle handle = CptxIOManager.open(tplPath); + WorkBook book = handle.getTemplate().getLegacyWorkBook(); + return book.getParameters(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return new Parameter[0]; + } + } + return null; + } + }); + } + + private static void reload() { + JTemplate old = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + JTemplate template = JTemplateFactory.createJTemplate(old.getEditingFILE()); + DesignerContext.getDesignerFrame().addAndActivateJTemplate(template); + HistoryTemplateListCache.getInstance().setCurrentEditingTemplate(template); + } + + /** + * 主代码修复后就可以删除了 + * + * 主代码任务链接 + */ + @Negative(until = "2021-09-01") + public static void reloadTemplate() { + if (isCptxJTemplate()) { + UIUtil.invokeLaterIfNeeded(() -> { + reload(); + DesignerContext.getDesignerFrame().setVisible(true); + DesignerContext.getDesignerFrame().resizeFrame(); + }); + } + } + + private static boolean isCptxJTemplate() { + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + String path; + return jTemplate != null && + (path = jTemplate.getPath()) != null + && path.endsWith(FileExtension.CPTX.getExtension()); + } + + private static void listenInitDesignModule() { + EventDispatcher.listen(PluginEventType.AfterRun, new Listener() { + @SuppressWarnings("rawtypes") + @Override + public void on(Event event, PluginContext param) { + initDesignModule(); + } + }); + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/WritableCptx.java b/designer-realize/src/main/java/com/fr/plugin/designer/WritableCptx.java new file mode 100644 index 000000000..db2249915 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/WritableCptx.java @@ -0,0 +1,29 @@ +package com.fr.plugin.designer; + +import com.fr.file.FILE; +import com.fr.nx.cptx.io.handle.impl.AbstractCptxIOProvider; + +import java.io.InputStream; +import java.io.OutputStream; + +/** + * 读写型模板, 用于设计器端增删改模板 + */ +public class WritableCptx extends AbstractCptxIOProvider { + + private FILE file; + + public WritableCptx(FILE file) { + this.file = file; + } + + @Override + public InputStream open() throws Exception { + return file.asInputStream(); + } + + @Override + public OutputStream createTemp() throws Exception { + return file.asOutputStream(); + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java b/designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java new file mode 100644 index 000000000..f6f884306 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java @@ -0,0 +1,109 @@ +package com.fr.plugin.designer.cell; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.event.UIObserverListener; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.MultilineLabel; +import com.fr.design.mainframe.CellWidgetPropertyPane; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.mainframe.JTemplate; +import com.fr.form.ui.Widget; +import com.fr.locale.InterProviderFactory; +import com.fr.report.cell.TemplateCellElement; +import com.fr.report.web.button.form.TreeNodeToggleButton; + +import java.awt.BorderLayout; +import java.awt.Color; + +/** + * @author yaohwu + * created by yaohwu at 2020/4/26 16:33 + */ +public class CellTreeAttrPanel extends BasicBeanPane { + private static final Color TIP_COLOR = new Color(0x8f8f92); + + private TemplateCellElement cellElement = null; + + private final UICheckBox showAsTreeNodeCheckBox; + + private final UIObserverListener listener = new UIObserverListener() { + @Override + public void doChange() { + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (template != null) { + if (CellTreeAttrPanel.this.cellElement != null) { + CellTreeAttrPanel.this.updateBean(); + } + template.fireTargetModified(); + CellWidgetPropertyPane.getInstance().populate((ElementCasePane) template.getCurrentElementCasePane()); + } + } + }; + + private static final class Holder { + private static final CellTreeAttrPanel INSTANCE = new CellTreeAttrPanel(); + } + + public static CellTreeAttrPanel getInstance() { + return Holder.INSTANCE; + } + + private CellTreeAttrPanel() { + this.setLayout(new BorderLayout()); + showAsTreeNodeCheckBox = + new UICheckBox(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Cell_Show_As_Tree_Node")); + this.add(showAsTreeNodeCheckBox, BorderLayout.NORTH); + MultilineLabel multilineLabel = + new MultilineLabel(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Cell_Show_As_Tree_Node_TIP")); + multilineLabel.setForeground(TIP_COLOR); + this.add(multilineLabel, BorderLayout.CENTER); + } + + /** + * 展示数据 + * + * @param ob 待展示的对象 + */ + @Override + public void populateBean(TemplateCellElement ob) { + this.cellElement = ob; + Widget widget = cellElement.getWidget(); + showAsTreeNodeCheckBox.registerChangeListener(null); + showAsTreeNodeCheckBox.setSelected(widget instanceof TreeNodeToggleButton); + showAsTreeNodeCheckBox.registerChangeListener(listener); + } + + /** + * 保存数据 + * + * @return 待保存的对象 + */ + @Override + public TemplateCellElement updateBean() { + if (this.cellElement == null) { + return null; + } + if (showAsTreeNodeCheckBox.isSelected()) { + cellElement.setWidget(createTreeToggleButton()); + } else { + cellElement.setWidget(null); + } + return this.cellElement; + } + + @Override + public void updateBean(TemplateCellElement ob) { + this.cellElement = ob; + updateBean(); + } + + @Override + protected String title4PopupWindow() { + return ""; + } + + private TreeNodeToggleButton createTreeToggleButton() { + return new TreeNodeToggleButton(); + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java b/designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java new file mode 100644 index 000000000..ec4639a8f --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java @@ -0,0 +1,30 @@ +package com.fr.plugin.designer.cell; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.fun.impl.AbstractCellExpandAttrPanelProvider; +import com.fr.design.mainframe.JTemplate; +import com.fr.plugin.designer.JStreamBook; +import com.fr.report.cell.TemplateCellElement; + +/** + * @author yaohwu + * created by yaohwu at 2020/4/26 16:32 + */ +public class CellTreeAttrPanelProvider extends AbstractCellExpandAttrPanelProvider { + + @Override + public BasicBeanPane createPanel() { + return CellTreeAttrPanel.getInstance(); + } + + /** + * 只有新引擎 cptx 模版才展示 + * 先注释掉Override,适配老的主jar,保留这个方法是为了在新主jar下支持这个功能 + */ + // @Override + public boolean isDisplayable() { + JTemplate current = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + return current instanceof JStreamBook; + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/clean/CompileCleanManager.java b/designer-realize/src/main/java/com/fr/plugin/designer/clean/CompileCleanManager.java new file mode 100644 index 000000000..abda1f5cf --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/clean/CompileCleanManager.java @@ -0,0 +1,133 @@ +package com.fr.plugin.designer.clean; + +import com.fr.base.extension.FileExtension; +import com.fr.config.ConfigContext; +import com.fr.config.DefaultConfiguration; +import com.fr.config.holder.factory.Holders; +import com.fr.config.holder.impl.MapConf; +import com.fr.general.CommonDateUtils; +import com.fr.nx.cptx.marshal.util.CptxMarshalUtil; +import com.fr.stable.StableUtils; +import com.fr.stable.project.ProjectConstants; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerAdaptor; +import com.fr.workspace.WorkContext; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + * @author: Maksim + * @Date: Created in 2020/4/23 + * @Description: + */ +public class CompileCleanManager extends DefaultConfiguration { + + private static volatile CompileCleanManager INSTANCE; + private MapConf> mapConf = Holders.map(new HashMap(), String.class, String.class); + + private CompileCleanManager() { + } + + @Override + public String getNameSpace() { + return "CompileCleanManager"; + } + + public static CompileCleanManager getInstance() { + if (INSTANCE == null) { + synchronized (CompileCleanManager.class) { + if (INSTANCE == null) { + INSTANCE = ConfigContext.getConfigInstance(CompileCleanManager.class); + } + } + } + return INSTANCE; + } + + /** + * 增加预览记录 + * + * @param bookPath + */ + public void addRecord(String bookPath) { + String lastPreviewTime = CommonDateUtils.getDate2Str("yyyy-MM-dd", new Date()); + addRecord(bookPath, lastPreviewTime); + } + + public void addRecord(final String bookPath, final String lastPreviewTime) { + Configurations.update(new WorkerAdaptor(CompileCleanManager.class) { + @Override + public void run() { + mapConf.put(bookPath, lastPreviewTime); + } + }); + } + + /** + * 删除预览记录 + * + * @param bookPath + */ + public void deleteRecord(String bookPath) { + this.mapConf.remove(bookPath); + } + + /** + * 获取预览记录 + * + * @return + */ + public Map getRecords() { + return mapConf.get(); + } + + /** + * 执行清理 + */ + public void clear() { + Map cleanMap = getRecords(); + for (Iterator> iterator = cleanMap.entrySet().iterator(); iterator.hasNext(); ) { + Map.Entry item = iterator.next(); + String bookPath = item.getKey(); + String lastPreviewTime = item.getValue(); + if (needClean(lastPreviewTime)) { + String compilePath = getCompilePath(bookPath); + WorkContext.getWorkResource().delete(compilePath); + deleteRecord(bookPath); + } + } + + } + + private String getCompilePath(String bookPath) { + if (bookPath.endsWith(FileExtension.CPTX.getSuffix())) { + bookPath = bookPath.substring(0, bookPath.length() - FileExtension.CPTX.getSuffix().length()); + } + return StableUtils.pathJoin(ProjectConstants.ASSETS_NAME, CptxMarshalUtil.COMPILE_PATH, bookPath); + } + + /** + * 根据时间判断是否需要清理 + * + * @param lastPreviewTime + * @return + */ + private boolean needClean(String lastPreviewTime) { + Date previewTime = CommonDateUtils.transDate(lastPreviewTime, false); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(previewTime); + calendar.add(Calendar.MONTH, 1); + return new Date().after(calendar.getTime()); + } + + @Override + public Object clone() throws CloneNotSupportedException { + CompileCleanManager manager = (CompileCleanManager) super.clone(); + manager.mapConf = (MapConf>) this.mapConf.clone(); + return manager; + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java b/designer-realize/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java new file mode 100644 index 000000000..60bcab26f --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java @@ -0,0 +1,61 @@ +package com.fr.plugin.designer.cptx.io; + +import com.fr.common.annotations.Negative; +import com.fr.file.FILE; +import com.fr.nx.cptx.io.handle.impl.AbstractCptxIOProvider; +import com.fr.nx.cptx.pack.util.CompiledReportInputStream; +import com.fr.nx.cptx.pack.util.CompiledReportOutputStream; +import com.fr.nx.cptx.utils.CptxFileUtils; +import com.fr.plugin.designer.utils.DesignerCptxFileUtils; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * 用于设计器保存编译后的结果并缓存可web预览模版 + * 没有可观的内存实现,内存实现方式复杂,赶发布,先提供简单的内存实现方式 + * + * @author: Maksim + * @Date: Created in 2020/4/10 + * @Description: 用于cptx写操作的Provider + */ +@Negative(until = "2020-05-10") +public class DesignReadWritableProvider extends AbstractCptxIOProvider { + /** + * 原文件 + */ + private final FILE file; + /** + * 编译文件夹 + */ + private final String compileDir; + + private CompiledReportOutputStream outputStream; + + public DesignReadWritableProvider(FILE file) { + this.file = file; + this.compileDir = DesignerCptxFileUtils.generateCompileDir(file); + } + + @Override + public InputStream open() throws Exception { + if (outputStream == null) { + throw new IOException("can not read cptx template before compile"); + } + return new CompiledReportInputStream(outputStream.toByteArray()); + } + + /** + * 对于写操作,用到的只有这个方法,以流形式来操作 + * + * @return 保存的目标输出流 + * @throws Exception e + */ + @Override + public OutputStream createTemp() throws Exception { + outputStream = new CompiledReportOutputStream(file.asOutputStream(), compileDir); + return outputStream; + } + +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileAction.java b/designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileAction.java new file mode 100644 index 000000000..848809089 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileAction.java @@ -0,0 +1,47 @@ +package com.fr.plugin.designer.menu; + +import com.fr.base.BaseUtils; +import com.fr.design.actions.UpdateAction; +import com.fr.design.menu.MenuKeySet; +import com.fr.locale.InterProviderFactory; +import com.fr.plugin.designer.transform.ui.BatchTransformPane; + +import javax.swing.KeyStroke; +import java.awt.Dialog; +import java.awt.event.ActionEvent; + +/** + * Created by kerry on 2019-12-10 + */ +public class BatchCompileAction extends UpdateAction { + public BatchCompileAction() { + this.setMenuKeySet(COMPILE); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/plugin/designer/transform/batch_transform.png")); + } + + @Override + public void actionPerformed(ActionEvent e) { + BatchTransformPane batchTransformPane = new BatchTransformPane(); + Dialog dialog = batchTransformPane.showDialog(); + dialog.setVisible(true); + } + + private static final MenuKeySet COMPILE = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'C'; + } + + @Override + public String getMenuName() { + return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Batch_Transform"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileMenu.java b/designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileMenu.java new file mode 100644 index 000000000..6625d247c --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileMenu.java @@ -0,0 +1,36 @@ +package com.fr.plugin.designer.menu; + +import com.fr.design.fun.impl.AbstractMenuHandler; +import com.fr.design.menu.ShortCut; + +/** + * Created by kerry on 2019-12-10 + */ +public class BatchCompileMenu extends AbstractMenuHandler { + private static final int DEFAULT_INSERT_POSITION = 9; + + @Override + public int insertPosition(int total) { + return DEFAULT_INSERT_POSITION; + } + + @Override + public boolean insertSeparatorBefore() { + return false; + } + + @Override + public boolean insertSeparatorAfter() { + return false; + } + + @Override + public String category() { + return FILE; + } + + @Override + public ShortCut shortcut() { + return new BatchCompileAction(); + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrAction.java b/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrAction.java new file mode 100644 index 000000000..37667220d --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrAction.java @@ -0,0 +1,76 @@ +package com.fr.plugin.designer.menu; + +import com.fr.base.BaseUtils; +import com.fr.design.actions.JTemplateAction; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.UIDialog; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.menu.MenuKeySet; +import com.fr.locale.InterProviderFactory; +import com.fr.main.impl.WorkBook; +import com.fr.plugin.attr.CalculatorAttrMark; +import com.fr.plugin.designer.JStreamBook; + +import javax.swing.KeyStroke; +import java.awt.event.ActionEvent; + +public class CalculateAttrAction extends JTemplateAction { + + public CalculateAttrAction(JStreamBook jTemplate) { + super(jTemplate); + initMenuStyle(); + } + + private void initMenuStyle() { + this.setMenuKeySet(CALCULATE_FIT_ATTR); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/center.png")); + } + + /** + * Action触发事件 + * + * @param e 事件 + */ + public void actionPerformed(ActionEvent e) { + final JStreamBook jwb = getEditingComponent(); + if (jwb == null) { + return; + } + WorkBook workBook = jwb.getTarget(); + CalculatorAttrMark mark = workBook.getAttrMark(CalculatorAttrMark.MARK); + CalculateAttrPane attrPane = new CalculateAttrPane(); + showReportFitDialog(mark, jwb, workBook, attrPane); + } + + private void showReportFitDialog(CalculatorAttrMark mark, final JStreamBook jwb, final WorkBook workBook, final BasicBeanPane attrPane) { + attrPane.populateBean(mark); + UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + workBook.addAttrMark(attrPane.updateBean()); + jwb.fireTargetModified(); + } + }); + dialog.setVisible(true); + } + + private static final MenuKeySet CALCULATE_FIT_ATTR = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'C'; + } + + @Override + public String getMenuName() { + return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Attr"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrMenu.java b/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrMenu.java new file mode 100644 index 000000000..06a3f493d --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrMenu.java @@ -0,0 +1,69 @@ +package com.fr.plugin.designer.menu; + +import com.fr.design.fun.impl.AbstractMenuHandler; +import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; +import com.fr.design.menu.ShortCut; +import com.fr.plugin.designer.JStreamBook; + +public class CalculateAttrMenu extends AbstractMenuHandler { + + private static final int DEFAULT_INSERT_POSITION = 7; + + /** + * 插入位置 + * @param total 插入点 + * + * @return 插入位置 + * + */ + public int insertPosition(int total) { + return DEFAULT_INSERT_POSITION; + } + + /** + * 在分隔符前插入 + * + * @return 是否在分隔符前插入 + * + */ + public boolean insertSeparatorBefore() { + return false; + } + + /** + * 在分隔符后插入 + * + * @return 是否在分隔符后插入 + * + */ + public boolean insertSeparatorAfter() { + return false; + } + + /** + * 分类 + * + * @return 菜单分类 + * + */ + public String category() { + return TEMPLATE; + } + + /** + * 获取当前菜单的Action + * + * @param plus 当前操作对象 + * + * @return 菜单Action + * + */ + public ShortCut shortcut(ToolBarMenuDockPlus plus) { + //往ToolBarMenuDockPlus里塞感觉也很糟. + if (!(plus instanceof JStreamBook)){ + return null; + } + + return new CalculateAttrAction((JStreamBook) plus); + } +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrPane.java b/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrPane.java new file mode 100644 index 000000000..2fe5f793f --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrPane.java @@ -0,0 +1,200 @@ +package com.fr.plugin.designer.menu; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.ActionLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.locale.InterProviderFactory; +import com.fr.nx.feature.FeatureFlags; +import com.fr.nx.feature.FeatureManager; +import com.fr.plugin.attr.CalculatorAttrMark; +import com.fr.plugin.designer.menu.bean.FeatureFlagBean; + +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +public class CalculateAttrPane extends BasicBeanPane { + + private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92); + + // private UICheckBox calculateEnd; + private UICheckBox queryCache; + + private UICheckBox treeAsyncQuery; + + private UICheckBox multiSourceMode; + + private UISpinner treeExpandLayer; + + private JPanel treeConfigPanel; + + /** + * 当前模版从未设置过模版计算属性 + */ + private boolean isEmptyAttr = false; + + public CalculateAttrPane() { + initComponents(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + + JPanel featureFlagPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); + ActionLabel featureLabel = new ActionLabel(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Experimental_Feature")); + featureLabel.setFont(new Font(null, Font.PLAIN, 10)); + featureLabel.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JDialog wDialog = createJDialog(); + wDialog.setVisible(true); + } + }); + featureFlagPanel.add(featureLabel); + + JPanel calculateAttrPanel = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); + calculateAttrPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0)); + +// JPanel calculatedEndPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); +// calculateEnd = new UICheckBox(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Calculate-End")); +// calculatedEndPanel.add(calculateEnd); + JPanel queryCachePanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + queryCache = new UICheckBox(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Calculate_Query_Cache")); + queryCachePanel.add(queryCache); + JPanel multiSourcePanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + multiSourceMode = new UICheckBox(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Feature_Multi_Source")); + multiSourcePanel.add(multiSourceMode); + +// calculateAttrPanel.add(calculatedEndPanel); + calculateAttrPanel.add(queryCachePanel); + calculateAttrPanel.add(multiSourcePanel); + + + treeConfigPanel = FRGUIPaneFactory.createTitledBorderPane( + InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Tree_Config") + ); + treeConfigPanel.setVisible(FeatureManager.getInstance().isFlagEnable(FeatureFlags.TREE)); + treeConfigPanel.setLayout(new BoxLayout(treeConfigPanel, BoxLayout.Y_AXIS)); + + JPanel treeAsyncQueryPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + treeAsyncQuery = new UICheckBox(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Tree_Async_Query")); + treeAsyncQueryPanel.add(treeAsyncQuery); + + JPanel treeExpandLayerPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + UILabel treeExpandLayerLabel = new UILabel(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Tree_Expand_Layer")); + treeExpandLayer = new UISpinner(1, Integer.MAX_VALUE, 1, 1); + // 功能不支持,设置先禁用 + treeExpandLayer.setEnabled(false); + + treeExpandLayerPanel.add(treeExpandLayerLabel); + treeExpandLayerPanel.add(treeExpandLayer); + + JPanel treeExpandLayerLabelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + UILabel multilineLabel = new UILabel(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Tree_Expand_Layer_Label")); + multilineLabel.setForeground(TIPS_FONT_COLOR); + treeExpandLayerLabelPanel.add(multilineLabel); + + + treeConfigPanel.add(treeAsyncQueryPanel); + treeConfigPanel.add(treeExpandLayerPanel); + treeConfigPanel.add(treeExpandLayerLabelPanel); + + List components = new ArrayList<>(); + components.add(new Component[]{featureFlagPanel}); + components.add(new Component[]{calculateAttrPanel}); + components.add(new Component[]{treeConfigPanel}); + + JPanel content = + TableLayoutHelper.createGapTableLayoutPane( + components.toArray(new Component[0][]), + TableLayoutHelper.FILL_LASTCOLUMN, + 5, + 5 + ); + + this.add(content, BorderLayout.CENTER); + } + + @Override + public void populateBean(CalculatorAttrMark attrMark) { + if (attrMark == null) { + isEmptyAttr = true; + // 默认折叠树配置 + treeAsyncQuery.setSelected(FeatureManager.getInstance().isFlagEnable(FeatureFlags.TREE_ASYNC)); + return; + } +// calculateEnd.setSelected(attrMark.isCalculateEnd()); + queryCache.setSelected(attrMark.isQueryCache()); + treeAsyncQuery.setSelected(attrMark.isTreeAsyncQuery()); + treeExpandLayer.setValue(attrMark.getTreeExpandLayer()); + multiSourceMode.setSelected(attrMark.isUseMultiSourceMode()); + isEmptyAttr = false; + } + + + /** + * 提交数据 + * + * @return 界面上的更新数据 + */ + @Override + public CalculatorAttrMark updateBean() { + return new CalculatorAttrMark(false, queryCache.isSelected()) + .treeAsyncQuery(treeAsyncQuery.isSelected()) + .treeExpandLayer((int) treeExpandLayer.getValue()) + .useMultiSourceMode(multiSourceMode.isSelected()); + } + + /** + * 标题 + * + * @return 标题 + */ + @Override + protected String title4PopupWindow() { + return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Attr"); + } + + private void showFeatureConfigPane() { + treeConfigPanel.setVisible(FeatureManager.getInstance().isFlagEnable(FeatureFlags.TREE)); + } + + private void resetTreeAsyncConfigPane() { + if (isEmptyAttr) { + treeAsyncQuery.setSelected(FeatureManager.getInstance().isFlagEnable(FeatureFlags.TREE_ASYNC)); + } + } + + + private JDialog createJDialog() { + final FeatureFlagsPanel panel = new FeatureFlagsPanel(); + panel.populateBean(new FeatureFlagBean()); + return panel.showSmallWindow(SwingUtilities.getWindowAncestor(CalculateAttrPane.this), new DialogActionAdapter() { + @Override + public void doOk() { + panel.updateBean().saveModification(); + super.doOk(); + CalculateAttrPane.this.resetTreeAsyncConfigPane(); + CalculateAttrPane.this.showFeatureConfigPane(); + CalculateAttrPane.this.revalidate(); + CalculateAttrPane.this.repaint(); + } + }); + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/FeatureFlagsPanel.java b/designer-realize/src/main/java/com/fr/plugin/designer/menu/FeatureFlagsPanel.java new file mode 100644 index 000000000..89aad3306 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/menu/FeatureFlagsPanel.java @@ -0,0 +1,73 @@ +package com.fr.plugin.designer.menu; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.locale.InterProviderFactory; +import com.fr.nx.feature.FeatureFlag; +import com.fr.plugin.designer.menu.bean.FeatureFlagBean; +import com.fr.stable.collections.combination.Pair; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * Created by loy on 2020/4/14. + */ +public class FeatureFlagsPanel extends BasicBeanPane { + + private FeatureFlagBean bean; + private JPanel mainPanel; + + public FeatureFlagsPanel() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + mainPanel = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); + mainPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0)); + JPanel content = + TableLayoutHelper.createGapTableLayoutPane( + new Component[][]{new Component[]{mainPanel}}, + TableLayoutHelper.FILL_LASTCOLUMN, + 5, + 5 + ); + + this.add(content, BorderLayout.CENTER); + } + + @Override + public void populateBean(FeatureFlagBean featureFlagBean) { + this.bean = featureFlagBean; + mainPanel.removeAll(); + for (Pair entry : featureFlagBean.getAllFlags()) { + final FeatureFlag flag = entry.getFirst(); + Boolean selected = entry.getSecond(); + JPanel itemPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + final UICheckBox cb = new UICheckBox(flag.getDisplayName()); + cb.setSelected(selected); + cb.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + bean.modifyFlag(flag, cb.isSelected()); + } + }); + itemPanel.add(cb); + mainPanel.add(itemPanel); + } + } + + @Override + public FeatureFlagBean updateBean() { + return bean; + } + + @Override + protected String title4PopupWindow() { + return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Experimental_Feature"); + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerAction.java b/designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerAction.java new file mode 100644 index 000000000..20881fa09 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerAction.java @@ -0,0 +1,49 @@ +package com.fr.plugin.designer.menu; + +import com.fr.base.BaseUtils; +import com.fr.design.actions.UpdateAction; +import com.fr.design.menu.MenuKeySet; +import com.fr.design.utils.DesignUtils; +import com.fr.locale.InterProviderFactory; +import com.fr.plugin.web.URLConstants; +import com.fr.stable.StableUtils; + +import javax.swing.KeyStroke; +import java.awt.event.ActionEvent; + +/** + * @author Maksim + * Created in 2020/11/5 11:44 上午 + */ +public class LocalAnalyzerAction extends UpdateAction { + + public LocalAnalyzerAction() { + this.setMenuKeySet(ANALYZER); + this.setName(getMenuKeySet().getMenuKeySetName()); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/plugin/designer/transform/analyzer.png")); + } + + @Override + public void actionPerformed(ActionEvent e) { + String path = StableUtils.pathJoin("/url", URLConstants.ANALYZE_VIEW); + DesignUtils.visitEnvServerByParameters(path, new String[]{}, new String[]{}); + } + + private static final MenuKeySet ANALYZER = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'R'; + } + + @Override + public String getMenuName() { + return InterProviderFactory.getProvider().getLocText("Fine-Plugin-Engine_Analyzer_Menu_Name"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerMenu.java b/designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerMenu.java new file mode 100644 index 000000000..8e270010a --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerMenu.java @@ -0,0 +1,37 @@ +package com.fr.plugin.designer.menu; + +import com.fr.design.fun.impl.AbstractMenuHandler; +import com.fr.design.menu.ShortCut; + +/** + * @author Maksim + * Created in 2020/11/5 11:44 上午 + */ +public class LocalAnalyzerMenu extends AbstractMenuHandler { + private static final int DEFAULT_INSERT_POSITION = 13; + + @Override + public int insertPosition(int i) { + return DEFAULT_INSERT_POSITION; + } + + @Override + public boolean insertSeparatorBefore() { + return false; + } + + @Override + public boolean insertSeparatorAfter() { + return false; + } + + @Override + public String category() { + return SERVER; + } + + @Override + public ShortCut shortcut() { + return new LocalAnalyzerAction(); + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/bean/FeatureFlagBean.java b/designer-realize/src/main/java/com/fr/plugin/designer/menu/bean/FeatureFlagBean.java new file mode 100644 index 000000000..a8de87323 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/menu/bean/FeatureFlagBean.java @@ -0,0 +1,36 @@ +package com.fr.plugin.designer.menu.bean; + +import com.fr.nx.feature.FeatureFlag; +import com.fr.nx.feature.FeatureManager; +import com.fr.stable.collections.combination.Pair; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by loy on 2020/4/14. + */ +public class FeatureFlagBean { + + private Map modifyMap = new HashMap<>(); + + public List> getAllFlags() { + List> flagList = new ArrayList<>(); + for (FeatureFlag flag : FeatureManager.getSupportFlags()) { + flagList.add(new Pair<>(flag, FeatureManager.getInstance().isFlagEnable(flag))); + } + return flagList; + } + + public void modifyFlag(FeatureFlag flag, boolean value) { + modifyMap.put(flag, value); + } + + public void saveModification() { + for (Map.Entry entry : modifyMap.entrySet()) { + FeatureManager.getInstance().setFlagEnable(entry.getKey(), entry.getValue()); + } + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java b/designer-realize/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java new file mode 100644 index 000000000..c53fd6bfa --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java @@ -0,0 +1,176 @@ +package com.fr.plugin.designer.monitor; + +import com.fr.design.mainframe.errorinfo.ErrorInfo; +import com.fr.general.ComparatorUtils; +import com.fr.intelli.record.ConsumePoint; +import com.fr.intelli.record.FocusPoint; +import com.fr.intelli.record.MetricRegistry; +import com.fr.intelli.record.Original; +import com.fr.json.JSON; +import com.fr.json.JSONArray; +import com.fr.json.JSONFactory; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.measure.metric.DBMetric; +import com.fr.message.ErrorMessage; +import com.fr.nx.session.SqlRecorder; +import com.fr.plugin.designer.toolbar.TransformResult; +import com.fr.plugin.monitor.MonitorContentUtils; + +import java.util.Date; + +/** + * Created by loy on 2021/1/18. + * + *

设计器埋点记录相关 + */ +public class DesignerMetricRecorder { + + private static final String LOCAL_IPV6_ADDRESS = "0:0:0:0:0:0:0:1"; + private static final String LOCAL_IPV4_ADDRESS = "127.0.0.1"; + private static final String LOCAL_DOMAIN = "localhost"; + + private static final String ATTR_TEMPLATE_ID = "templateid"; + private static final String ATTR_USERNAME = "username"; + private static final String ATTR_UUID = "uuid"; + private static final String ATTR_ACTIVE_KEY = "activekey"; + private static final String ATTR_TEST_LOG = "testlog"; + private static final String ATTR_REPORT_CONTENT = "reportcontent"; + private static final String ATTR_ERROR_STACK = "errorstack"; + private static final String IDENTIFICATION = "view_plus"; + + private static final String LAYER_TREE_EXEC_LAYER = "FR-P1201"; + private static final String TREE_MODE_CONSUME_ID = "FR-F6006"; + + private static final String TYPE_PAGE_PLUS = "page_plus"; + + private DesignerMetricRecorder() { + } + + public static void submitTreeModeFocusPoint(String ip, String username, String bookPath, String webTitle) { + FocusPoint point = FocusPoint.create(TREE_MODE_CONSUME_ID, bookPath, Original.PLUGIN); + point.setTime(new Date()); + point.setTitle(webTitle); + point.setText(bookPath); + point.setIp(parseIpToLocalhost(ip)); + point.setUsername(username); + try { + MetricRegistry.getMetric().submit(point); + } catch (Exception e) { + FineLoggerFactory.getLogger().warn(e.getMessage(), e); + } + } + + public static void submitLayerTreeExecLayerFocusPoint(long start, String ip, String username, String bookPath, String webTitle, + SqlRecorder sqlRecorder) { + long finish = System.currentTimeMillis(); + long consume = finish - start; + ConsumePoint point = ConsumePoint.create(LAYER_TREE_EXEC_LAYER, consume, Original.PLUGIN); + point.setTime(start); + point.setFinish(finish); + point.setTitle(webTitle); + point.setText(bookPath); + point.setType(TYPE_PAGE_PLUS); + point.setIp(parseIpToLocalhost(ip)); + point.setUsername(username); + if (sqlRecorder != null) { + JSONObject body = JSONObject.create(); + JSONArray sql = JSONArray.create(); + for (String s : sqlRecorder.getSqlList()) { + sql.add(MonitorContentUtils.truncate(s, 150)); + } + JSONArray sqlTime = JSONArray.create(); + JSONArray sqlRowCount = JSONArray.create(); + for (DBMetric dbMetric : sqlRecorder.getDBMetric()) { + if (dbMetric != null) { + sqlTime.add(dbMetric.getSqlTime()); + sqlRowCount.add(dbMetric.getRowCount()); + } + } + body.put("sql", sql); + body.put("sqltime", sqlTime); + body.put("row", sqlRowCount); + point.setBody(body.toString()); + } + try { + MetricRegistry.getMetric().submit(point); + } catch (Exception e) { + FineLoggerFactory.getLogger().warn(e.getMessage(), e); + } + } + + /** + * 模板转换失败的埋点 + */ + public static void submitFailedTransform(TransformResult result, String templateID, String name, Exception e) { + if (isPressureTesting()) { + return; + } + saveAsJSON(result, templateID, name, e); + } + + /** + * 记录在设计器的错误信息收集中 + */ + private static void saveToErrorInfo(TransformResult result, String templateID, String name, Exception e, String unsupportMessage) { + JSONObject jo = JSONFactory.createJSON(JSON.OBJECT); + jo.put(ATTR_USERNAME, IDENTIFICATION); + jo.put(ATTR_UUID, IDENTIFICATION); + jo.put(ATTR_ACTIVE_KEY, IDENTIFICATION); + jo.put(ATTR_TEMPLATE_ID, templateID); + jo.put(ATTR_REPORT_CONTENT, name); + if (result == TransformResult.FAILED) { + jo.put(ATTR_TEST_LOG, e); + jo.put(ATTR_ERROR_STACK, e.getMessage()); + } else { + jo.put(ATTR_TEST_LOG, unsupportMessage); + } + new ErrorInfo().saveFileToCache(jo); + } + + /** + * 记录在fine_record_error表中 + */ + private static void saveToErrorMessage(TransformResult result, String templateID, String name, Exception e, String unsupportMessage) { + String errorMessage = unsupportMessage; + if (result == TransformResult.FAILED) { + errorMessage = e.getStackTrace()[0].toString(); + } + ErrorMessage message = ErrorMessage.build(e == null ? errorMessage : e.getMessage(), errorMessage); + message.setTname(name); + message.setDisplayName(name); + MetricRegistry.getMetric().submit(message); + } + + private static void saveAsJSON(TransformResult result, String templateID, String name, Exception e) { + saveToErrorInfo(result, templateID, name, e, null); + saveToErrorMessage(result, templateID, name, e, null); + } + + /** + * 预编译中不支持的功能的埋点 + */ + public static void submitUnSupportTransform(TransformResult result, String templateID, String name, String unsupportMessage) { + if (isPressureTesting()) { + return; + } + saveToErrorInfo(result, templateID, name, null, unsupportMessage); + saveToErrorMessage(result, templateID, name, null, unsupportMessage); + } + + private static String parseIpToLocalhost(String ip) { + if (ComparatorUtils.equals(ip, LOCAL_IPV4_ADDRESS) || ComparatorUtils.equals(ip, LOCAL_IPV6_ADDRESS)) { + return LOCAL_DOMAIN; + } + return ip; + } + + /** + * 埋点对压测性能的影响控制参数 + * + * @return 是否压测 + */ + public static boolean isPressureTesting() { + return Boolean.parseBoolean(System.getProperty("monitorDebug")); + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java b/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java new file mode 100644 index 000000000..6a5b6d2e1 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java @@ -0,0 +1,116 @@ +package com.fr.plugin.designer.toolbar; + +import com.fr.base.extension.FileExtension; +import com.fr.design.actions.UpdateAction; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.menu.MenuKeySet; +import com.fr.file.FILE; +import com.fr.file.FileNodeFILE; +import com.fr.general.IOUtils; +import com.fr.locale.InterProviderFactory; +import com.fr.plugin.designer.utils.CompileTransformUtil; + +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.KeyStroke; +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; + +import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; +import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; +import static javax.swing.JOptionPane.OK_CANCEL_OPTION; +import static javax.swing.JOptionPane.OK_OPTION; +import static javax.swing.JOptionPane.WARNING_MESSAGE; + +/** + * Created by kerry on 2019-10-14 + */ +public class CompileAction extends UpdateAction { + public static final Icon TRANS_ICON = IOUtils.readIcon("/com/fr/plugin/designer/transform.png"); + + private static final MenuKeySet COMPILE_ATTR = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'C'; + } + + @Override + public String getMenuName() { + return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Transform-Tooltip"); + } + + @Override + public KeyStroke getKeyStroke() { + return KeyStroke.getKeyStroke(KeyEvent.VK_T, DEFAULT_MODIFIER); + } + }; + + public CompileAction() { + initMenuStyle(); + } + + private void initMenuStyle() { + this.setMenuKeySet(COMPILE_ATTR); + this.setName(getMenuKeySet().getMenuKeySetName()); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(TRANS_ICON); + this.setAccelerator(getMenuKeySet().getKeyStroke()); + } + + @Override + public void actionPerformed(ActionEvent e) { + JTemplate jtemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); + if (jtemplate == null || jtemplate.getEditingFILE() == null) { + return; + } + FILE currentTemplate = jtemplate.getEditingFILE(); + if(currentTemplate instanceof FileNodeFILE){ + transformAndDisplay(jtemplate); + }else { + //模板不在报表环境下,提示保存 + int selVal = showConfirmDialog( + DesignerContext.getDesignerFrame(), + InterProviderFactory.getProvider().getLocText("Fine-Plugin-Engine_Preview_Message"), + InterProviderFactory.getProvider().getLocText("Fine-Plugin-Engine_Transformer_Tips"), + OK_CANCEL_OPTION, + WARNING_MESSAGE); + + if (OK_OPTION == selVal) { + //保存成功才会执行编译 + if (jtemplate.saveAsTemplate2Env()) { + transformAndDisplay(jtemplate); + } + } + } + + } + + //编译模板并展示 + private void transformAndDisplay(JTemplate jtemplate){ + String path = jtemplate.getEditingFILE().getPath(); + TemplateTransformer transformer = TemplateTransformer.parse(path); + FILE targetFile = CompileTransformUtil.getTargetFile(jtemplate, transformer); + TransformResult result = transformer.transform(jtemplate, targetFile); + jtemplate.fireJTemplateSaved(); + result.display(); + } + + @Override + public boolean isEnabled() { + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + String path = jt.getEditingFILE().getPath(); + return FileExtension.CPTX.matchExtension(path) || FileExtension.CPT.matchExtension(path); + } + + @Override + public JComponent createToolBarComponent() { + UIButton transBtn = (UIButton) super.createToolBarComponent(); + transBtn.set4ToolbarButton(); + transBtn.setToolTipText(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Transform-Tooltip")); + return transBtn; + } + +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java b/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java new file mode 100644 index 000000000..9ce7ec272 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java @@ -0,0 +1,221 @@ +package com.fr.plugin.designer.toolbar; + +import com.fr.base.extension.FileExtension; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.file.MutilTempalteTabPane; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; +import com.fr.file.FILE; +import com.fr.file.FileNodeFILE; +import com.fr.file.filetree.FileNode; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.main.impl.WorkBook; +import com.fr.nx.compile.CompileStatus; +import com.fr.nx.compile.ReportCompiler; +import com.fr.nx.compile.adapter.LegacyWorkBookAdapter; +import com.fr.nx.compile.util.ReportCompileUtils; +import com.fr.nx.cptx.CptxIOManager; +import com.fr.nx.cptx.cache.CptxTemplatePool; +import com.fr.nx.cptx.entry.CptxTemplate; +import com.fr.nx.cptx.io.handle.CptxTemplateHandle; +import com.fr.plugin.designer.cptx.io.DesignReadWritableProvider; +import com.fr.nx.cptx.monitor.CompileMonitorHandler; +import com.fr.nx.cptx.utils.CptxFileUtils; +import com.fr.nx.data.layer.LayerItem; +import com.fr.nx.data.layer.LayerProps; +import com.fr.nx.template.compile.CompiledReport; +import com.fr.plugin.designer.monitor.DesignerMetricRecorder; +import com.fr.stable.StringUtils; +import org.jetbrains.annotations.NotNull; + +import java.io.OutputStream; + +import static com.fr.base.extension.FileExtension.ALL; +import static com.fr.base.extension.FileExtension.CPT; +import static com.fr.base.extension.FileExtension.CPTX; + +/** + * 模板转换器, 可以把cptx模板转为cpt, 或者cpt模板转为cptx. + * 以后可以扩展支持frm frmx互相转换 + */ + +public enum TemplateTransformer { + + TO_CPTX(CPT) { + @Override + public TransformResult transform(JTemplate jtemplate, FILE file) { + WorkBook workbook = (WorkBook) jtemplate.getTarget(); + TransformResultInfo resultInfo = compileCPTX(workbook, file); + if (needDoAfterTransformed(resultInfo.getResult())) { + doAfterTransformed(file, jtemplate); + } + return resultInfo.getResult(); + } + }, + TO_CPT(CPTX) { + @Override + public TransformResult transform(JTemplate jtemplate, FILE file) { + WorkBook workbook = (WorkBook) jtemplate.getTarget(); + try { + workbook.export(file.asOutputStream()); + doAfterTransformed(file, jtemplate); + return TransformResult.SUCCESS; + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return TransformResult.FAILED; + } + } + }, + OTHER(ALL); + private FileExtension extension; + + TemplateTransformer(FileExtension extension) { + this.extension = extension; + } + + public TransformResult transform(JTemplate jtemplate) { + return transform(jtemplate, jtemplate.getEditingFILE()); + } + + public TransformResult transform(JTemplate jtemplate, FILE newFile) { + return TransformResult.UNSUPPORT; + } + + public static TemplateTransformer parse(String path) { + for (TemplateTransformer transformer : values()) { + if (transformer.extension.matchExtension(path)) { + return transformer; + } + } + return OTHER; + } + + private static boolean needDoAfterTransformed(TransformResult result) { + return ComparatorUtils.equals(TransformResult.SUCCESS, result) + || ComparatorUtils.equals(TransformResult.UNSUPPORT, result); + } + + private static void doAfterTransformed(FILE file, JTemplate jtemplate) { + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (ComparatorUtils.equals(file.getPath(), jt.getPath())) { + HistoryTemplateListCache.getInstance().closeSelectedReport(jt); + DesignerContext.getDesignerFrame().openTemplate(file); + return; + } + MutilTempalteTabPane.getInstance().setIsCloseCurrent(true); + MutilTempalteTabPane.getInstance().closeFormat(jt); + MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt); + DesignerContext.getDesignerFrame().openTemplate(file); + } + + + public static FILE createOutputFile(String oldPath, String oldSuffix, String newSuffix) { + String newPath = generateNewPath(oldPath, oldSuffix, newSuffix); + return new FileNodeFILE(new FileNode(newPath, false)); + } + + private static String generateNewPath(String oldPath, String oldSuffix, String newSuffix) { + if (StringUtils.isEmpty(oldPath) || StringUtils.isEmpty(oldSuffix) || StringUtils.isEmpty(newSuffix)) { + return oldPath; + } + + if (oldPath.endsWith(oldSuffix)) { + return StringUtils.cutStringEndWith(oldPath, oldSuffix) + newSuffix; + } + return oldPath; + } + + /** + * 编译和保存 + * + * @param workbook work + * @param file file + * @return 编译保存结果 + */ + @NotNull + public static TransformResultInfo compileCPTX(WorkBook workbook, FILE file) { + //对于非工作目录的cptx,修改无需执行编译 + if(!(file instanceof FileNodeFILE)){ + try { + OutputStream outputStream = file.asOutputStream(); + workbook.export(outputStream); + return TransformResultInfo.generateResult(TransformResult.SUCCESS).saved(true); + }catch (Exception e){ + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return TransformResultInfo.generateResult(TransformResult.FAILED).saved(false); + } + } + boolean saved; + CompiledReport report = null; + CompileStatus compileStatus = CompileStatus.SUCCEED; + if (workbook == null || file == null) { + return TransformResultInfo + .generateResult(TransformResult.FAILED, "work and file must not be null") + .saved(false); + } + String failMessage = null; + // 编译 + ReportCompiler compiler; + try { + compiler = new ReportCompiler(new LegacyWorkBookAdapter(workbook)); + long startTime = System.currentTimeMillis(); + compiler.compile(); + report = compiler.getCompiledReport(); + // 折叠树埋点 + LayerProps props = ReportCompileUtils.getLayerProps(report); + LayerItem[] items; + if (props != null && (items = props.getLayerItems()) != null) { + CompileMonitorHandler.submitTreeCompileFocusPoint( + startTime, file.getPath(), items.length, + props.getExpandLayer(), true + ); + } + compileStatus = compiler.getStatus(); + failMessage = compiler.getFailMessage(); + long endTime = System.currentTimeMillis(); + CompileMonitorHandler.submitCompileMessage(startTime, endTime, file.getPath(), ""); + if (compileStatus != CompileStatus.SUCCEED) { + DesignerMetricRecorder.submitUnSupportTransform( + TransformResult.UNSUPPORT, + workbook.getTemplateID(), + file.getName(), + compileStatus == CompileStatus.FAILED_UNSUPPORT ? failMessage : null + ); + } + } catch (Exception exception) { + String templateID = workbook.getTemplateID(); + String fileName = file.getName(); + DesignerMetricRecorder.submitFailedTransform(TransformResult.FAILED, templateID, fileName, exception); + FineLoggerFactory.getLogger().error(exception.getMessage(), exception); + } + + // 构建编译结果,当前的 cptx template 是未经反序列化钩子处理过的 cptx 模版对象,不能直接用于模版预览 + CptxTemplate template = CptxIOManager.createCptxTemplate(workbook, report, compileStatus, failMessage); + // 保存 + DesignReadWritableProvider cptx = new DesignReadWritableProvider(file); + CptxTemplateHandle handle = CptxIOManager.create(template, cptx); + try { + saved = handle.save(); + } catch (Exception exception) { + // 存储cptx格式报错或者失败 + FineLoggerFactory.getLogger().error(exception.getMessage(), exception); + DesignerMetricRecorder.submitFailedTransform(TransformResult.FAILED, workbook.getTemplateID(), file.getName(), exception); + return TransformResultInfo.generateResult(TransformResult.FAILED, failMessage).saved(false); + } + // 读取可 web 预览模版并缓存 + try { + // todo 是否考虑异步 + String timestampedPath = CptxFileUtils.getTimestampedPath(file.getPath()); + CptxTemplate previewCptxTemplate = CptxIOManager.open(cptx).getTemplate(); + CptxTemplatePool.getInstance().addCptxTemplate(timestampedPath, previewCptxTemplate); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + if (report == null) { + // 编译报错或者失败 + return TransformResultInfo.generateResult(TransformResult.FAILED, failMessage).saved(saved); + } + return TransformResultInfo.generateResult(TransformResult.parse(compileStatus), failMessage).saved(saved); + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformerUIButton.java b/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformerUIButton.java new file mode 100644 index 000000000..a6b366836 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformerUIButton.java @@ -0,0 +1,20 @@ +package com.fr.plugin.designer.toolbar; + +import com.fr.design.fun.impl.AbstractDsinFrameUpButtonProvider; +import com.fr.design.gui.ibutton.UIButton; + + +public class TemplateTransformerUIButton extends AbstractDsinFrameUpButtonProvider { + @Override + public UIButton[] getUpButtons(int menuState) { + CompileAction compileAction = new CompileAction(); + UIButton transBtn = (UIButton) compileAction.createToolBarComponent(); + return new UIButton[]{transBtn}; + } + + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java b/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java new file mode 100644 index 000000000..2fc45e703 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java @@ -0,0 +1,55 @@ +package com.fr.plugin.designer.toolbar; + +import com.fr.design.file.TemplateTreePane; +import com.fr.design.mainframe.DesignerContext; +import com.fr.locale.InterProviderFactory; +import com.fr.nx.compile.CompileStatus; + +import javax.swing.JOptionPane; + +public enum TransformResult { + + SUCCESS(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Transform-Success")) { + @Override + public void display() { + // 转换成功后, 刷新下目录树 + TemplateTreePane.getInstance().refresh(); + super.display(); + } + }, + FAILED(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Transform-Failed")), + UNSUPPORT(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Transform-Unsupport")){ + @Override + public void display() { + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), TransformResult.SUCCESS.toString()); + } + }; + + private String msg; + + private TransformResult(String msg) { + this.msg = msg; + } + + // 展示结果 + public void display() { + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), this.toString()); + } + + @Override + public String toString() { + return this.msg; + } + + public static TransformResult parse(CompileStatus status) { + switch (status) { + case SUCCEED: + return TransformResult.SUCCESS; + case FAILED_UNSUPPORT: + return TransformResult.UNSUPPORT; + default: + return TransformResult.FAILED; + } + + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java b/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java new file mode 100644 index 000000000..581f440bd --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java @@ -0,0 +1,64 @@ +package com.fr.plugin.designer.toolbar; + +import com.fr.locale.InterProviderFactory; +import com.fr.stable.StringUtils; + +/** + * Created by kerry on 2020-01-15 + */ +public class TransformResultInfo { + + private boolean saved; + private TransformResult result; + private final String transformLog; + + public static TransformResultInfo generateResult(TransformResult result, String transformLog) { + return new TransformResultInfo(result, transformLog); + } + + public static TransformResultInfo generateResult(TransformResult result) { + return new TransformResultInfo(result, StringUtils.EMPTY); + } + + + private TransformResultInfo(TransformResult result, String transformLog) { + this.result = result; + this.transformLog = transformLog; + this.saved = false; + } + + public boolean isSaved() { + return saved; + } + + public void setSaved(boolean saved) { + this.saved = saved; + } + + public TransformResultInfo saved(boolean saved) { + setSaved(saved); + return this; + } + + public TransformResult getResult() { + return result; + } + + public void setResult(TransformResult result) { + this.result = result; + } + + public String getTransformLog() { + switch (this.result) { + case FAILED: + return transformLog + "\n" + + InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Failed_Tip"); + case SUCCESS: + return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Success_Tip"); + case UNSUPPORT: + return transformLog + "\n" + + InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Unsupport_Tip"); + } + return transformLog; + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java new file mode 100644 index 000000000..25c089941 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java @@ -0,0 +1,25 @@ +package com.fr.plugin.designer.transform; + +/** + * Created by kerry on 2019-12-10 + */ +public class BatchTransformProgress { + private double progress = 0.0D; + private int total = 0; + private int complete = 0; + + public BatchTransformProgress(int total) { + this.total = total; + } + + + public double getProgress() { + return this.progress; + } + + + public void updateProgress() { + this.complete++; + this.progress = this.complete * 1D / this.total; + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java new file mode 100644 index 000000000..4b12a2b02 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java @@ -0,0 +1,25 @@ +package com.fr.plugin.designer.transform; + +import com.fr.file.filetree.FileNode; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by kerry on 2020-02-14 + */ +public class BatchTransformUtil { + private BatchTransformUtil() { + + } + + public static FileNode[] filterTransformedFile(FileNode[] fileNodes, List transformedList){ + List list = new ArrayList(); + for (FileNode fileNode : fileNodes) { + if (!transformedList.contains(fileNode)) { + list.add(fileNode); + } + } + return list.toArray(new FileNode[list.size()]); + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java new file mode 100644 index 000000000..5993dd45c --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java @@ -0,0 +1,71 @@ +package com.fr.plugin.designer.transform; + +import com.fr.design.utils.concurrent.ThreadFactoryBuilder; +import com.fr.file.filetree.FileNode; +import com.fr.plugin.context.PluginContexts; +import com.fr.plugin.designer.toolbar.TransformResultInfo; +import com.fr.plugin.designer.utils.CompileTransformUtil; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; + +/** + * Created by kerry on 2019-12-10 + */ +public class BatchTransformer { + private BatchTransformProgress progress = new BatchTransformProgress(0); + private Map transformResults = new ConcurrentHashMap(); + private UpdateCallBack updateCallBack; + private static final int MAXPOOLSIZE = 5; + private static final String THREAD_NAME_TEMPLATE = "batchtransform-thread-%s"; + private ExecutorService threadPoolExecutor = + PluginContexts.currentContext().newFixedThreadPool(MAXPOOLSIZE, + new ThreadFactoryBuilder().setNameFormat(THREAD_NAME_TEMPLATE).build()); + + public BatchTransformer(UpdateCallBack updateCallBack) { + this.updateCallBack = updateCallBack; + } + + + public void batchTransform(List fileNodes) { + //先清理下 + transformResults.clear(); + progress = new BatchTransformProgress(fileNodes.size()); + for (FileNode fileNode : fileNodes) { + transform(fileNode); + } + } + + private void transform(final FileNode fileNode) { + + threadPoolExecutor.execute(new Runnable() { + @Override + public void run() { + TransformResultInfo transformResult = CompileTransformUtil.compileFile(fileNode); + transformResults.put(fileNode, transformResult); + updateTransformProgress(); + } + }); + } + + private synchronized void updateTransformProgress() { + progress.updateProgress(); + updateCallBack.updateProgress(progress.getProgress()); + } + + public void shutDown() { + if (threadPoolExecutor != null) { + threadPoolExecutor.shutdownNow(); + } + threadPoolExecutor = PluginContexts.currentContext().newFixedThreadPool(MAXPOOLSIZE, + new ThreadFactoryBuilder().setNameFormat(THREAD_NAME_TEMPLATE).build()); + updateCallBack.shutDown(); + } + + public Map getResults() { + return transformResults; + } + +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java new file mode 100644 index 000000000..221abbf0f --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java @@ -0,0 +1,22 @@ +package com.fr.plugin.designer.transform; + +/** + * Created by kerry on 2019-12-10 + */ +public interface UpdateCallBack { + /** + * 更新进度 + * @param progress 进度 + */ + void updateProgress(double progress); + + /** + * 进度中断 + */ + void shutDown(); + + /** + * 进度重置 + */ + void reset(); +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java new file mode 100644 index 000000000..e2287a4f4 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java @@ -0,0 +1,61 @@ +package com.fr.plugin.designer.transform.ui; + +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.locale.InterProviderFactory; + +import javax.swing.JDialog; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +/** + * Created by kerry on 2019-12-19 + */ +public class BatchTransformDialog extends JDialog implements ActionListener { + private UIButton closeBtn; + + public BatchTransformDialog(Frame parent, JPanel contentPane) { + super(parent, true); + + this.setTitle(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Batch_Transform")); + this.setResizable(false); + JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + this.setContentPane(defaultPane); + + closeBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Close")); + closeBtn.addActionListener(this); + JPanel buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); + buttonPanel.add(closeBtn); + + defaultPane.add(contentPane, BorderLayout.CENTER); + defaultPane.add(buttonPanel, BorderLayout.SOUTH); + + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + dialogExit(); + } + }); + + this.getRootPane().setDefaultButton(closeBtn); + + this.setSize(new Dimension(900, 600)); + GUICoreUtils.centerWindow(this); + } + + @Override + public void actionPerformed(ActionEvent e) { + dialogExit(); + } + + + private void dialogExit() { + this.dispose(); + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java new file mode 100644 index 000000000..4b77554a1 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java @@ -0,0 +1,223 @@ +package com.fr.plugin.designer.transform.ui; + +import com.fr.base.extension.FileExtension; +import com.fr.design.dialog.BasicPane; +import com.fr.design.file.NodeAuthProcessor; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.gui.itree.filetree.FileNodeComparator; +import com.fr.design.gui.itree.filetree.FileNodeConstants; +import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrame; +import com.fr.file.filetree.FileNode; +import com.fr.file.filetree.IOFileNodeFilter; +import com.fr.locale.InterProviderFactory; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.designer.toolbar.TransformResultInfo; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.tree.DefaultTreeModel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +/** + * Created by kerry on 2019-12-10 + */ +public class BatchTransformPane extends BasicPane { + private UITextField searchField; + private TransformFileTree tree; + private Dialog showDialog; + private TransformPreparePane preparePane; + private TransformResultPane resultPane; + + + public BatchTransformPane() { + DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); + this.showDialog = new BatchTransformDialog(designerFrame, this); + initPane(); + } + + private void initPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + initNorthPane(); + initSouthPane(); + } + + private void initNorthPane() { + UILabel northTip = new UILabel(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Tip")); + northTip.setForeground(Color.decode("#8F8F92")); + northTip.setBorder(BorderFactory.createEmptyBorder(0, 550, 10, 10)); + this.add(northTip, BorderLayout.NORTH); + } + + private void initSouthPane() { + preparePane = new TransformPreparePane(this.showDialog, this); + tree = new TransformFileTree(preparePane); + this.add(preparePane, BorderLayout.CENTER); + initLeftPane(); + initRightPane(); + } + + private void initLeftPane() { + IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{FileExtension.CPT.getSuffix()}); + tree.setDigIn(true); + tree.setFileNodeFilter(filter); + UIScrollPane scrollPane = new UIScrollPane(tree); + scrollPane.setPreferredSize(new Dimension(320, 442)); + scrollPane.setBorder(BorderFactory.createEmptyBorder(12, 0, 0, 0)); + tree.refreshEnv(); + JPanel selectPane = FRGUIPaneFactory.createTitledBorderPaneCenter( + InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Select_Template")); + JPanel searchPane = initSearchPane(); + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + jPanel.add(searchPane, BorderLayout.NORTH); + jPanel.add(scrollPane, BorderLayout.WEST); + jPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + selectPane.add(jPanel); + selectPane.setPreferredSize(new Dimension(330, 501)); + this.add(selectPane, BorderLayout.WEST); + } + + + private void initRightPane() { + resultPane = new TransformResultPane(); + this.add(resultPane, BorderLayout.EAST); + } + + private JPanel initSearchPane() { + JPanel jPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); + jPanel.setBorder(BorderFactory.createEmptyBorder()); + searchField = new UITextField(); + searchField.requestFocus(); + searchField.addKeyListener(keyFieldKeyListener); + searchField.setPreferredSize(new Dimension(261, 20)); + jPanel.add(searchField); + UIButton searchBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Search")); + searchBtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + search(); + } + }); + searchBtn.setPreferredSize(new Dimension(44, 20)); + jPanel.add(searchBtn); + return jPanel; + } + + + private KeyAdapter keyFieldKeyListener = new KeyAdapter() { + + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + search(); + e.consume(); + } + } + }; + + + + private void search() { + //重新构建TreeModel + filter(searchField.getText()); + ExpandMutableTreeNode rootNode = (ExpandMutableTreeNode) tree.getModel().getRoot(); + ((DefaultTreeModel) tree.getModel()).reload(rootNode); + // 展开所有isExpanded为true的TreeNode + rootNode.expandCurrentTreeNode(tree); + } + + public void filter(String filterString) { + NodeAuthProcessor.getInstance().refresh(); + DefaultTreeModel defaultTreeModel = (DefaultTreeModel) tree.getModel(); + ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot(); + NodeAuthProcessor.getInstance().fixTreeNodeAuth(rootTreeNode); + filter(rootTreeNode, filterString); + defaultTreeModel.reload(rootTreeNode); + } + + private void filter(ExpandMutableTreeNode rootTreeNode, String filterString) { + rootTreeNode.removeAllChildren(); + + FileNode[] fns; + fns = listFileNodes(rootTreeNode); + + ExpandMutableTreeNode[] subTreeNodes = NodeAuthProcessor.getInstance().parser2TreeNodeArray(fns); + + for (ExpandMutableTreeNode node : subTreeNodes) { + filter(node, filterString); + if (node.getChildCount() > 0 || (node.getChildCount() == 0 && node.toString().contains(filterString))) { + node.setExpanded(true); + rootTreeNode.add(node); + } + } + + } + + private FileNode[] listFileNodes(ExpandMutableTreeNode rootTreeNode) { + if (rootTreeNode == null) { + return new FileNode[0]; + } + + Object object = rootTreeNode.getUserObject(); + if (!(object instanceof FileNode)) { + return new FileNode[0]; + } + + FileNode[] fileNodes = null; + try { + fileNodes = tree.listFile(((FileNode) object).getEnvPath()); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + if (fileNodes == null) { + fileNodes = new FileNode[0]; + } + Arrays.sort(fileNodes, new FileNodeComparator(FileNodeConstants.getSupportFileTypes())); + return fileNodes; + } + + public void resetFilePaths(Map resultMap) { + this.tree.resetSelectedPaths(); + Iterator iterator = resultMap.keySet().iterator(); + List list = new ArrayList(); + while (iterator.hasNext()){ + FileNode node = iterator.next(); + list.add(node); + } + this.tree.addTransformedList(list); + this.tree.refresh(); + resultPane.populate(resultMap); + } + + public void removeSelectedNode(FileNode fileNode) { + String path = fileNode.getEnvPath(); + this.tree.removeSelectedPath(path); + } + + + @Override + protected String title4PopupWindow() { + return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Batch_Transform"); + } + + public Dialog showDialog() { + return this.showDialog; + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java new file mode 100644 index 000000000..30b4960ab --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java @@ -0,0 +1,79 @@ +package com.fr.plugin.designer.transform.ui; + +import com.fr.base.BaseUtils; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ilist.UIList; +import com.fr.design.gui.itree.filetree.FileTreeIcon; +import com.fr.file.filetree.FileNode; + +import javax.swing.DefaultListModel; +import javax.swing.Icon; +import javax.swing.JList; +import javax.swing.ListSelectionModel; +import javax.swing.SwingUtilities; +import java.awt.Rectangle; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +/** + * Created by kerry on 2020-01-13 + */ +public class PrepareTransformFileList extends UIList { + private TransformPreparePane transformingPane; + private static final int DELETE_RANGE = 20; + + + public PrepareTransformFileList(final TransformPreparePane transformingPane) { + super(); + this.transformingPane = transformingPane; + this.setBackground(UIConstants.TREE_BACKGROUND); + this.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); + DefaultListModel listModel = new DefaultListModel(); + this.setModel(listModel); + this.setCellRenderer(new UIListControlCellRenderer() { + @Override + protected Icon getLeftLabelIcon(Object value) { + if (value instanceof FileNode) { + return FileTreeIcon.getIcon((FileNode) value); + } + return null; + } + + @Override + protected Icon getRightLabelIcon(Object value) { + return BaseUtils.readIcon("/com/fr/plugin/designer/transform/tab_close.png"); + } + }); + this.addMouseListener(getListMouseListener()); + } + + + private MouseListener getListMouseListener() { + return new MouseAdapter() { + @Override + public void mouseReleased(MouseEvent evt) { + JList list = (JList) evt.getSource(); + int selectedIndex = list.getSelectedIndex(); + Rectangle rectangle = list.getCellBounds(selectedIndex, selectedIndex); + if (SwingUtilities.isLeftMouseButton(evt) + && pointInSelected(rectangle, evt.getX(), evt.getY())) { + Object value = PrepareTransformFileList.this.getSelectedValue(); + if (value != null) { + transformingPane.removeSelectedNode((FileNode) value); + } + } + } + }; + } + + private boolean pointInSelected(Rectangle rectangle, int x, int y) { + if (rectangle == null) { + return false; + } + return x >= rectangle.x + rectangle.width - DELETE_RANGE && + x <= rectangle.x + rectangle.width && + y >= rectangle.y && y <= rectangle.y + rectangle.height; + } +} + diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java new file mode 100644 index 000000000..d03f31d10 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java @@ -0,0 +1,204 @@ +package com.fr.plugin.designer.transform.ui; + +import com.fr.base.FRContext; +import com.fr.base.extension.FileExtension; +import com.fr.design.gui.itree.checkboxtree.CheckBoxTree; +import com.fr.design.gui.itree.checkboxtree.CheckBoxTreeCellRenderer; +import com.fr.design.gui.itree.checkboxtree.CheckBoxTreeSelectionModel; +import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; +import com.fr.design.remote.ui.tree.FileAuthorityTree; +import com.fr.file.filetree.FileNode; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.designer.transform.BatchTransformUtil; + +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeCellRenderer; +import javax.swing.tree.TreePath; +import java.awt.AlphaComposite; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.event.MouseEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Created by kerry on 2020-01-13 + */ +public class TransformFileTree extends FileAuthorityTree { + private TransformPreparePane preparePane; + private static final float CHECKBOX_ENABLE_OPACITY = 0.4f; + + private List transformedList = new ArrayList(); + + public TransformFileTree(TransformPreparePane preparePane) { + this.preparePane = preparePane; + } + + public void addTransformedList(List removeList) { + this.transformedList.addAll(removeList); + } + + @Override + protected CheckBoxTree.Handler createHandler() { + return new CheckBoxTree.Handler(this) { + @Override + public void mousePressed(MouseEvent e) { + super.mousePressed(e); + TreePath treePath = this.getTreePathForMouseEvent(e); + if (treePath == null) { + return; + } + CheckBoxTreeSelectionModel selectionModel = _tree.getCheckBoxTreeSelectionModel(); + boolean selected = selectionModel.isPathSelected(treePath, selectionModel.isDigIn()); + ExpandMutableTreeNode lastPathComponent = (ExpandMutableTreeNode) treePath.getLastPathComponent(); + List selectedFileNodes = filterBatchFileNode(lastPathComponent); + preparePane.removeTransformNode(selectedFileNodes); + if (selected) { + preparePane.addTransformNode(selectedFileNodes); + } + + } + }; + } + + + private List filterBatchFileNode(ExpandMutableTreeNode treeNode) { + List fileNodeList = new ArrayList<>(); + int childCount = treeNode.getChildCount(); + if (childCount > 0) { + loadPendingChildTreeNode(treeNode); + int expandChildCount = treeNode.getChildCount(); + for (int i = 0; i < expandChildCount; i++) { + fileNodeList.addAll(filterBatchFileNode((ExpandMutableTreeNode) treeNode.getChildAt(i))); + } + } else { + FileNode fileNode = (FileNode) treeNode.getUserObject(); + boolean locked = fileNodeLocked(treeNode); + if (!fileNode.isDirectory() && !locked) { + fileNodeList.add((FileNode) treeNode.getUserObject()); + } + } + return fileNodeList; + } + + + private boolean fileNodeLocked(ExpandMutableTreeNode treeNode) { + Object userObj = treeNode.getUserObject(); + if (userObj instanceof FileNode) { + FileNode node = (FileNode) userObj; + String lock = node.getLock(); + if (lock != null && !node.getUserID().equals(lock)) { + return true; + } + } + return false; + } + + public void resetSelectedPaths() { + CheckBoxTreeSelectionModel selectionModel = this.getCheckBoxTreeSelectionModel(); + selectionModel.clearSelection(); + } + + @Override + public void selectCheckBoxPaths(String[] paths) { + if (paths == null || paths.length == 0) { + return; + } + + DefaultTreeModel model = (DefaultTreeModel) this.getModel(); + ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) model.getRoot(); + List res = new ArrayList<>(); + for (String path : paths) { + TreePath treePath = getSelectedPath(treeNode, path); + if (treePath != null) { + res.add(treePath); + } + } + // 勾选中这些结点 + this.getCheckBoxTreeSelectionModel().setSelectionPaths(res.toArray(new TreePath[0])); + } + + private TreePath getSelectedPath(ExpandMutableTreeNode treeNode, String path) { + //可以只在选中的path中选择 + for (int i = 0, len = treeNode.getChildCount(); i < len; i++) { + ExpandMutableTreeNode childTreeNode = (ExpandMutableTreeNode) treeNode.getChildAt(i); + if (childTreeNode.getChildCount() > 0) { + loadPendingChildTreeNode(childTreeNode); + TreePath treePath = getSelectedPath(childTreeNode, path); + if (treePath != null) { + return treePath; + } + } + if (!(childTreeNode.getUserObject() instanceof FileNode)) { + continue; + } + FileNode fileNode = (FileNode) childTreeNode.getUserObject(); + if (ComparatorUtils.equals(path, fileNode.getEnvPath())) { + DefaultTreeModel model = (DefaultTreeModel) this.getModel(); + return new TreePath(model.getPathToRoot(childTreeNode)); + } + } + return null; + } + + public void removeSelectedPath(String path) { + if (path == null) { + return; + } + DefaultTreeModel model = (DefaultTreeModel) this.getModel(); + ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) model.getRoot(); + TreePath selectedPath = getSelectedPath(treeNode, path); + if (selectedPath != null) { + this.getCheckBoxTreeSelectionModel().removeSelectionPath(selectedPath); + + } + } + + + @Override + public FileNode[] listFile(String path) { + // 支持插件扩展, 先从env的filter拿, 再从插件拿 + Set supportTypes = new HashSet(); + for (String temp : this.filter.getSupportedTypes()) { + supportTypes.add(FileExtension.parse(temp)); + } + FileNode[] fileNodes = FRContext.getFileNodes().list( + path, + supportTypes.toArray(new FileExtension[supportTypes.size()]) + ); + return BatchTransformUtil.filterTransformedFile(fileNodes, transformedList); + } + + @Override + public boolean isCheckBoxEnabled(TreePath path) { + ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) path.getLastPathComponent(); + return !fileNodeLocked(treeNode); + } + + @Override + protected CheckBoxTreeCellRenderer createCellRenderer(TreeCellRenderer renderer) { + final CheckBoxTreeCellRenderer checkBoxTreeCellRenderer = new CheckBoxTreeCellRenderer(renderer) { + @Override + public void paint(Graphics g) { + if (!_checkBox.isEnabled()) { + AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, CHECKBOX_ENABLE_OPACITY); + ((Graphics2D) g).setComposite(composite); + } + super.paint(g); + } + }; + addPropertyChangeListener(CELL_RENDERER_PROPERTY, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + checkBoxTreeCellRenderer.setActualTreeRenderer((TreeCellRenderer) evt.getNewValue()); + } + }); + return checkBoxTreeCellRenderer; + } + + +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java new file mode 100644 index 000000000..db0bf2be8 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java @@ -0,0 +1,130 @@ +package com.fr.plugin.designer.transform.ui; + +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.file.filetree.FileNode; +import com.fr.locale.InterProviderFactory; +import com.fr.plugin.designer.toolbar.TransformResultInfo; +import com.fr.plugin.designer.transform.BatchTransformer; +import com.fr.plugin.designer.transform.UpdateCallBack; + +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.DefaultListModel; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Created by kerry on 2020-01-13 + */ +public class TransformPreparePane extends JPanel { + private static final String INITIAL_DISPLAY_TEXT = "0"; + private PrepareTransformFileList fileList; + private List selectedFileNodes; + private UpdateProgressDialog dialog; + private BatchTransformer transformer; + private UpdateCallBack updateProgressPane; + private Dialog parentDialog; + private UILabel transCountLabel; + private BatchTransformPane batchTransformPane; + private UIButton startTransform; + + public TransformPreparePane(Dialog parentDialog, BatchTransformPane batchTransformPane) { + this.batchTransformPane = batchTransformPane; + this.parentDialog = parentDialog; + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + updateProgressPane = new UpdateProgressPane(this); + transformer = new BatchTransformer(updateProgressPane); + fileList = new PrepareTransformFileList(this); + selectedFileNodes = new ArrayList<>(); + initPane(); + } + + private void initPane() { + JPanel transformPane = FRGUIPaneFactory.createTitledBorderPaneCenter( + InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Template_To_Transform")); + transformPane.setPreferredSize(new Dimension(270, 501)); + startTransform = new UIButton(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Start")); + startTransform.setEnabled(false); + addStartTransformListener(startTransform); + transCountLabel = new UILabel(INITIAL_DISPLAY_TEXT); + JPanel northPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + northPane.add(startTransform); + northPane.add(Box.createHorizontalStrut(160)); + northPane.add(transCountLabel); + transformPane.add(northPane, BorderLayout.NORTH); + UIScrollPane scrollPane = new UIScrollPane(fileList); + scrollPane.setPreferredSize(new Dimension(260, 442)); + scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + transformPane.add(scrollPane, BorderLayout.CENTER); + this.add(transformPane, BorderLayout.CENTER); + } + + private void addStartTransformListener(UIButton startTransform) { + startTransform.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + //开始转换 + transformer.batchTransform(selectedFileNodes); + displayProgressPane(); + } + + + private void displayProgressPane() { + dialog = new UpdateProgressDialog(transformer, parentDialog, (JPanel) updateProgressPane); + dialog.setVisible(true); + } + }); + } + + public void addTransformNode(List fileNodeList) { + selectedFileNodes.addAll(fileNodeList); + buildFileList(); + + } + + public void removeTransformNode(List fileNodeList) { + selectedFileNodes.removeAll(fileNodeList); + buildFileList(); + } + + public void removeSelectedNode(FileNode fileNode) { + selectedFileNodes.remove(fileNode); + buildFileList(); + this.batchTransformPane.removeSelectedNode(fileNode); + } + + private void buildFileList() { + DefaultListModel listModel = new DefaultListModel(); + int count = selectedFileNodes.size(); + for (int i = count - 1; i >= 0; i--) { + listModel.addElement(selectedFileNodes.get(i)); + } + this.fileList.setModel(listModel); + startTransform.setEnabled(selectedFileNodes.size() > 0); + transCountLabel.setText(String.valueOf(selectedFileNodes.size())); + } + + public void complete() { + dialog.dialogExit(); + updateProgressPane.reset(); + Map resultMap = transformer.getResults(); + resetFileNodeList(); + this.batchTransformPane.resetFilePaths(resultMap); + } + + private void resetFileNodeList(){ + this.selectedFileNodes.clear(); + buildFileList(); + } + +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java new file mode 100644 index 000000000..5e53fee86 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java @@ -0,0 +1,70 @@ +package com.fr.plugin.designer.transform.ui; + +import com.fr.base.BaseUtils; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ilist.UIList; +import com.fr.design.gui.itree.filetree.FileTreeIcon; +import com.fr.file.filetree.FileNode; +import com.fr.plugin.designer.toolbar.TransformResultInfo; + +import javax.swing.DefaultListModel; +import javax.swing.Icon; +import javax.swing.ListSelectionModel; +import java.util.Iterator; +import java.util.Map; + +/** + * Created by kerry on 2020-01-13 + */ +public class TransformResultList extends UIList { + private Map resultMap; + private static final Icon FAILED_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/transform/transform_failed.png"); + private static final Icon SUCCESS_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/transform/transform_success.png"); + private static final Icon UNSUPPORT_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/transform/transform_unsupport.png"); + + public TransformResultList() { + super(); + this.setBackground(UIConstants.TREE_BACKGROUND); + this.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); + DefaultListModel listModel = new DefaultListModel(); + this.setModel(listModel); + this.setCellRenderer(new UIListControlCellRenderer() { + @Override + protected Icon getLeftLabelIcon(Object value) { + if (value instanceof FileNode) { + return FileTreeIcon.getIcon((FileNode) value); + } + return null; + } + + @Override + protected Icon getRightLabelIcon(Object value) { + if (value != null) { + TransformResultInfo resultInfo = resultMap.get(value); + switch (resultInfo.getResult()) { + case FAILED: + return FAILED_ICON; + case SUCCESS: + return SUCCESS_ICON; + case UNSUPPORT: + return UNSUPPORT_ICON; + } + } + return null; + } + }); + } + + public void populate(Map resultMap) { + this.resultMap = resultMap; + DefaultListModel listModel = new DefaultListModel(); + Iterator> iterator = resultMap.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + FileNode key = entry.getKey(); + listModel.addElement(key); + } + this.setModel(listModel); + } + +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java new file mode 100644 index 000000000..531ecad02 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java @@ -0,0 +1,110 @@ +package com.fr.plugin.designer.transform.ui; + +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextarea.UITextArea; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.file.filetree.FileNode; +import com.fr.general.ComparatorUtils; +import com.fr.locale.InterProviderFactory; +import com.fr.plugin.designer.toolbar.TransformResult; +import com.fr.plugin.designer.toolbar.TransformResultInfo; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.util.Iterator; +import java.util.Map; + +/** + * Created by kerry on 2020-01-10 + */ +public class TransformResultPane extends JPanel { + private TransformResultList resultList; + private UITextArea resultInfo; + private Map resultMap; + private UILabel successTip; + + public TransformResultPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + initPane(); + } + + private void initPane() { + JPanel resultPane = FRGUIPaneFactory.createTitledBorderPaneCenter( + InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Result")); + JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + resultList = new TransformResultList(); + addValueChangeListener(); + UIScrollPane scrollPane = new UIScrollPane(resultList); + scrollPane.setPreferredSize(new Dimension(260, 260)); + scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + successTip = new UILabel(""); + successTip.setBorder(BorderFactory.createEmptyBorder(5, 150, 5, 10)); + northPane.add(successTip, BorderLayout.NORTH); + northPane.add(scrollPane, BorderLayout.CENTER); + resultPane.add(northPane); + + JPanel resultInfoPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + resultInfoPane.setPreferredSize(new Dimension(270, 165)); + resultInfoPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 10, 5)); + UILabel transformLogLabel = new UILabel( + InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Logs")); + transformLogLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); + resultInfoPane.add(transformLogLabel, BorderLayout.NORTH); + resultInfo = new UITextArea(); + resultInfo.setBackground(Color.white); + resultInfo.setLineWrap(true); + resultInfo.setWrapStyleWord(true); + resultInfo.setEditable(false); + UIScrollPane resultScrollPane = new UIScrollPane(resultInfo); + resultInfoPane.add(resultScrollPane, BorderLayout.CENTER); + this.add(resultPane, BorderLayout.NORTH); + this.add(resultInfoPane, BorderLayout.CENTER); + } + + private void addValueChangeListener() { + resultList.addListSelectionListener(new ListSelectionListener() { + @Override + public void valueChanged(ListSelectionEvent e) { + FileNode selectedValue = (FileNode) resultList.getSelectedValue(); + if (resultInfo != null && selectedValue != null) { + TransformResultInfo result = resultMap.get(selectedValue); + resultInfo.setText(result.getTransformLog()); + } + } + }); + } + + public void populate(Map resultMap) { + int count = getSuccessCount(resultMap); + String tip = InterProviderFactory.getProvider().getLocText( + "Fine-Plugin_Engine_Transform_Result_Tip", String.valueOf(count)); + successTip.setText(tip); + this.resultMap = resultMap; + resultList.populate(resultMap); + if (resultList.getModel().getSize() > 0) { + resultList.setSelectedIndex(0); + FileNode firstResult = (FileNode) resultList.getModel().getElementAt(0); + resultInfo.setText(resultMap.get(firstResult).getTransformLog()); + } + } + + private int getSuccessCount(Map resultMap) { + int count = 0; + Iterator> iterator = resultMap.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + TransformResultInfo resultInfo = entry.getValue(); + if (ComparatorUtils.equals(TransformResult.SUCCESS, resultInfo.getResult())) { + count++; + } + } + return count; + } + +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java new file mode 100644 index 000000000..796ae62ea --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java @@ -0,0 +1,86 @@ +package com.fr.plugin.designer.transform.ui; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.stable.StringUtils; +import sun.swing.DefaultLookup; + +import javax.swing.Icon; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; + +/** + * Created by kerry on 2020-01-14 + */ +public class UIListControlCellRenderer extends JPanel implements ListCellRenderer { + private UILabel content; + private UILabel controlLabel; + private Color initialLabelForeground; + + public UIListControlCellRenderer() { + initPane(); + } + + private void initPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + content = new UILabel(); + initialLabelForeground = content.getForeground(); + controlLabel = new UILabel(); + controlLabel.setPreferredSize(new Dimension(16, 20)); + this.add(content, BorderLayout.CENTER); + this.add(controlLabel, BorderLayout.EAST); + } + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + setComponentOrientation(list.getComponentOrientation()); + Color bg = null; + Color fg = null; + + JList.DropLocation dropLocation = list.getDropLocation(); + if (dropLocation != null + && !dropLocation.isInsert() + && dropLocation.getIndex() == index) { + + bg = DefaultLookup.getColor(this, ui, "List.dropCellBackground"); + fg = DefaultLookup.getColor(this, ui, "List.dropCellForeground"); + + isSelected = true; + } + + if (isSelected) { + setBackground(bg == null ? list.getSelectionBackground() : bg); + setForeground(fg == null ? list.getSelectionForeground() : fg); + content.setForeground(Color.WHITE); + + } else { + setBackground(list.getBackground()); + setForeground(list.getForeground()); + content.setForeground(initialLabelForeground); + } + + content.setText((value == null) ? StringUtils.EMPTY : value.toString()); + Icon leftLabelIcon = getLeftLabelIcon(value); + if (leftLabelIcon != null) { + content.setIcon(leftLabelIcon); + } + Icon rightLabelIcon = getRightLabelIcon(value); + if (rightLabelIcon != null) { + controlLabel.setIcon(rightLabelIcon); + } + return this; + } + + protected Icon getLeftLabelIcon(Object value) { + return null; + } + + protected Icon getRightLabelIcon(Object value) { + return null; + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java new file mode 100644 index 000000000..a980dd822 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java @@ -0,0 +1,70 @@ +package com.fr.plugin.designer.transform.ui; + +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.locale.InterProviderFactory; +import com.fr.plugin.designer.transform.BatchTransformer; + +import javax.swing.JDialog; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +/** + * Created by kerry on 2019-12-19 + */ +public class UpdateProgressDialog extends JDialog implements ActionListener { + + private UIButton pauseBtn; + private BatchTransformer transformer; + + public UpdateProgressDialog(BatchTransformer transformer, Dialog parent, JPanel contentPane) { + super(parent, true); + this.transformer = transformer; + initPane(contentPane); + } + + private void initPane(JPanel contentPane) { + this.setTitle(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Format_Transform")); + this.setResizable(false); + JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + this.setContentPane(defaultPane); + + pauseBtn = new UIButton(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Suspend")); + pauseBtn.addActionListener(this); + JPanel buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); + buttonPanel.add(pauseBtn); + + defaultPane.add(contentPane, BorderLayout.CENTER); + defaultPane.add(buttonPanel, BorderLayout.SOUTH); + + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + transformer.shutDown(); + dialogExit(); + } + }); + + this.getRootPane().setDefaultButton(pauseBtn); + + this.setSize(new Dimension(262, 122)); + GUICoreUtils.centerWindow(this); + } + + @Override + public void actionPerformed(ActionEvent e) { + transformer.shutDown(); + dialogExit(); + } + + public void dialogExit() { + this.dispose(); + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java new file mode 100644 index 000000000..ad5296cc5 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java @@ -0,0 +1,72 @@ +package com.fr.plugin.designer.transform.ui; + + +import com.fr.base.BaseUtils; +import com.fr.decision.update.data.UpdateConstants; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.ComparatorUtils; +import com.fr.locale.InterProviderFactory; +import com.fr.plugin.designer.transform.UpdateCallBack; +import com.sun.java.swing.plaf.motif.MotifProgressBarUI; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import java.awt.BorderLayout; +import java.awt.Dimension; + + +/** + * Created by kerry on 2019-12-11 + */ +public class UpdateProgressPane extends BasicPane implements UpdateCallBack { + private TransformPreparePane contentPane; + private JProgressBar progressBar; + + public UpdateProgressPane(TransformPreparePane contentPane) { + this.contentPane = contentPane; + initPane(); + } + + private void initPane() { + this.setPreferredSize(new Dimension(262, 60)); + UILabel icon = new UILabel(BaseUtils.readIcon("/com/fr/plugin/designer/transform/transforming.png")); + icon.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); + this.add(icon, BorderLayout.WEST); + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + UILabel title = new UILabel(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transforming")); + title.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0)); + centerPane.add(title, BorderLayout.NORTH); + progressBar = new JProgressBar(); + progressBar.setUI(new MotifProgressBarUI()); + progressBar.setForeground(UpdateConstants.BAR_COLOR); + centerPane.add(progressBar, BorderLayout.CENTER); + this.add(centerPane, BorderLayout.CENTER); + } + + + @Override + public void updateProgress(double progress) { + progressBar.setValue((int) (progress * 100)); + if (ComparatorUtils.equals(progress, 1D)) { + contentPane.complete(); + } + } + + @Override + public void shutDown() { + contentPane.complete(); + } + + @Override + public void reset() { + progressBar.setValue(0); + } + + @Override + protected String title4PopupWindow() { + return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Suspend"); + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java b/designer-realize/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java new file mode 100644 index 000000000..564adc6c7 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java @@ -0,0 +1,55 @@ +package com.fr.plugin.designer.utils; + +import com.fr.design.mainframe.JTemplate; +import com.fr.file.FILE; +import com.fr.file.filetree.FileNode; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.main.impl.WorkBook; +import com.fr.plugin.designer.toolbar.TemplateTransformer; +import com.fr.plugin.designer.toolbar.TransformResult; +import com.fr.plugin.designer.toolbar.TransformResultInfo; +import com.fr.workspace.WorkContext; + +import java.io.InputStream; + +import static com.fr.base.extension.FileExtension.CPT; +import static com.fr.base.extension.FileExtension.CPTX; + +/** + * Created by kerry on 2019-12-04 + */ +public class CompileTransformUtil { + + + public static TransformResultInfo compileFile(FileNode fileNode) { + long start = System.currentTimeMillis(); + InputStream in = WorkContext.getWorkResource().openStream(fileNode.getEnvPath()); + WorkBook workBook = new WorkBook(); + TransformResultInfo result = null; + try { + workBook.readStream(in); + FILE file = TemplateTransformer.createOutputFile(fileNode.getEnvPath(), CPT.getSuffix(), CPTX.getSuffix()); + result = TemplateTransformer.compileCPTX(workBook, file); + } catch (Exception ignore) { + result = TransformResultInfo.generateResult(TransformResult.FAILED); + } + long end = System.currentTimeMillis(); + FineLoggerFactory.getLogger().debug(fileNode.getName() + " compile cost : " + (end - start) +" ms "); + return result; + } + + + public static FILE getTargetFile(JTemplate jTemplate, TemplateTransformer transformer) { + FILE file = null; + if (ComparatorUtils.equals(TemplateTransformer.TO_CPTX, transformer)) { + file = TemplateTransformer.createOutputFile(jTemplate.getEditingFILE().getPath(), + CPT.getSuffix(), CPTX.getSuffix()); + + } else if (ComparatorUtils.equals(TemplateTransformer.TO_CPT, transformer)) { + file = TemplateTransformer.createOutputFile(jTemplate.getEditingFILE().getPath(), + CPTX.getSuffix(), CPT.getSuffix()); + } + return file; + } +} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java b/designer-realize/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java new file mode 100644 index 000000000..9578a0491 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java @@ -0,0 +1,79 @@ +package com.fr.plugin.designer.utils; + +import com.fr.file.FILE; +import com.fr.general.CommonIOUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.main.impl.WorkBook; +import com.fr.marshal.impl.xml.DefaultXMLObjectUnmarshaler; +import com.fr.marshal.util.MarshalUtil; +import com.fr.nx.cptx.entry.metadata.CptxMetadata; +import com.fr.nx.cptx.io.handle.impl.OriginCptProvider; +import com.fr.nx.cptx.marshal.util.CptxMarshalUtil; +import com.fr.nx.cptx.utils.CptxFileUtils; +import com.fr.stable.EncodeConstants; +import com.fr.stable.StableUtils; +import com.fr.stable.xml.XMLableReader; +import com.fr.workspace.WorkContext; + +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.InputStreamReader; + +/** + * Created by loy on 2021/1/18. + * + *

用于设计器的cptx的一些工具类 + *

+ */ +public class DesignerCptxFileUtils { + + /** + * 根据file来获取cptx中的cpt + * @param file + * @return + */ + public static WorkBook getWorkBook(final FILE file){ + try (InputStream input = file.asInputStream(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { + CommonIOUtils.copyBinaryTo(input, outputStream); + OriginCptProvider provider = new OriginCptProvider(outputStream.toByteArray()); + return CptxFileUtils.getWorkBook(provider); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; + } + + /** + * 获取模板的元数据 + * @param file + * @return + */ + public static CptxMetadata getMetadata(FILE file){ + try { + String metadataPath = StableUtils.pathJoin(generateCompileDir(file), CptxMarshalUtil.NAME_METADATA); + if(!WorkContext.getWorkResource().exist(metadataPath)){ + return null; + } + InputStream metadataInput = WorkContext.getWorkResource().openStream(metadataPath); + XMLableReader reader = XMLableReader.createXMLableReader( + new InputStreamReader(metadataInput, EncodeConstants.ENCODING_UTF_8)); + CptxMetadata metadata = (CptxMetadata) new DefaultXMLObjectUnmarshaler().unmarshal( + MarshalUtil.createMarshalableExtra(CptxMetadata.class), reader); + return metadata; + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; + } + + /** + * 根据文件获取编译后的文件夹绝对路径,比如原文件位于reportlets/test/merge.cptx,转化后为evn://assets/engine/test/merge文件夹 + * @param file + * @return + */ + public static String generateCompileDir(FILE file){ + String filePath = file.getPath(); + return CptxFileUtils.generateCompileDir(filePath); + } +} diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/CptxAppTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/CptxAppTest.java new file mode 100644 index 000000000..8fae48cac --- /dev/null +++ b/designer-realize/src/test/java/com/fr/plugin/designer/CptxAppTest.java @@ -0,0 +1,55 @@ +package com.fr.plugin.designer; + +import com.fr.file.AbstractFILE; +import com.fr.file.FILE; +import com.fr.main.impl.WorkBook; +import com.fr.nx.cptx.utils.CptxFileUtils; +import com.fr.plugin.designer.utils.DesignerCptxFileUtils; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; +import org.junit.runners.MethodSorters; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import org.powermock.modules.junit4.PowerMockRunnerDelegate; + + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@RunWith(PowerMockRunner.class) +@PowerMockRunnerDelegate(JUnit4.class) +@PrepareForTest({ + CptxFileUtils.class +}) +public class CptxAppTest { + + @Test + public void testDefaultExtensions() { + CptxApp app = new CptxApp(); + String[] extendsions = app.defaultExtensions(); + Assert.assertEquals("cptx", extendsions[0]); + } + + @Test + public void testAsIOFile() { + PowerMock.mockStatic(CptxFileUtils.class); + FILE file = new AbstractFILE() { + }; + WorkBook workBook = new WorkBook(); + EasyMock.expect(DesignerCptxFileUtils.getWorkBook(file)) + .andReturn(workBook).once() + .andReturn(null).once(); + + PowerMock.replay(CptxFileUtils.class); + Assert.assertSame(workBook, new CptxApp().asIOFile(file)); + + Assert.assertNotNull(new CptxApp().asIOFile(file)); + + PowerMock.verify(CptxFileUtils.class); + + + } +} diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/EnginexSupportedFileUIImplTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/EnginexSupportedFileUIImplTest.java new file mode 100644 index 000000000..cd8e57890 --- /dev/null +++ b/designer-realize/src/test/java/com/fr/plugin/designer/EnginexSupportedFileUIImplTest.java @@ -0,0 +1,26 @@ +package com.fr.plugin.designer; + +import org.junit.Assert; +import org.junit.Test; + +import javax.swing.Icon; + +/** + * Created by kerry on 2019-10-15 + */ +public class EnginexSupportedFileUIImplTest { + + @Test + public void testGetFileIcon() { + EnginexSupportedFileUIImpl newFileType = new EnginexSupportedFileUIImpl(); + Icon icon1 = newFileType.getFileIcon("WorkBook.cpt", false); + Assert.assertNull(icon1); + Icon icon2 = newFileType.getFileIcon("WorkBook.cptx", false); + Assert.assertEquals(EnginexSupportedFileUIImpl.CPTX_ICON, icon2); + Icon icon3 = newFileType.getFileIcon("WorkBook.cpt", true); + Assert.assertNull(icon3); + Icon icon4 = newFileType.getFileIcon("WorkBook.cptx", true); + Assert.assertEquals(EnginexSupportedFileUIImpl.CPTX_LOCKED_ICON, icon4); + } + +} diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/JStreamBookTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/JStreamBookTest.java new file mode 100644 index 000000000..b7fa4a87f --- /dev/null +++ b/designer-realize/src/test/java/com/fr/plugin/designer/JStreamBookTest.java @@ -0,0 +1,121 @@ +package com.fr.plugin.designer; + +import com.fr.file.FILE; +import com.fr.main.impl.WorkBook; +import com.fr.plugin.designer.toolbar.TemplateTransformer; +import com.fr.plugin.designer.toolbar.TransformResult; +import com.fr.plugin.designer.toolbar.TransformResultInfo; +import org.easymock.EasyMock; +import org.easymock.IAnswer; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.PowerMockRunner; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({TemplateTransformer.class, JStreamBook.class}) +@PowerMockIgnore({"com.fr.license.*"}) +@SuppressStaticInitializationFor({"com.fr.plugin.designer.JStreamBook"}) +public class JStreamBookTest { + + + @Test + public void saveFile() { + + PowerMock.mockStatic(TemplateTransformer.class); + final boolean[] fireSave = {false}; + + + JStreamBook workbook = + EasyMock.partialMockBuilder(VirtualJStreamBook.class) + .addMockedMethod("fireJTemplateSaved") + .addMockedMethod("getTarget") + .addMockedMethod("getEditingFILE") + .createMock(); + // 保存成功 + EasyMock.expect(TemplateTransformer.compileCPTX(null, null)) + .andReturn(TransformResultInfo.generateResult(TransformResult.UNSUPPORT, "fake Unsupported").saved(true)) + .once(); + PowerMock.replay(TemplateTransformer.class); + + workbook.fireJTemplateSaved(); + EasyMock.expectLastCall().andAnswer(new IAnswer() { + @Override + public Void answer() throws Throwable { + fireSave[0] = true; + return null; + } + }).once(); + + EasyMock.expect(workbook.getTarget()).andAnswer(new IAnswer() { + @Override + public WorkBook answer() throws Throwable { + return null; + } + }).once(); + + EasyMock.expect(workbook.getEditingFILE()).andAnswer(new IAnswer() { + @Override + public FILE answer() throws Throwable { + return null; + } + }).once(); + + EasyMock.replay(workbook); + + boolean saved = workbook.saveFile(); + Assert.assertTrue(saved); + Assert.assertTrue(fireSave[0]); + + PowerMock.verify(TemplateTransformer.class); + EasyMock.verify(workbook); + + fireSave[0] = false; + + // 保存失败 + PowerMock.reset(TemplateTransformer.class); + EasyMock.expect(TemplateTransformer.compileCPTX(null, null)) + .andReturn(TransformResultInfo.generateResult(TransformResult.FAILED, "fake Unsupported").saved(false)) + .once(); + PowerMock.replay(TemplateTransformer.class); + EasyMock.reset(workbook); + + EasyMock.expect(workbook.getTarget()).andAnswer(new IAnswer() { + @Override + public WorkBook answer() throws Throwable { + return null; + } + }).once(); + + EasyMock.expect(workbook.getEditingFILE()).andAnswer(new IAnswer() { + @Override + public FILE answer() throws Throwable { + return null; + } + }).once(); + EasyMock.replay(workbook); + + saved = workbook.saveFile(); + Assert.assertFalse(saved); + Assert.assertFalse(fireSave[0]); + + PowerMock.verify(TemplateTransformer.class); + EasyMock.verify(workbook); + } + + private static final class VirtualJStreamBook extends JStreamBook { + + public VirtualJStreamBook(WorkBook workBook, FILE file) { + super(workBook, file); + } + + @Override + public String toString() { + return this.getClass().getName() + "fake to string"; + } + } +} \ No newline at end of file diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java new file mode 100644 index 000000000..3dfa2655a --- /dev/null +++ b/designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java @@ -0,0 +1,41 @@ +package com.fr.plugin.designer.clean; + +import com.fr.config.dao.DaoContext; +import com.fr.config.dao.impl.LocalClassHelperDao; +import com.fr.config.dao.impl.LocalEntityDao; +import com.fr.config.dao.impl.LocalXmlEntityDao; +import com.fr.transaction.Configurations; +import com.fr.transaction.LocalConfigurationHelper; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * @author: Maksim + * @Date: Created in 2020/4/23 + * @Description: + */ +public class CompileCleanManagerTest { + + @Before + public void before() { + DaoContext.setEntityDao(new LocalEntityDao()); + DaoContext.setClassHelperDao(new LocalClassHelperDao()); + DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); + Configurations.setHelper(new LocalConfigurationHelper()); + } + + @Test + public void clearTest() { + + CompileCleanManager manager = CompileCleanManager.getInstance(); + manager.addRecord("com.cptx"); + manager.addRecord("abc/com.cptx"); + manager.addRecord("merge.cptx", "2020-01-01"); + manager.addRecord("merge.cptx", "2020-02-01"); + Assert.assertEquals(3, manager.getRecords().size()); + + manager.clear(); + Assert.assertEquals(2, manager.getRecords().size()); + } +} \ No newline at end of file diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/menu/BatchCompileMenuTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/menu/BatchCompileMenuTest.java new file mode 100644 index 000000000..99e409ff8 --- /dev/null +++ b/designer-realize/src/test/java/com/fr/plugin/designer/menu/BatchCompileMenuTest.java @@ -0,0 +1,16 @@ +package com.fr.plugin.designer.menu; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by kerry on 2020-01-15 + */ +public class BatchCompileMenuTest { + + @Test + public void testBatchCompileMenuIndex(){ + BatchCompileMenu menu = new BatchCompileMenu(); + Assert.assertEquals(9, menu.insertPosition(20)); + } +} diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java new file mode 100644 index 000000000..babf65c34 --- /dev/null +++ b/designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java @@ -0,0 +1,85 @@ +package com.fr.plugin.designer.toolbar; + +import com.fr.base.FRContext; +import com.fr.base.operator.common.CommonOperator; +import com.fr.file.FILE; +import com.fr.file.filetree.FileNodes; +import com.fr.invoke.Reflect; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import static com.fr.plugin.designer.toolbar.TemplateTransformer.OTHER; +import static com.fr.plugin.designer.toolbar.TemplateTransformer.TO_CPT; +import static com.fr.plugin.designer.toolbar.TemplateTransformer.TO_CPTX; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({FRContext.class}) +@PowerMockIgnore({"sun.tools.attach.*", "com.sun.tools.*", "com.fr.license.*"}) +public class TemplateTransformerTest { + + @Test + public void testParse() { + assertEquals(TO_CPTX, TemplateTransformer.parse("/sdf/abc.cpt")); + assertEquals(TO_CPT, TemplateTransformer.parse("/sdf/abc.cptx")); + assertEquals(OTHER, TemplateTransformer.parse("/sdf/abc.frm")); + assertEquals(OTHER, TemplateTransformer.parse(null)); + assertEquals(OTHER, TemplateTransformer.parse("abc")); + } + + @Test + public void testCompileFailed() { + TransformResultInfo result = TemplateTransformer.compileCPTX(null, null); + assertEquals(result.getResult(), TransformResult.FAILED); + } + + @Test + public void testGenerateNewPath() { + assertEquals(generateNewPath("/abc/dd.cpt", ".cpt", ".cptx"), "/abc/dd.cptx"); + assertEquals(generateNewPath("/abc/dd.cptx", ".cpt", ".cptx"), "/abc/dd.cptx"); + assertEquals(generateNewPath("/abc/dd.cptx", ".cptx", ".cpt"), "/abc/dd.cpt"); + assertEquals(generateNewPath("/abc/dd.frm", ".cpt", ".cptx"), "/abc/dd.frm"); + assertNull(generateNewPath(null, null, null)); + assertEquals(generateNewPath("abc", null, null), "abc"); + } + + private String generateNewPath(String oldPath, String oldSuffix, String newSuffix) { + return Reflect.on(TemplateTransformer.class).call("generateNewPath", oldPath, oldSuffix, newSuffix).get(); + } + + @Test + public void testCreateOutputFile() { + CommonOperator commonOperator = EasyMock.mock(CommonOperator.class); + FileNodes fileNodes = EasyMock.mock(FileNodes.class); + EasyMock.expect(fileNodes.getSupportedTypes()).andReturn(new String[]{"cptx"}).anyTimes(); + PowerMock.mockStatic(FRContext.class); + EasyMock.expect(FRContext.getCommonOperator()).andReturn(commonOperator).anyTimes(); + EasyMock.expect(FRContext.getFileNodes()).andReturn(fileNodes).anyTimes(); + EasyMock.expect(commonOperator.getWebRootPath()).andReturn("/WebInf/").anyTimes(); + EasyMock.replay(commonOperator, fileNodes); + PowerMock.replayAll(); + FILE file1 = TemplateTransformer.createOutputFile("WorkBook1.cpt", ".cpt", ".cptx"); + FILE file2 = TemplateTransformer.createOutputFile("WorkBook1.cpt", ".cptx", ".cpt"); + assertEquals("WorkBook1.cptx", file1.getPath()); + assertEquals("WorkBook1.cpt", file2.getPath()); + } + + + @Test + public void testNeedDoAfterTransformed() { + Assert.assertTrue(needDoAfterTransformed(TransformResult.SUCCESS)); + Assert.assertTrue(needDoAfterTransformed(TransformResult.UNSUPPORT)); + Assert.assertFalse(needDoAfterTransformed(TransformResult.FAILED)); + } + + private boolean needDoAfterTransformed(TransformResult result) { + return Reflect.on(TemplateTransformer.class).call("needDoAfterTransformed", result).get(); + } +} diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java new file mode 100644 index 000000000..362729278 --- /dev/null +++ b/designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java @@ -0,0 +1,32 @@ +package com.fr.plugin.designer.toolbar; + +import com.fr.locale.InterProviderFactory; +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by kerry on 2020-01-15 + */ +public class TransformResultInfoTest { + @Test + public void testGetTransformLog() { + TransformResultInfo resultInfo1 = TransformResultInfo.generateResult(TransformResult.FAILED, "failed"); + Assert.assertEquals("failed\n" + + InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Failed_Tip"), + resultInfo1.getTransformLog()); + TransformResultInfo resultInfo2 = TransformResultInfo.generateResult(TransformResult.SUCCESS); + Assert.assertEquals(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Success_Tip"), + resultInfo2.getTransformLog()); + TransformResultInfo resultInfo3 = TransformResultInfo.generateResult(TransformResult.UNSUPPORT, "unsupport"); + Assert.assertEquals("unsupport\n" + + InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Unsupport_Tip"), + resultInfo3.getTransformLog()); + + } + + @Test + public void testSaved() { + TransformResultInfo resultInfo1 = TransformResultInfo.generateResult(TransformResult.FAILED, "failed").saved(false); + Assert.assertFalse(resultInfo1.isSaved()); + } +} diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java new file mode 100644 index 000000000..43de999ee --- /dev/null +++ b/designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java @@ -0,0 +1,27 @@ +package com.fr.plugin.designer.transform; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by kerry on 2020-01-15 + */ +public class BatchTransformProgressTest { + @Test + public void testGetProgress(){ + BatchTransformProgress batchTransformProgress = new BatchTransformProgress(100); + Assert.assertEquals(0.0D, batchTransformProgress.getProgress(), 0.0D); + } + + @Test + public void testUpdateProgress(){ + BatchTransformProgress batchTransformProgress = new BatchTransformProgress(100); + for (int i = 0; i < 80; i++) { + batchTransformProgress.updateProgress(); + } + Assert.assertEquals(0.8D, batchTransformProgress.getProgress(), 0.0D); + batchTransformProgress.updateProgress(); + Assert.assertEquals(0.81D, batchTransformProgress.getProgress(), 0.0D); + + } +} diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java new file mode 100644 index 000000000..56e7c5e3a --- /dev/null +++ b/designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java @@ -0,0 +1,35 @@ +package com.fr.plugin.designer.transform; + +import com.fr.file.filetree.FileNode; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by kerry on 2020-02-14 + */ +public class BatchTransformUtilTest { + @Test + public void testFilterTransformedFile(){ + FileNode[] fileNodes = new FileNode[]{ + new FileNode("test1", false), new FileNode("test2", false) + }; + List transformedFileNodes = new ArrayList(); + FileNode[] result1 = BatchTransformUtil.filterTransformedFile(fileNodes, transformedFileNodes); + Assert.assertEquals(2, result1.length); + + transformedFileNodes.add( new FileNode("test1", false)); + FileNode[] result2 = BatchTransformUtil.filterTransformedFile(fileNodes, transformedFileNodes); + Assert.assertEquals(1, result2.length); + + transformedFileNodes.add( new FileNode("test2", false)); + FileNode[] result3 = BatchTransformUtil.filterTransformedFile(fileNodes, transformedFileNodes); + Assert.assertEquals(0, result3.length); + + transformedFileNodes.add( new FileNode("test3", false)); + FileNode[] result4 = BatchTransformUtil.filterTransformedFile(fileNodes, transformedFileNodes); + Assert.assertEquals(0, result4.length); + } +} diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java new file mode 100644 index 000000000..ef272b434 --- /dev/null +++ b/designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java @@ -0,0 +1,124 @@ +package com.fr.plugin.designer.transform; + +import org.junit.Before; +import org.junit.Test; + +import java.util.concurrent.CountDownLatch; + +/** + * Created by kerry on 2020-01-15 + */ +// FIXME @kerry 打包失败,暂时先注释 +//@RunWith(value = PowerMockRunner.class) +//@PrepareForTest({CompileTransformUtil.class, PluginContexts.class}) +//@PowerMockIgnore({"sun.tools.attach.*", "com.sun.tools.*"}) +public class BatchTransformerTest { + + private static final int MAXPOOLSIZE = 5; + private static final int COREPOOLSIZE = 3; + private static final String THREAD_NAME_TEMPLATE = "batchtransform-thread-%s"; + + @Before + public void setUp() { +// FineRuntime.start(); +// ExecutorService threadPoolExecutor = new ThreadPoolExecutor(COREPOOLSIZE, MAXPOOLSIZE, +// 0L, TimeUnit.MILLISECONDS, +// new LinkedBlockingQueue(), +// new ThreadFactoryBuilder().setNameFormat(THREAD_NAME_TEMPLATE).build()); +// PowerMock.mockStatic(PluginContexts.class); +// PluginContext pluginContext = EasyMock.mock(PluginContext.class); +// EasyMock.expect(pluginContext.newFixedThreadPool( +// EasyMock.anyInt(), EasyMock.anyObject(ThreadFactory.class))) +// .andReturn(threadPoolExecutor).anyTimes(); +// EasyMock.expect(PluginContexts.currentContext()).andReturn(pluginContext).anyTimes(); +// +// PowerMock.mockStatic(CompileTransformUtil.class); +// TransformResultInfo resultInfo = TransformResultInfo.generateResult(TransformResult.SUCCESS); +// EasyMock.expect(CompileTransformUtil.compileFile(EasyMock.anyObject(FileNode.class))) +// .andReturn(resultInfo).anyTimes(); +// EasyMock.replay(pluginContext); +// PowerMock.replayAll(); + } + + @Test + public void testBatchTransform() { +// final CountDownLatch countDownLatch = new CountDownLatch(2); +// BatchTransformer transformer = new BatchTransformer(new MockUpdateCallBack(countDownLatch)); +// List nodeList = new ArrayList<>(); +// FileNode test1 = new FileNode("path1", false); +// FileNode test2 = new FileNode("path2", false); +// nodeList.add(test1); +// nodeList.add(test2); +// transformer.batchTransform(nodeList); +// try { +// countDownLatch.await(5, TimeUnit.SECONDS); +// } catch (InterruptedException e) { +// Assert.fail(); +// } +// Map transformResults = transformer.getResults(); +// Assert.assertEquals(2, transformResults.size()); +// Assert.assertEquals(TransformResult.SUCCESS, transformResults.get(test1).getResult()); +// Assert.assertEquals(TransformResult.SUCCESS, transformResults.get(test2).getResult()); + + } + + @Test + public void testTransform() { +// final CountDownLatch countDownLatch = new CountDownLatch(1); +// BatchTransformer transformer = new BatchTransformer(new MockUpdateCallBack(countDownLatch)); +// FileNode test = new FileNode("path", false); +// Reflect.on(transformer).call("transform", test); +// try { +// countDownLatch.await(5, TimeUnit.SECONDS); +// } catch (InterruptedException e) { +// Assert.fail(); +// } +// Map transformResults = transformer.getResults(); +// Assert.assertEquals(1, transformResults.size()); +// Assert.assertEquals(TransformResult.SUCCESS, transformResults.get(test).getResult()); + } + + @Test + public void testShutDown() { +// final CountDownLatch countDownLatch = new CountDownLatch(1); +// BatchTransformer transformer = new BatchTransformer(new MockUpdateCallBack(countDownLatch)); +// List nodeList = new ArrayList<>(); +// FileNode test = new FileNode("path", false); +// nodeList.add(test); +// transformer.batchTransform(nodeList); +// transformer.shutDown(); +// try { +// countDownLatch.await(3, TimeUnit.SECONDS); +// } catch (InterruptedException e) { +// Assert.fail(); +// } +// Map transformResults = transformer.getResults(); +// Assert.assertEquals(1, transformResults.size()); +// Assert.assertEquals(TransformResult.SUCCESS, transformResults.get(test).getResult()); + } + + + private class MockUpdateCallBack implements UpdateCallBack { + private CountDownLatch countDownLatch; + + + public MockUpdateCallBack(CountDownLatch countDownLatch) { + this.countDownLatch = countDownLatch; + } + + @Override + public void updateProgress(double progress) { + countDownLatch.countDown(); + } + + @Override + public void shutDown() { + + } + + @Override + public void reset() { + + } + } +} diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java new file mode 100644 index 000000000..9b67f5532 --- /dev/null +++ b/designer-realize/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java @@ -0,0 +1,58 @@ +package com.fr.plugin.designer.utils; + +import com.fr.base.FRContext; +import com.fr.base.operator.common.CommonOperator; +import com.fr.design.mainframe.JTemplate; +import com.fr.file.FILE; +import com.fr.file.filetree.FileNodes; +import com.fr.plugin.designer.toolbar.TemplateTransformer; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +/** + * Created by kerry on 2019-12-04 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest({FRContext.class}) +@PowerMockIgnore({"sun.tools.attach.*", "com.sun.tools.*"}) +public class CompileTransformUtilTest { + @Test + public void testGetTargetFile() { + CommonOperator commonOperator = EasyMock.mock(CommonOperator.class); + FileNodes fileNodes = EasyMock.mock(FileNodes.class); + EasyMock.expect(fileNodes.getSupportedTypes()).andReturn(new String[]{"cptx"}).anyTimes(); + PowerMock.mockStatic(FRContext.class); + EasyMock.expect(FRContext.getCommonOperator()).andReturn(commonOperator).anyTimes(); + EasyMock.expect(FRContext.getFileNodes()).andReturn(fileNodes).anyTimes(); + EasyMock.expect(commonOperator.getWebRootPath()).andReturn("/WebInf/").anyTimes(); + EasyMock.replay(commonOperator, fileNodes); + PowerMock.replayAll(); + JTemplate jTemplate1 = EasyMock.mock(JTemplate.class); + FILE file1 = EasyMock.mock(FILE.class); + EasyMock.expect(jTemplate1.getEditingFILE()).andReturn(file1).anyTimes(); + EasyMock.expect(file1.getPath()).andReturn("WorkBook1.cpt").anyTimes(); + EasyMock.replay(jTemplate1, file1); + FILE targetFile = CompileTransformUtil.getTargetFile(jTemplate1, TemplateTransformer.TO_CPTX); + Assert.assertEquals("WorkBook1.cptx", targetFile.getPath()); + + targetFile = CompileTransformUtil.getTargetFile(jTemplate1, TemplateTransformer.TO_CPT); + Assert.assertEquals("WorkBook1.cpt", targetFile.getPath()); + + JTemplate jTemplate2 = EasyMock.mock(JTemplate.class); + FILE file2 = EasyMock.mock(FILE.class); + EasyMock.expect(jTemplate2.getEditingFILE()).andReturn(file2).anyTimes(); + EasyMock.expect(file2.getPath()).andReturn("WorkBook1.cpt").anyTimes(); + EasyMock.replay(jTemplate2, file2); + targetFile = CompileTransformUtil.getTargetFile(jTemplate2, TemplateTransformer.TO_CPTX); + Assert.assertEquals("WorkBook1.cptx", targetFile.getPath()); + + targetFile =CompileTransformUtil.getTargetFile(jTemplate2, TemplateTransformer.TO_CPT); + Assert.assertEquals("WorkBook1.cpt", targetFile.getPath()); + } +} From 3c87bcd12debbdc3822ae067572bd1352ae37a97 Mon Sep 17 00:00:00 2001 From: loy Date: Tue, 19 Jan 2021 11:39:10 +0800 Subject: [PATCH 108/147] =?UTF-8?q?REPORT-46916=20=E6=96=B0=E5=BC=95?= =?UTF-8?q?=E6=93=8E=E5=86=85=E7=BD=AE=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/clean/CompileCleanManager.java | 133 ---------- .../monitor/DesignerMetricRecorder.java | 79 ------ .../designer/preview/PagePlusPreview.java | 41 +++ .../clean/CompileCleanManagerTest.java | 1 + .../toolbar/TemplateTransformerDebugTest.java | 238 ++++++++++++++++++ .../resources/cpt/read-write-expand-order.cpt | 79 ++++++ .../resources/cpt/read-write-image-ref.cpt | 78 ++++++ 7 files changed, 437 insertions(+), 212 deletions(-) delete mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/clean/CompileCleanManager.java create mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/preview/PagePlusPreview.java create mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java create mode 100644 designer-realize/src/test/resources/cpt/read-write-expand-order.cpt create mode 100644 designer-realize/src/test/resources/cpt/read-write-image-ref.cpt diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/clean/CompileCleanManager.java b/designer-realize/src/main/java/com/fr/plugin/designer/clean/CompileCleanManager.java deleted file mode 100644 index abda1f5cf..000000000 --- a/designer-realize/src/main/java/com/fr/plugin/designer/clean/CompileCleanManager.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.fr.plugin.designer.clean; - -import com.fr.base.extension.FileExtension; -import com.fr.config.ConfigContext; -import com.fr.config.DefaultConfiguration; -import com.fr.config.holder.factory.Holders; -import com.fr.config.holder.impl.MapConf; -import com.fr.general.CommonDateUtils; -import com.fr.nx.cptx.marshal.util.CptxMarshalUtil; -import com.fr.stable.StableUtils; -import com.fr.stable.project.ProjectConstants; -import com.fr.transaction.Configurations; -import com.fr.transaction.WorkerAdaptor; -import com.fr.workspace.WorkContext; - -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -/** - * @author: Maksim - * @Date: Created in 2020/4/23 - * @Description: - */ -public class CompileCleanManager extends DefaultConfiguration { - - private static volatile CompileCleanManager INSTANCE; - private MapConf> mapConf = Holders.map(new HashMap(), String.class, String.class); - - private CompileCleanManager() { - } - - @Override - public String getNameSpace() { - return "CompileCleanManager"; - } - - public static CompileCleanManager getInstance() { - if (INSTANCE == null) { - synchronized (CompileCleanManager.class) { - if (INSTANCE == null) { - INSTANCE = ConfigContext.getConfigInstance(CompileCleanManager.class); - } - } - } - return INSTANCE; - } - - /** - * 增加预览记录 - * - * @param bookPath - */ - public void addRecord(String bookPath) { - String lastPreviewTime = CommonDateUtils.getDate2Str("yyyy-MM-dd", new Date()); - addRecord(bookPath, lastPreviewTime); - } - - public void addRecord(final String bookPath, final String lastPreviewTime) { - Configurations.update(new WorkerAdaptor(CompileCleanManager.class) { - @Override - public void run() { - mapConf.put(bookPath, lastPreviewTime); - } - }); - } - - /** - * 删除预览记录 - * - * @param bookPath - */ - public void deleteRecord(String bookPath) { - this.mapConf.remove(bookPath); - } - - /** - * 获取预览记录 - * - * @return - */ - public Map getRecords() { - return mapConf.get(); - } - - /** - * 执行清理 - */ - public void clear() { - Map cleanMap = getRecords(); - for (Iterator> iterator = cleanMap.entrySet().iterator(); iterator.hasNext(); ) { - Map.Entry item = iterator.next(); - String bookPath = item.getKey(); - String lastPreviewTime = item.getValue(); - if (needClean(lastPreviewTime)) { - String compilePath = getCompilePath(bookPath); - WorkContext.getWorkResource().delete(compilePath); - deleteRecord(bookPath); - } - } - - } - - private String getCompilePath(String bookPath) { - if (bookPath.endsWith(FileExtension.CPTX.getSuffix())) { - bookPath = bookPath.substring(0, bookPath.length() - FileExtension.CPTX.getSuffix().length()); - } - return StableUtils.pathJoin(ProjectConstants.ASSETS_NAME, CptxMarshalUtil.COMPILE_PATH, bookPath); - } - - /** - * 根据时间判断是否需要清理 - * - * @param lastPreviewTime - * @return - */ - private boolean needClean(String lastPreviewTime) { - Date previewTime = CommonDateUtils.transDate(lastPreviewTime, false); - Calendar calendar = Calendar.getInstance(); - calendar.setTime(previewTime); - calendar.add(Calendar.MONTH, 1); - return new Date().after(calendar.getTime()); - } - - @Override - public Object clone() throws CloneNotSupportedException { - CompileCleanManager manager = (CompileCleanManager) super.clone(); - manager.mapConf = (MapConf>) this.mapConf.clone(); - return manager; - } -} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java b/designer-realize/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java index c53fd6bfa..8c0ec55f8 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java +++ b/designer-realize/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java @@ -1,23 +1,12 @@ package com.fr.plugin.designer.monitor; import com.fr.design.mainframe.errorinfo.ErrorInfo; -import com.fr.general.ComparatorUtils; -import com.fr.intelli.record.ConsumePoint; -import com.fr.intelli.record.FocusPoint; import com.fr.intelli.record.MetricRegistry; -import com.fr.intelli.record.Original; import com.fr.json.JSON; -import com.fr.json.JSONArray; import com.fr.json.JSONFactory; import com.fr.json.JSONObject; -import com.fr.log.FineLoggerFactory; -import com.fr.measure.metric.DBMetric; import com.fr.message.ErrorMessage; -import com.fr.nx.session.SqlRecorder; import com.fr.plugin.designer.toolbar.TransformResult; -import com.fr.plugin.monitor.MonitorContentUtils; - -import java.util.Date; /** * Created by loy on 2021/1/18. @@ -26,10 +15,6 @@ import java.util.Date; */ public class DesignerMetricRecorder { - private static final String LOCAL_IPV6_ADDRESS = "0:0:0:0:0:0:0:1"; - private static final String LOCAL_IPV4_ADDRESS = "127.0.0.1"; - private static final String LOCAL_DOMAIN = "localhost"; - private static final String ATTR_TEMPLATE_ID = "templateid"; private static final String ATTR_USERNAME = "username"; private static final String ATTR_UUID = "uuid"; @@ -39,66 +24,9 @@ public class DesignerMetricRecorder { private static final String ATTR_ERROR_STACK = "errorstack"; private static final String IDENTIFICATION = "view_plus"; - private static final String LAYER_TREE_EXEC_LAYER = "FR-P1201"; - private static final String TREE_MODE_CONSUME_ID = "FR-F6006"; - - private static final String TYPE_PAGE_PLUS = "page_plus"; - private DesignerMetricRecorder() { } - public static void submitTreeModeFocusPoint(String ip, String username, String bookPath, String webTitle) { - FocusPoint point = FocusPoint.create(TREE_MODE_CONSUME_ID, bookPath, Original.PLUGIN); - point.setTime(new Date()); - point.setTitle(webTitle); - point.setText(bookPath); - point.setIp(parseIpToLocalhost(ip)); - point.setUsername(username); - try { - MetricRegistry.getMetric().submit(point); - } catch (Exception e) { - FineLoggerFactory.getLogger().warn(e.getMessage(), e); - } - } - - public static void submitLayerTreeExecLayerFocusPoint(long start, String ip, String username, String bookPath, String webTitle, - SqlRecorder sqlRecorder) { - long finish = System.currentTimeMillis(); - long consume = finish - start; - ConsumePoint point = ConsumePoint.create(LAYER_TREE_EXEC_LAYER, consume, Original.PLUGIN); - point.setTime(start); - point.setFinish(finish); - point.setTitle(webTitle); - point.setText(bookPath); - point.setType(TYPE_PAGE_PLUS); - point.setIp(parseIpToLocalhost(ip)); - point.setUsername(username); - if (sqlRecorder != null) { - JSONObject body = JSONObject.create(); - JSONArray sql = JSONArray.create(); - for (String s : sqlRecorder.getSqlList()) { - sql.add(MonitorContentUtils.truncate(s, 150)); - } - JSONArray sqlTime = JSONArray.create(); - JSONArray sqlRowCount = JSONArray.create(); - for (DBMetric dbMetric : sqlRecorder.getDBMetric()) { - if (dbMetric != null) { - sqlTime.add(dbMetric.getSqlTime()); - sqlRowCount.add(dbMetric.getRowCount()); - } - } - body.put("sql", sql); - body.put("sqltime", sqlTime); - body.put("row", sqlRowCount); - point.setBody(body.toString()); - } - try { - MetricRegistry.getMetric().submit(point); - } catch (Exception e) { - FineLoggerFactory.getLogger().warn(e.getMessage(), e); - } - } - /** * 模板转换失败的埋点 */ @@ -158,13 +86,6 @@ public class DesignerMetricRecorder { saveToErrorMessage(result, templateID, name, null, unsupportMessage); } - private static String parseIpToLocalhost(String ip) { - if (ComparatorUtils.equals(ip, LOCAL_IPV4_ADDRESS) || ComparatorUtils.equals(ip, LOCAL_IPV6_ADDRESS)) { - return LOCAL_DOMAIN; - } - return ip; - } - /** * 埋点对压测性能的影响控制参数 * diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/preview/PagePlusPreview.java b/designer-realize/src/main/java/com/fr/plugin/designer/preview/PagePlusPreview.java new file mode 100644 index 000000000..dbc838719 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/plugin/designer/preview/PagePlusPreview.java @@ -0,0 +1,41 @@ +package com.fr.plugin.designer.preview; + +import com.fr.design.fun.impl.AbstractPreviewProvider; +import com.fr.general.web.ParameterConstants; +import com.fr.locale.InterProviderFactory; + +import java.util.HashMap; +import java.util.Map; + +import static com.fr.plugin.v9.web.PagePlusActor.TYPE; + +public class PagePlusPreview extends AbstractPreviewProvider { + private static final int CODE = 100; + + @Override + public String nameForPopupItem() { + return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Page-Plus"); + } + + @Override + public String iconPathForPopupItem() { + return "com/fr/design/images/buttonicon/pages.png"; + } + + @Override + public String iconPathForLarge() { + return "com/fr/design/images/buttonicon/pageb24.png"; + } + + @Override + public int previewTypeCode() { + return CODE; + } + + @Override + public Map parametersForPreview() { + Map map = new HashMap(); + map.put(ParameterConstants.OP, TYPE); + return map; + } +} diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java index 3dfa2655a..17159bbde 100644 --- a/designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java +++ b/designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java @@ -4,6 +4,7 @@ import com.fr.config.dao.DaoContext; import com.fr.config.dao.impl.LocalClassHelperDao; import com.fr.config.dao.impl.LocalEntityDao; import com.fr.config.dao.impl.LocalXmlEntityDao; +import com.fr.nx.cptx.clean.CompileCleanManager; import com.fr.transaction.Configurations; import com.fr.transaction.LocalConfigurationHelper; import org.junit.Assert; diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java new file mode 100644 index 000000000..9010e0d6a --- /dev/null +++ b/designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java @@ -0,0 +1,238 @@ +package com.fr.plugin.designer.toolbar; + +import com.fr.base.Parameter; +import com.fr.base.chart.BaseChartCollection; +import com.fr.base.io.XMLEncryptKey; +import com.fr.base.io.XMLEncryptUtils; +import com.fr.base.iofile.IOFileAttrMarkManager; +import com.fr.base.parameter.ParameterUI; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.config.dao.DaoContext; +import com.fr.config.dao.impl.LocalClassHelperDao; +import com.fr.config.dao.impl.LocalEntityDao; +import com.fr.config.dao.impl.LocalXmlEntityDao; +import com.fr.file.MemFILE; +import com.fr.form.DefaultFormOperator; +import com.fr.form.FormOperator; +import com.fr.form.main.ExtraFormClassManager; +import com.fr.form.main.Form; +import com.fr.form.main.FormHyperlink; +import com.fr.form.main.parameter.FormParameterUI; +import com.fr.form.parameter.FormSubmitButton; +import com.fr.form.plugin.DefaultSwitcherImpl; +import com.fr.io.EncryptUtils; +import com.fr.js.FormHyperlinkProvider; +import com.fr.main.impl.WorkBook; +import com.fr.nx.calculable.Calculable; +import com.fr.nx.calculable.type.ConstantCalculable; +import com.fr.nx.cell.CellKey; +import com.fr.nx.cell.CellTemplate; +import com.fr.nx.cptx.cache.CptxTemplatePool; +import com.fr.nx.cptx.entry.CptxTemplate; +import com.fr.nx.cptx.resource.ImageResourceRef; +import com.fr.page.BaseSinglePagePrintable; +import com.fr.page.BaseSingleReportCache; +import com.fr.page.ClippedChartPage; +import com.fr.page.ClippedECPage; +import com.fr.page.ClippedPageProvider; +import com.fr.page.PDF2Painter; +import com.fr.page.PageGeneratorProvider; +import com.fr.page.PagePainter; +import com.fr.page.PagePainterProvider; +import com.fr.page.PageSetChainProvider; +import com.fr.page.PageSetProvider; +import com.fr.page.PageXmlOperator; +import com.fr.page.PageXmlProvider; +import com.fr.page.PaperSettingProvider; +import com.fr.page.ReportPage; +import com.fr.page.ReportPageAttrProvider; +import com.fr.page.ReportPageProvider; +import com.fr.page.SheetPage; +import com.fr.page.SinglePagePrintable; +import com.fr.page.SingleReportCache; +import com.fr.page.generator.PaginateReportPageGenerator; +import com.fr.page.generator.PolyReportPageGenerator; +import com.fr.page.generator.SheetPageGenerator; +import com.fr.page.pageset.ArrayPageSet; +import com.fr.page.pageset.PageSetChain; +import com.fr.page.stable.PaperSetting; +import com.fr.page.stable.ReportPageAttr; +import com.fr.plugin.attr.CalculatorAttrMark; +import com.fr.runtime.FineRuntime; +import com.fr.stable.EssentialUtils; +import com.fr.stable.bridge.BridgeMark; +import com.fr.stable.bridge.StableFactory; +import com.fr.stable.fun.WidgetSwitcher; +import com.fr.stable.module.Module; +import com.fr.stable.plugin.ExtraFormClassManagerProvider; +import com.fr.transaction.Configurations; +import com.fr.transaction.LocalConfigurationHelper; +import com.fr.xml.ReportXMLUtils; +import org.easymock.EasyMock; +import org.easymock.IArgumentMatcher; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.PowerMockRunner; +import org.powermock.reflect.Whitebox; + +import java.io.InputStream; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({CptxTemplatePool.class, XMLEncryptUtils.class}) +@SuppressStaticInitializationFor({"com.fr.nx.cptx.cache.CptxTemplatePool", "com.fr.base.io.XMLEncryptUtils"}) +@PowerMockIgnore({"com.sun.tools.attach.*", "sun.tools.attach.*"}) +public class TemplateTransformerDebugTest { + + @BeforeClass + public static void beforeClass() { + System.setProperty("apple.awt.UIElement", "true"); + StableFactory.registerXMLDescription(ReportPageAttrProvider.XML_TAG, new ReportPageAttr()); + StableFactory.registerMarkedClass(ReportPageProvider.XML_TAG, ReportPage.class); + StableFactory.registerMarkedClass(PaperSettingProvider.XML_TAG, PaperSetting.class); + StableFactory.registerMarkedClass(ReportPageProvider.XML_TAG_4_SHEET, SheetPage.class); + StableFactory.registerMarkedClass(PagePainterProvider.XML_TAG, PagePainter.class); + StableFactory.registerMarkedClass(PageSetChainProvider.XML_TAG, PageSetChain.class); + StableFactory.registerMarkedClass(PageXmlProvider.XML_TAG, PageXmlOperator.class); + StableFactory.registerMarkedClass(BaseSinglePagePrintable.XML_TAG, SinglePagePrintable.class); + StableFactory.registerMarkedClass(BaseSingleReportCache.XML_TAG, SingleReportCache.class); + StableFactory.registerMarkedClass(PageSetProvider.XML_TAG_4_ARRAY, ArrayPageSet.class); + StableFactory.registerMarkedClass(ClippedPageProvider.XML_TAG_EC, ClippedECPage.class); + StableFactory.registerMarkedClass(ClippedPageProvider.XML_TAG_CHART, ClippedChartPage.class); + StableFactory.registerMarkedClass(PageGeneratorProvider.XML_TAG_PAGE, PaginateReportPageGenerator.class); + StableFactory.registerMarkedClass(PageGeneratorProvider.XML_TAG_POLY, PolyReportPageGenerator.class); + StableFactory.registerMarkedClass(PageGeneratorProvider.XML_TAG_SHEET, SheetPageGenerator.class); + StableFactory.registerMarkedClass(PagePainterProvider.XML_TAG_4_PDF, PDF2Painter.class); + StableFactory.registerMarkedClass(BridgeMark.SUBMIT_BUTTON, FormSubmitButton.class); + StableFactory.registerMarkedClass(FormOperator.MARK_STRING, DefaultFormOperator.class); + StableFactory.registerMarkedClass(Module.FORM_MODULE, Form.class); + StableFactory.registerMarkedClass(ParameterUI.FORM_XML_TAG, FormParameterUI.class); + StableFactory.registerMarkedClass(FormHyperlinkProvider.XML_TAG, FormHyperlink.class); + StableFactory.registerMarkedObject(WidgetSwitcher.XML_TAG, new DefaultSwitcherImpl()); + StableFactory.registerMarkedClass(ExtraFormClassManagerProvider.XML_TAG, ExtraFormClassManager.class); + StableFactory.registerXMLDescription(BaseChartCollection.XML_TAG, new ChartCollection()); + StableFactory.registerXMLDescription(Parameter.XML_TAG, new Parameter()); + FineRuntime.start(); + EssentialUtils.registerObjectTokenizer(new ReportXMLUtils.ReportObjectTokenizer()); + EssentialUtils.registerObjectXMLWriterFinder(new ReportXMLUtils.ReportObjectXMLWriterFinder()); + DaoContext.setEntityDao(new LocalEntityDao()); + DaoContext.setClassHelperDao(new LocalClassHelperDao()); + DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); + Configurations.setHelper(new LocalConfigurationHelper()); + + IOFileAttrMarkManager.register(new CalculatorAttrMark()); + } + + @Before + public void before() { + Whitebox.setInternalState(XMLEncryptUtils.class, "KEY", new XMLEncryptKey()); + } + + @Test + public void testUnsupportedCompile() { + WorkBook workbook = readCpt("read-write-expand-order.cpt"); + + CptxTemplatePool pool = EasyMock.mock(CptxTemplatePool.class); + PowerMock.mockStatic(CptxTemplatePool.class); + EasyMock.expect(CptxTemplatePool.getInstance()).andReturn(pool).anyTimes(); + + PowerMock.replay(CptxTemplatePool.class); + pool.addCptxTemplate(EasyMock.anyString(), matchUnsupportedWebPreviewCptxTemplate()); + EasyMock.expectLastCall().once(); + + EasyMock.replay(pool); + TemplateTransformer.compileCPTX(workbook, new MemFILE("read-write-expand-order.cpt")); + + EasyMock.verify(pool); + PowerMock.verify(CptxTemplatePool.class); + + } + + @Test + public void testImageRefCompile() { + WorkBook workbook = readCpt("read-write-image-ref.cpt"); + + CptxTemplatePool pool = EasyMock.mock(CptxTemplatePool.class); + PowerMock.mockStatic(CptxTemplatePool.class); + EasyMock.expect(CptxTemplatePool.getInstance()).andReturn(pool).anyTimes(); + + PowerMock.replay(CptxTemplatePool.class); + pool.addCptxTemplate(EasyMock.anyString(), matchImageRefWebPreviewCptxTemplate()); + EasyMock.expectLastCall().once(); + + EasyMock.replay(pool); + TemplateTransformer.compileCPTX(workbook, new MemFILE("read-write-image-ref.cpt")); + + EasyMock.verify(pool); + PowerMock.verify(CptxTemplatePool.class); + + } + + private CptxTemplate matchImageRefWebPreviewCptxTemplate() { + EasyMock.reportMatcher(new IArgumentMatcher() { + @Override + public boolean matches(Object argument) { + if (argument instanceof CptxTemplate) { + CptxTemplate cptxTemplate = (CptxTemplate) argument; + Assert.assertNotNull(cptxTemplate.getTemplate()); + Assert.assertNotNull(cptxTemplate.getTemplate().getCompileResult()); + Assert.assertEquals(1, cptxTemplate.getTemplate().getCompileResult().getCellBlocks().length); + Assert.assertNotNull(cptxTemplate.getTemplate().getCompileResult().getCellBlocks()[0].getDataStructure()); + Assert.assertNotNull(cptxTemplate.getTemplate().getCompileResult().getCellBlocks()[0].getDataStructure().getCells()); + CellTemplate cellTemplate = cptxTemplate.getTemplate().getCompileResult().getCellBlocks()[0].getDataStructure().getCells().get(CellKey.fromString("A2")); + Assert.assertNotNull(cellTemplate); + Calculable calculable = cellTemplate.getCalculable(); + ConstantCalculable constantCalculable = calculable.unWrap(ConstantCalculable.KEY); + Assert.assertNotNull(constantCalculable); + Assert.assertTrue(constantCalculable.get() instanceof ImageResourceRef); + return true; + } + return false; + } + + @Override + public void appendTo(StringBuffer buffer) { + buffer.append("cptx template should be previewed on the web side but not."); + } + }); + return null; + } + + private CptxTemplate matchUnsupportedWebPreviewCptxTemplate() { + EasyMock.reportMatcher(new IArgumentMatcher() { + @Override + public boolean matches(Object argument) { + if (argument instanceof CptxTemplate) { + CptxTemplate cptxTemplate = (CptxTemplate) argument; + Assert.assertEquals("unsupported feature: sort after expand", + cptxTemplate.getMetadata().getFailMessage()); + return true; + } + return false; + } + + @Override + public void appendTo(StringBuffer buffer) { + buffer.append("should find unsupported error message but not"); + } + }); + return null; + } + + private static WorkBook readCpt(String subPath) { + InputStream is = TemplateTransformerDebugTest.class.getClassLoader().getResourceAsStream("cpt/" + subPath); + WorkBook wb = new WorkBook(); + try { + wb.readStream(EncryptUtils.decodeInputStream(is)); + } catch (Exception e) { + throw new RuntimeException(e); + } + return wb; + } +} diff --git a/designer-realize/src/test/resources/cpt/read-write-expand-order.cpt b/designer-realize/src/test/resources/cpt/read-write-expand-order.cpt new file mode 100644 index 000000000..3401f6fcc --- /dev/null +++ b/designer-realize/src/test/resources/cpt/read-write-expand-order.cpt @@ -0,0 +1,79 @@ + + + + +


+ + + + + + + + + + + + + + + + + + + + + + + + + +tC;K&-B[7`5WK?,Xelf@&8+0+s;]Ad+gFe2#R^R0KRcH9&1(_,Q&m?CF2#j +L2g`#\[sRl3^"LL;I*q<:m`bRtAnUh^m(8[R[\Qdap[PoDZI+D(a6:V.`2I2?>R^Sd'MY!@@k@GfZiTaUt[[X*Qn(Vqi1,QX!S[g +X8cV#:o/U(RN!]A[-MCK!$>RYIs_SOW[_9PE1L2Q+u4)L'*_+9GA>FbhqkF3>rH*rsS)m6q"c>/>qr/Vjd(?R(*:-.oLG%<9eZ1]Al^J"e-:(+>+Q1NPOaSJo+/S+i4n&T% +\/J4IBcE%5,_GkC[%jH'kh$2]A+l)FI""N?9]AXFHef&/Q\Pm:q*oGRR,WLM]A._;-d'aOX+8Xcia>YISk1g?.bi%E?!"e!Dq4AIRE5*J06XZ"l9/,[%5lSYHM*Gsc;De0X(/o,#On+F;om!UF7s$[mR(>_*`AIpT;n1NSp*r +5Md*5kOL1RpseeaT5!G,kk_1&F%\@jJs#W%4nbD$X(dC(\O+&KX.Vp>]AY-LoL^V=LM7!$S/!&hR'nH_0hm_H,f=2p+p`R&".Le>"lHKmKAHnSIm69U'g +LYG,>[,VlJ&!5>PutHqRJ4XG^$7ZL6(YG+-e=+b;LUuH3Zrc58GNFlF?j1-+QXQ(%S6.V?:G +1jf/GeC6q@_Q>S5"##8tiN'(`qU.T7U?<]A'i8Uhe/g^>U%!HX@Al,.N83)TcC)q$'k_OQ-?: +_D-F="?_k3O8O[DbknE3?fn3U+EJ3:q;#XccA+E^R:k_hA7K7g.e*(3U#a[& +%V(jo6,q3)+CL/"I32M"cKPBGLn2M%"r'=faV2lDBHCm%MHBI]AOIZj%Z*1+*FVK8J!g'*3c# +"WMR3*Y&1h_H@PEJC*H;"Y@nbp:f4UB61F[-H4phL"^(VI"gQST8h*)bt+Jo(MXVpo+u.k@X +tpaqkFs9$ + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/designer-realize/src/test/resources/cpt/read-write-image-ref.cpt b/designer-realize/src/test/resources/cpt/read-write-image-ref.cpt new file mode 100644 index 000000000..62797764a --- /dev/null +++ b/designer-realize/src/test/resources/cpt/read-write-image-ref.cpt @@ -0,0 +1,78 @@ + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +tC;K&-B[7`5WK?,Xelf@&8+0+s;]Ad+gFe2#R^R0KRcH9&1(_,Q&m?CF2#j +L2g`#\[sRl3^"LL;I*q<:m`bRtAnUh^m(8[R[\Qdap[PoDZI+D(a6:V.`2I2?>R^Sd'MY!@@k@GfZiTaUt[[X*Qn(Vqi1,QX!S[g +X8cV#:o/U(RN!]A[-MCK!$>RYIs_SOW[_9PE1L2Q+u4)L'*_+9GA>FbhqkF3>rH*rsS)m6q"c>/>qr/Vjd(?R(*:-.oLG%<9eZ1]Al^J"e-:(+>+Q1NPOaSJo+/S+i4n&T% +\/J4IBcE%5,_GkC[%jH'kh$2]A+l)FI""N?9]AXFHef&/Q\Pm:q*oGRR,WLM]A._;-d'aOX+8Xcia>YISk1g?.bi%E?!"e!Dq4AIRE5*J06XZ"l9/,[%5lSYHM*Gsc;De0X(/o,#On+F;om!UF7s$[mR(>_*`AIpT;n1NSp*r +5Md*5kOL1RpseeaT5!G,kk_1&F%\@jJs#W%4nbD$X(dC(\O+&KX.Vp>]AY-LoL^V=LM7!$S/!&hR'nH_0hm_H,f=2p+p`R&".Le>"lHKmKAHnSIm69U'g +LYG,>[,VlJ&!5>PutHqRJ4XG^$7ZL6(YG+-e=+b;LUuH3Zrc58GNFlF?j1-+QXQ(%S6.V?:G +1jf/GeC6q@_Q>S5"##8tiN'(`qU.T7U?<]A'i8Uhe/g^>U%!HX@Al,.N83)TcC)q$'k_OQ-?: +_D-F="?_k3O8O[DbknE3?fn3U+EJ3:q;#XccA+E^R:k_hA7K7g.e*(3U#a[& +%V(jo6,q3)+CL/"I32M"cKPBGLn2M%"r'=faV2lDBHCm%MHBI]AOIZj%Z*1+*FVK8J!g'*3c# +"WMR3*Y&1h_H@PEJC*H;"Y@nbp:f4UB61F[-H4phL"^(VI"gQST8h*)bt+Jo(MXVpo+u.k@X +tpaqkFs9$ + + + + + + + + + + + + + +
+ + + + + + + + + + + +
From 2556a97285093cd4ba16b4168fae43e182ba7f52 Mon Sep 17 00:00:00 2001 From: loy Date: Wed, 20 Jan 2021 15:57:21 +0800 Subject: [PATCH 109/147] =?UTF-8?q?REPORT-46916=20=E6=96=B0=E5=BC=95?= =?UTF-8?q?=E6=93=8E=E5=86=85=E7=BD=AE=EF=BC=8C=E8=B0=83=E6=95=B4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BB=93=E6=9E=84=EF=BC=8C=E9=80=82=E9=85=8D=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B0=83=E7=94=A8=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/file}/BatchCompileAction.java | 2 +- .../actions/server}/LocalAnalyzerAction.java | 2 +- .../gui/itree/filetree/FileTreeIcon.java | 12 ++++ .../com/fr/design/mainframe/JTemplate.java | 22 +++++- .../fr/design}/preview/PagePlusPreview.java | 4 +- .../java/com/fr/file/FILEChooserPane.java | 1 + .../designer/cell/CellTreeAttrPanel.java | 0 .../cell/CellTreeAttrPanelProvider.java | 0 .../cptx/io/DesignReadWritableProvider.java | 0 .../monitor/DesignerMetricRecorder.java | 0 .../designer/toolbar/CompileAction.java | 0 .../designer/toolbar/TemplateTransformer.java | 0 .../designer/toolbar/TransformResult.java | 0 .../designer/toolbar/TransformResultInfo.java | 0 .../transform/BatchTransformProgress.java | 0 .../transform/BatchTransformUtil.java | 0 .../designer/transform/BatchTransformer.java | 0 .../designer/transform/UpdateCallBack.java | 0 .../transform/ui/BatchTransformDialog.java | 0 .../transform/ui/BatchTransformPane.java | 0 .../ui/PrepareTransformFileList.java | 0 .../transform/ui/TransformFileTree.java | 0 .../transform/ui/TransformPreparePane.java | 0 .../transform/ui/TransformResultList.java | 0 .../transform/ui/TransformResultPane.java | 0 .../ui/UIListControlCellRenderer.java | 0 .../transform/ui/UpdateProgressDialog.java | 0 .../transform/ui/UpdateProgressPane.java | 0 .../designer/utils/CompileTransformUtil.java | 0 .../designer/utils/DesignerCptxFileUtils.java | 0 .../toolbar/TemplateTransformerDebugTest.java | 0 .../toolbar/TemplateTransformerTest.java | 0 .../toolbar/TransformResultInfoTest.java | 0 .../transform/BatchTransformProgressTest.java | 0 .../transform/BatchTransformUtilTest.java | 0 .../transform/BatchTransformerTest.java | 0 .../utils/CompileTransformUtilTest.java | 0 .../com/fr/design/mainframe/JWorkBook.java | 4 +- .../mainframe/app/DesignerAppActivator.java | 3 +- .../java/com/fr/plugin/designer/CptxApp.java | 6 -- .../designer/EnginexSupportedFileUIImpl.java | 51 -------------- .../com/fr/plugin/designer/JStreamBook.java | 8 +++ .../com/fr/plugin/designer/StartupAssist.java | 20 ------ .../com/fr/plugin/designer/WritableCptx.java | 29 -------- .../designer/menu/BatchCompileMenu.java | 36 ---------- .../designer/menu/CalculateAttrMenu.java | 69 ------------------- .../designer/menu/LocalAnalyzerMenu.java | 37 ---------- .../toolbar/TemplateTransformerUIButton.java | 20 ------ .../main/java/com/fr/start/MainDesigner.java | 2 + .../EnginexSupportedFileUIImplTest.java | 26 ------- .../clean/CompileCleanManagerTest.java | 42 ----------- .../designer/menu/BatchCompileMenuTest.java | 16 ----- 52 files changed, 51 insertions(+), 361 deletions(-) rename {designer-realize/src/main/java/com/fr/plugin/designer/menu => designer-base/src/main/java/com/fr/design/actions/file}/BatchCompileAction.java (97%) rename {designer-realize/src/main/java/com/fr/plugin/designer/menu => designer-base/src/main/java/com/fr/design/actions/server}/LocalAnalyzerAction.java (97%) rename {designer-realize/src/main/java/com/fr/plugin/designer => designer-base/src/main/java/com/fr/design}/preview/PagePlusPreview.java (91%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java (100%) rename {designer-realize => designer-base}/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java (100%) rename {designer-realize => designer-base}/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java (100%) rename {designer-realize => designer-base}/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java (100%) rename {designer-realize => designer-base}/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java (100%) rename {designer-realize => designer-base}/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java (100%) rename {designer-realize => designer-base}/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java (100%) rename {designer-realize => designer-base}/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java (100%) rename {designer-realize => designer-base}/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java (100%) delete mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/EnginexSupportedFileUIImpl.java delete mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/WritableCptx.java delete mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileMenu.java delete mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrMenu.java delete mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerMenu.java delete mode 100644 designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformerUIButton.java delete mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/EnginexSupportedFileUIImplTest.java delete mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java delete mode 100644 designer-realize/src/test/java/com/fr/plugin/designer/menu/BatchCompileMenuTest.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileAction.java b/designer-base/src/main/java/com/fr/design/actions/file/BatchCompileAction.java similarity index 97% rename from designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileAction.java rename to designer-base/src/main/java/com/fr/design/actions/file/BatchCompileAction.java index 848809089..9fd492628 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/BatchCompileAction.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.menu; +package com.fr.design.actions.file; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java similarity index 97% rename from designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerAction.java rename to designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java index 20881fa09..9f5ad1f0e 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.menu; +package com.fr.design.actions.server; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java index b418c1db4..53fe50441 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java @@ -48,6 +48,9 @@ public class FileTreeIcon { public static final Icon MODERN_CHT_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/modern_style_cht_file_icon_16x16.png"); + public static final Icon CPTX_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/cptx_file_icon.png"); + public static final Icon CPTX_LOCKED_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/cptx_file_icon_locked.png"); + public static final LockIcon FOLDER_LOCK_ICON = new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/fold.png")); public static final LockIcon FILE_LOCK_ICON = @@ -108,6 +111,7 @@ public class FileTreeIcon { public final static int CPT_FILE = 11; //.cpt public final static int FRM_FILE = 12; //.form .frm public final static int CHT_FILE = 13; //.chart .cht + public final static int CPTX_FILE = 14; //.cptx public static Icon getIcon(File file) { return FileTreeIcon.getIcon(file, false); @@ -252,6 +256,12 @@ public class FileTreeIcon { } else { return FileTreeIcon.MODERN_CPT_FILE_IMAGE_ICON; } + } else if (fileType == CPTX_FILE) { + if (isLocked) { + return FileTreeIcon.CPTX_LOCKED_ICON; + } else { + return FileTreeIcon.CPTX_ICON; + } } else if (fileType == FRM_FILE) { //form frm if (isLocked) { return FileTreeIcon.FRM_FILE_LOCK_ICON; @@ -314,6 +324,8 @@ public class FileTreeIcon { return BMP_FILE; } else if (fileName.endsWith(".cpt")) { return CPT_FILE; + } else if (fileName.endsWith(".cptx")) { + return CPTX_FILE; } else if (fileName.endsWith(".frm") || fileName.endsWith(".form")) { return FRM_FILE; } else if (fileName.endsWith(".cht") || fileName.endsWith(".chart")) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 483e74d9d..3bddf0f48 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.Parameter; +import com.fr.base.extension.FileExtension; import com.fr.base.io.BaseBook; import com.fr.base.iofile.attr.DesignBanCopyAttrMark; import com.fr.base.iofile.attr.TemplateIdAttrMark; @@ -14,6 +15,7 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.TableDataSourceAction; import com.fr.design.actions.edit.RedoAction; import com.fr.design.actions.edit.UndoAction; +import com.fr.design.actions.file.BatchCompileAction; import com.fr.design.actions.file.SaveAsTemplateAction; import com.fr.design.actions.file.SaveTemplateAction; import com.fr.design.actions.file.WebPreviewUtils; @@ -60,6 +62,8 @@ import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; +import com.fr.plugin.designer.toolbar.CompileAction; +import com.fr.plugin.designer.toolbar.TemplateTransformer; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; @@ -781,10 +785,12 @@ public abstract class JTemplate> protected boolean saveToNewFile(String oldName) { boolean result = false; + String path = this.editingFILE.getPath(); Set providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG); for (ReportSupportedFileUIProvider provider : providers) { - result = result || provider.saveToNewFile(this.editingFILE.getPath(), this); + result = result || provider.saveToNewFile(path, this); } + result = result || saveToNewFile4Cptx(path); if (!result) { result = result || this.saveFile(); //更换最近打开 @@ -794,6 +800,14 @@ public abstract class JTemplate> return result; } + private boolean saveToNewFile4Cptx(String targetPath) { + if (FileExtension.CPTX.matchExtension(targetPath)) { + TemplateTransformer.TO_CPTX.transform(this); + return true; + } + return false; + } + protected void mkNewFile(FILE file) { try { file.mkfile(); @@ -887,7 +901,7 @@ public abstract class JTemplate> } else if (DesignerMode.isAuthorityEditing()) { return new ShortCut[]{new SaveTemplateAction(this), new UndoAction(this), new RedoAction(this)}; } else { - return new ShortCut[]{new SaveTemplateAction(this), new SaveAsTemplateAction(this), new UndoAction(this), new RedoAction(this)}; + return new ShortCut[]{new SaveTemplateAction(this), new SaveAsTemplateAction(this), new BatchCompileAction(), new UndoAction(this), new RedoAction(this)}; } } @@ -1323,8 +1337,10 @@ public abstract class JTemplate> * @return 按钮组 */ public UIButton[] createExtraButtons() { + UIButton[] uiButtons = new UIButton[] { + (UIButton) new CompileAction().createToolBarComponent() + }; Set providers = ExtraDesignClassManager.getInstance().getArray(DesignerFrameUpButtonProvider.XML_TAG); - UIButton[] uiButtons = new UIButton[0]; for (DesignerFrameUpButtonProvider provider : providers) { uiButtons = ArrayUtils.addAll(uiButtons, provider.getUpButtons(getMenuState())); } diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/preview/PagePlusPreview.java b/designer-base/src/main/java/com/fr/design/preview/PagePlusPreview.java similarity index 91% rename from designer-realize/src/main/java/com/fr/plugin/designer/preview/PagePlusPreview.java rename to designer-base/src/main/java/com/fr/design/preview/PagePlusPreview.java index dbc838719..b06ec1b27 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/preview/PagePlusPreview.java +++ b/designer-base/src/main/java/com/fr/design/preview/PagePlusPreview.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.preview; +package com.fr.design.preview; import com.fr.design.fun.impl.AbstractPreviewProvider; import com.fr.general.web.ParameterConstants; @@ -7,7 +7,7 @@ import com.fr.locale.InterProviderFactory; import java.util.HashMap; import java.util.Map; -import static com.fr.plugin.v9.web.PagePlusActor.TYPE; +import static com.fr.plugin.web.v9.PagePlusActor.TYPE; public class PagePlusPreview extends AbstractPreviewProvider { private static final int CODE = 100; diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index 43c3f43ad..a97b7db9d 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -770,6 +770,7 @@ public class FILEChooserPane extends BasicPane { // ben:filefilter设置初值为cpt过滤 this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPT, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); + this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPTX, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); // richer:form文件 daniel 改成三个字 this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java b/designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java rename to designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java b/designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java rename to designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java b/designer-base/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java rename to designer-base/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java b/designer-base/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java rename to designer-base/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java b/designer-base/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java rename to designer-base/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java b/designer-base/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java rename to designer-base/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java b/designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java rename to designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java b/designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java rename to designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java b/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java rename to designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java b/designer-base/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java rename to designer-base/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java b/designer-base/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java similarity index 100% rename from designer-realize/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java rename to designer-base/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java b/designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java similarity index 100% rename from designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java rename to designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java b/designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java similarity index 100% rename from designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java rename to designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java b/designer-base/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java similarity index 100% rename from designer-realize/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java rename to designer-base/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java b/designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java similarity index 100% rename from designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java rename to designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java b/designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java similarity index 100% rename from designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java rename to designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java b/designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java similarity index 100% rename from designer-realize/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java rename to designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java b/designer-base/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java similarity index 100% rename from designer-realize/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java rename to designer-base/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java 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 ff14d54f4..fa1fe93cd 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 @@ -55,6 +55,7 @@ import com.fr.design.module.DesignModuleFactory; import com.fr.design.parameter.ParameterDefinitePane; import com.fr.design.parameter.ParameterInputPane; import com.fr.design.preview.MobilePreview; +import com.fr.design.preview.PagePlusPreview; import com.fr.design.preview.PagePreview; import com.fr.design.preview.ViewPreview; import com.fr.design.preview.WriteEnhancePreview; @@ -918,7 +919,7 @@ public class JWorkBook extends JTemplate { public PreviewProvider[] supportPreview() { PreviewProvider[] templatePreviews = super.supportPreview(); return ArrayUtils.addAll(new PreviewProvider[]{ - new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview(), new MobilePreview() + new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview(), new MobilePreview(), new PagePlusPreview() }, templatePreviews); } @@ -1194,6 +1195,7 @@ public class JWorkBook extends JTemplate { protected void addChooseFILEFilter(FILEChooserPane fileChooser) { String appName = ProductConstants.APP_NAME; fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPT, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); + fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPTX, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); addExtraChooseFILEFilter(fileChooser); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java index ec425847d..7cc912518 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java @@ -4,6 +4,7 @@ import com.fr.design.mainframe.App; import com.fr.design.mainframe.JTemplateFactory; import com.fr.module.Activator; import com.fr.module.extension.Prepare; +import com.fr.plugin.designer.CptxApp; import java.util.List; @@ -33,7 +34,7 @@ public class DesignerAppActivator extends Activator implements Prepare { @Override public void prepare() { - addMutable(App.KEY, new CptApp(), new FormApp(), new XlsApp(), new XlsxApp()); + addMutable(App.KEY, new CptApp(), new CptxApp(), new FormApp(), new XlsApp(), new XlsxApp()); } } diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/CptxApp.java b/designer-realize/src/main/java/com/fr/plugin/designer/CptxApp.java index cdad02a78..df1d672a3 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/CptxApp.java +++ b/designer-realize/src/main/java/com/fr/plugin/designer/CptxApp.java @@ -12,12 +12,6 @@ import com.fr.plugin.designer.utils.DesignerCptxFileUtils; */ public class CptxApp extends AbstractAppProvider { - static { - // 保证设计器默认 cptx 启动正常 - StartupAssist.init(); - } - - public CptxApp() { StartupAssist.initDesignModule(); } diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/EnginexSupportedFileUIImpl.java b/designer-realize/src/main/java/com/fr/plugin/designer/EnginexSupportedFileUIImpl.java deleted file mode 100644 index ae9ec9796..000000000 --- a/designer-realize/src/main/java/com/fr/plugin/designer/EnginexSupportedFileUIImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.fr.plugin.designer; - -import com.fr.base.BaseUtils; -import com.fr.base.extension.FileExtension; -import com.fr.design.i18n.Toolkit; -import com.fr.design.fun.impl.AbstractReportSupportedFileUIProvider; -import com.fr.design.mainframe.JTemplate; -import com.fr.file.FILEChooserPane; -import com.fr.file.filter.ChooseFileFilter; -import com.fr.plugin.designer.toolbar.TemplateTransformer; -import com.fr.stable.ProductConstants; - -import javax.swing.Icon; - - -/** - * Created by kerry on 2019-10-14 - */ -public class EnginexSupportedFileUIImpl extends AbstractReportSupportedFileUIProvider { - public static final Icon CPTX_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/cptx_file_icon.png"); - public static final Icon CPTX_LOCKED_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/cptx_file_icon_locked.png"); - - @Override - public void addChooseFileFilter(FILEChooserPane fileChooser, String suffix) { - String filterDescription = ProductConstants.APP_NAME + Toolkit.i18nText("Fine-Design_Report_Template_File"); - ChooseFileFilter cptxChooserFilter = new ChooseFileFilter(FileExtension.CPTX, filterDescription); - fileChooser.addChooseFILEFilter(cptxChooserFilter); - } - - @Override - public Icon getFileIcon(String path, boolean isShowLock) { - if (!FileExtension.CPTX.matchExtension(path)) { - return null; - } - if (isShowLock) { - return CPTX_LOCKED_ICON; - } - return CPTX_ICON; - } - - - @Override - public boolean saveToNewFile(String targetPath, JTemplate jTemplate) { - if (FileExtension.CPTX.matchExtension(targetPath)) { - TemplateTransformer.TO_CPTX.transform(jTemplate); - return true; - } - return false; - } - -} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/JStreamBook.java b/designer-realize/src/main/java/com/fr/plugin/designer/JStreamBook.java index d52568541..abb413c88 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/JStreamBook.java +++ b/designer-realize/src/main/java/com/fr/plugin/designer/JStreamBook.java @@ -8,18 +8,21 @@ import com.fr.design.actions.file.export.TextExportAction; import com.fr.design.actions.file.export.WordExportAction; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.MenuDef; +import com.fr.design.menu.ShortCut; import com.fr.file.FILE; import com.fr.general.ComparatorUtils; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.main.impl.WorkBook; import com.fr.nx.cptx.entry.metadata.CptxMetadata; +import com.fr.plugin.designer.menu.CalculateAttrAction; import com.fr.plugin.designer.toolbar.TemplateTransformer; import com.fr.plugin.designer.toolbar.TransformResult; import com.fr.plugin.designer.toolbar.TransformResultInfo; import com.fr.plugin.designer.utils.DesignerCptxFileUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; +import com.fr.third.jodd.util.ArraysUtil; import java.io.File; import java.io.FileOutputStream; @@ -106,4 +109,9 @@ public class JStreamBook extends JWorkBook { } return StringUtils.EMPTY; } + + @Override + public ShortCut[] shortcut4TemplateMenu() { + return ArraysUtil.insert(super.shortcut4TemplateMenu(), new CalculateAttrAction(this), 5); + } } diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/StartupAssist.java b/designer-realize/src/main/java/com/fr/plugin/designer/StartupAssist.java index 5f2795244..83e499d1d 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/StartupAssist.java +++ b/designer-realize/src/main/java/com/fr/plugin/designer/StartupAssist.java @@ -10,15 +10,10 @@ import com.fr.design.mainframe.JTemplateFactory; import com.fr.design.module.DesignModuleFactory; import com.fr.design.parameter.AbstractParameterReader; import com.fr.design.ui.util.UIUtil; -import com.fr.event.Event; -import com.fr.event.EventDispatcher; -import com.fr.event.Listener; import com.fr.log.FineLoggerFactory; import com.fr.main.impl.WorkBook; import com.fr.nx.cptx.CptxIOManager; import com.fr.nx.cptx.io.handle.CptxTemplateHandle; -import com.fr.plugin.context.PluginContext; -import com.fr.plugin.observer.PluginEventType; /** * 保证设计器默认 cptx 启动正常 @@ -28,11 +23,6 @@ import com.fr.plugin.observer.PluginEventType; */ public class StartupAssist { - public static void init() { - listenInitDesignModule(); - } - - public static void initDesignModule() { DesignModuleFactory.registerParameterReader(new AbstractParameterReader() { @Override @@ -82,14 +72,4 @@ public class StartupAssist { (path = jTemplate.getPath()) != null && path.endsWith(FileExtension.CPTX.getExtension()); } - - private static void listenInitDesignModule() { - EventDispatcher.listen(PluginEventType.AfterRun, new Listener() { - @SuppressWarnings("rawtypes") - @Override - public void on(Event event, PluginContext param) { - initDesignModule(); - } - }); - } } diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/WritableCptx.java b/designer-realize/src/main/java/com/fr/plugin/designer/WritableCptx.java deleted file mode 100644 index db2249915..000000000 --- a/designer-realize/src/main/java/com/fr/plugin/designer/WritableCptx.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.fr.plugin.designer; - -import com.fr.file.FILE; -import com.fr.nx.cptx.io.handle.impl.AbstractCptxIOProvider; - -import java.io.InputStream; -import java.io.OutputStream; - -/** - * 读写型模板, 用于设计器端增删改模板 - */ -public class WritableCptx extends AbstractCptxIOProvider { - - private FILE file; - - public WritableCptx(FILE file) { - this.file = file; - } - - @Override - public InputStream open() throws Exception { - return file.asInputStream(); - } - - @Override - public OutputStream createTemp() throws Exception { - return file.asOutputStream(); - } -} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileMenu.java b/designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileMenu.java deleted file mode 100644 index 6625d247c..000000000 --- a/designer-realize/src/main/java/com/fr/plugin/designer/menu/BatchCompileMenu.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.fr.plugin.designer.menu; - -import com.fr.design.fun.impl.AbstractMenuHandler; -import com.fr.design.menu.ShortCut; - -/** - * Created by kerry on 2019-12-10 - */ -public class BatchCompileMenu extends AbstractMenuHandler { - private static final int DEFAULT_INSERT_POSITION = 9; - - @Override - public int insertPosition(int total) { - return DEFAULT_INSERT_POSITION; - } - - @Override - public boolean insertSeparatorBefore() { - return false; - } - - @Override - public boolean insertSeparatorAfter() { - return false; - } - - @Override - public String category() { - return FILE; - } - - @Override - public ShortCut shortcut() { - return new BatchCompileAction(); - } -} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrMenu.java b/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrMenu.java deleted file mode 100644 index 06a3f493d..000000000 --- a/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrMenu.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.fr.plugin.designer.menu; - -import com.fr.design.fun.impl.AbstractMenuHandler; -import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; -import com.fr.design.menu.ShortCut; -import com.fr.plugin.designer.JStreamBook; - -public class CalculateAttrMenu extends AbstractMenuHandler { - - private static final int DEFAULT_INSERT_POSITION = 7; - - /** - * 插入位置 - * @param total 插入点 - * - * @return 插入位置 - * - */ - public int insertPosition(int total) { - return DEFAULT_INSERT_POSITION; - } - - /** - * 在分隔符前插入 - * - * @return 是否在分隔符前插入 - * - */ - public boolean insertSeparatorBefore() { - return false; - } - - /** - * 在分隔符后插入 - * - * @return 是否在分隔符后插入 - * - */ - public boolean insertSeparatorAfter() { - return false; - } - - /** - * 分类 - * - * @return 菜单分类 - * - */ - public String category() { - return TEMPLATE; - } - - /** - * 获取当前菜单的Action - * - * @param plus 当前操作对象 - * - * @return 菜单Action - * - */ - public ShortCut shortcut(ToolBarMenuDockPlus plus) { - //往ToolBarMenuDockPlus里塞感觉也很糟. - if (!(plus instanceof JStreamBook)){ - return null; - } - - return new CalculateAttrAction((JStreamBook) plus); - } -} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerMenu.java b/designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerMenu.java deleted file mode 100644 index 8e270010a..000000000 --- a/designer-realize/src/main/java/com/fr/plugin/designer/menu/LocalAnalyzerMenu.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fr.plugin.designer.menu; - -import com.fr.design.fun.impl.AbstractMenuHandler; -import com.fr.design.menu.ShortCut; - -/** - * @author Maksim - * Created in 2020/11/5 11:44 上午 - */ -public class LocalAnalyzerMenu extends AbstractMenuHandler { - private static final int DEFAULT_INSERT_POSITION = 13; - - @Override - public int insertPosition(int i) { - return DEFAULT_INSERT_POSITION; - } - - @Override - public boolean insertSeparatorBefore() { - return false; - } - - @Override - public boolean insertSeparatorAfter() { - return false; - } - - @Override - public String category() { - return SERVER; - } - - @Override - public ShortCut shortcut() { - return new LocalAnalyzerAction(); - } -} diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformerUIButton.java b/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformerUIButton.java deleted file mode 100644 index a6b366836..000000000 --- a/designer-realize/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformerUIButton.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.fr.plugin.designer.toolbar; - -import com.fr.design.fun.impl.AbstractDsinFrameUpButtonProvider; -import com.fr.design.gui.ibutton.UIButton; - - -public class TemplateTransformerUIButton extends AbstractDsinFrameUpButtonProvider { - @Override - public UIButton[] getUpButtons(int menuState) { - CompileAction compileAction = new CompileAction(); - UIButton transBtn = (UIButton) compileAction.createToolBarComponent(); - return new UIButton[]{transBtn}; - } - - - @Override - public int currentAPILevel() { - return CURRENT_LEVEL; - } -} 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 162a2044f..4bcf4387f 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -6,6 +6,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.actions.file.newReport.NewPolyReportAction; import com.fr.design.actions.file.newReport.NewWorkBookAction; +import com.fr.design.actions.server.LocalAnalyzerAction; import com.fr.design.actions.server.ServerConfigManagerAction; import com.fr.design.actions.server.StyleListAction; import com.fr.design.actions.server.WidgetManagerAction; @@ -165,6 +166,7 @@ public class MainDesigner extends BaseDesigner { if (WorkContext.getCurrent().isRoot()) { menuDef.addShortCut(new ServerConfigManagerAction(), new StyleListAction(), new WidgetManagerAction()); menuDef.addShortCut(new ChartPreStyleAction(), new ChartEmptyDataStyleAction(),new ChartMapEditorAction()); + menuDef.addShortCut(new LocalAnalyzerAction()); } insertMenu(menuDef, MenuHandler.SERVER); diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/EnginexSupportedFileUIImplTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/EnginexSupportedFileUIImplTest.java deleted file mode 100644 index cd8e57890..000000000 --- a/designer-realize/src/test/java/com/fr/plugin/designer/EnginexSupportedFileUIImplTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.fr.plugin.designer; - -import org.junit.Assert; -import org.junit.Test; - -import javax.swing.Icon; - -/** - * Created by kerry on 2019-10-15 - */ -public class EnginexSupportedFileUIImplTest { - - @Test - public void testGetFileIcon() { - EnginexSupportedFileUIImpl newFileType = new EnginexSupportedFileUIImpl(); - Icon icon1 = newFileType.getFileIcon("WorkBook.cpt", false); - Assert.assertNull(icon1); - Icon icon2 = newFileType.getFileIcon("WorkBook.cptx", false); - Assert.assertEquals(EnginexSupportedFileUIImpl.CPTX_ICON, icon2); - Icon icon3 = newFileType.getFileIcon("WorkBook.cpt", true); - Assert.assertNull(icon3); - Icon icon4 = newFileType.getFileIcon("WorkBook.cptx", true); - Assert.assertEquals(EnginexSupportedFileUIImpl.CPTX_LOCKED_ICON, icon4); - } - -} diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java deleted file mode 100644 index 17159bbde..000000000 --- a/designer-realize/src/test/java/com/fr/plugin/designer/clean/CompileCleanManagerTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.fr.plugin.designer.clean; - -import com.fr.config.dao.DaoContext; -import com.fr.config.dao.impl.LocalClassHelperDao; -import com.fr.config.dao.impl.LocalEntityDao; -import com.fr.config.dao.impl.LocalXmlEntityDao; -import com.fr.nx.cptx.clean.CompileCleanManager; -import com.fr.transaction.Configurations; -import com.fr.transaction.LocalConfigurationHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -/** - * @author: Maksim - * @Date: Created in 2020/4/23 - * @Description: - */ -public class CompileCleanManagerTest { - - @Before - public void before() { - DaoContext.setEntityDao(new LocalEntityDao()); - DaoContext.setClassHelperDao(new LocalClassHelperDao()); - DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); - Configurations.setHelper(new LocalConfigurationHelper()); - } - - @Test - public void clearTest() { - - CompileCleanManager manager = CompileCleanManager.getInstance(); - manager.addRecord("com.cptx"); - manager.addRecord("abc/com.cptx"); - manager.addRecord("merge.cptx", "2020-01-01"); - manager.addRecord("merge.cptx", "2020-02-01"); - Assert.assertEquals(3, manager.getRecords().size()); - - manager.clear(); - Assert.assertEquals(2, manager.getRecords().size()); - } -} \ No newline at end of file diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/menu/BatchCompileMenuTest.java b/designer-realize/src/test/java/com/fr/plugin/designer/menu/BatchCompileMenuTest.java deleted file mode 100644 index 99e409ff8..000000000 --- a/designer-realize/src/test/java/com/fr/plugin/designer/menu/BatchCompileMenuTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.fr.plugin.designer.menu; - -import org.junit.Assert; -import org.junit.Test; - -/** - * Created by kerry on 2020-01-15 - */ -public class BatchCompileMenuTest { - - @Test - public void testBatchCompileMenuIndex(){ - BatchCompileMenu menu = new BatchCompileMenu(); - Assert.assertEquals(9, menu.insertPosition(20)); - } -} From ba5fe94b4370af22e78c8184d32d1adbfb84a76e Mon Sep 17 00:00:00 2001 From: loy Date: Wed, 27 Jan 2021 15:59:09 +0800 Subject: [PATCH 110/147] =?UTF-8?q?REPORT-46916=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=8C=85=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/actions/server/LocalAnalyzerAction.java | 2 +- .../src/main/java/com/fr/design/preview/PagePlusPreview.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java index 9f5ad1f0e..305a26335 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java @@ -5,7 +5,7 @@ import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.DesignUtils; import com.fr.locale.InterProviderFactory; -import com.fr.plugin.web.URLConstants; +import com.fr.nx.app.web.URLConstants; import com.fr.stable.StableUtils; import javax.swing.KeyStroke; diff --git a/designer-base/src/main/java/com/fr/design/preview/PagePlusPreview.java b/designer-base/src/main/java/com/fr/design/preview/PagePlusPreview.java index b06ec1b27..04fd6623c 100644 --- a/designer-base/src/main/java/com/fr/design/preview/PagePlusPreview.java +++ b/designer-base/src/main/java/com/fr/design/preview/PagePlusPreview.java @@ -7,7 +7,7 @@ import com.fr.locale.InterProviderFactory; import java.util.HashMap; import java.util.Map; -import static com.fr.plugin.web.v9.PagePlusActor.TYPE; +import static com.fr.nx.app.web.v9.PagePlusActor.TYPE; public class PagePlusPreview extends AbstractPreviewProvider { private static final int CODE = 100; From 25d713bae253aaa76c7c740d679fa76186a7454f Mon Sep 17 00:00:00 2001 From: loy Date: Thu, 28 Jan 2021 17:22:29 +0800 Subject: [PATCH 111/147] =?UTF-8?q?REPORT-46916=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=8C=85=E5=90=8D=EF=BC=8C=E5=85=BC=E5=AE=B9=E6=80=A7=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/file/BatchCompileAction.java | 4 ++-- .../actions/server/LocalAnalyzerAction.java | 2 +- .../gui/itree/filetree/FileTreeIcon.java | 4 ++-- .../com/fr/design/mainframe/JTemplate.java | 4 ++-- .../cptx/io/DesignReadWritableProvider.java | 5 ++--- .../monitor/DesignerMetricRecorder.java | 4 ++-- .../app}/designer/toolbar/CompileAction.java | 6 +++--- .../designer/toolbar/TemplateTransformer.java | 6 +++--- .../designer/toolbar/TransformResult.java | 2 +- .../designer/toolbar/TransformResultInfo.java | 2 +- .../transform/BatchTransformProgress.java | 2 +- .../transform/BatchTransformUtil.java | 2 +- .../designer/transform/BatchTransformer.java | 6 +++--- .../designer/transform/UpdateCallBack.java | 2 +- .../transform/ui/BatchTransformDialog.java | 2 +- .../transform/ui/BatchTransformPane.java | 4 ++-- .../ui/PrepareTransformFileList.java | 4 ++-- .../transform/ui/TransformFileTree.java | 4 ++-- .../transform/ui/TransformPreparePane.java | 8 ++++---- .../transform/ui/TransformResultList.java | 10 +++++----- .../transform/ui/TransformResultPane.java | 6 +++--- .../ui/UIListControlCellRenderer.java | 2 +- .../transform/ui/UpdateProgressDialog.java | 4 ++-- .../transform/ui/UpdateProgressPane.java | 6 +++--- .../designer/utils/CompileTransformUtil.java | 8 ++++---- .../designer/utils/DesignerCptxFileUtils.java | 6 +++--- .../toolbar/TemplateTransformerDebugTest.java | 7 ++++--- .../toolbar/TemplateTransformerTest.java | 8 ++++---- .../toolbar/TransformResultInfoTest.java | 2 +- .../transform/BatchTransformProgressTest.java | 2 +- .../transform/BatchTransformUtilTest.java | 2 +- .../transform/BatchTransformerTest.java | 2 +- .../utils/CompileTransformUtilTest.java | 4 ++-- .../mainframe/app/DesignerAppActivator.java | 2 +- .../settingpane/CellExpandExtraAttrPane.java | 20 +++++++++++-------- .../{plugin => nx/app}/designer/CptxApp.java | 4 ++-- .../app}/designer/JStreamBook.java | 12 +++++------ .../app}/designer/StartupAssist.java | 2 +- .../app}/designer/cell/CellTreeAttrPanel.java | 2 +- .../cell/CellTreeAttrPanelProvider.java | 4 ++-- .../designer/menu/CalculateAttrAction.java | 4 ++-- .../app}/designer/menu/CalculateAttrPane.java | 4 ++-- .../app}/designer/menu/FeatureFlagsPanel.java | 4 ++-- .../designer/menu/bean/FeatureFlagBean.java | 2 +- .../app}/designer/CptxAppTest.java | 4 ++-- .../app}/designer/JStreamBookTest.java | 8 ++++---- 46 files changed, 109 insertions(+), 105 deletions(-) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/cptx/io/DesignReadWritableProvider.java (92%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/monitor/DesignerMetricRecorder.java (97%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/toolbar/CompileAction.java (96%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/toolbar/TemplateTransformer.java (98%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/toolbar/TransformResult.java (97%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/toolbar/TransformResultInfo.java (97%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/BatchTransformProgress.java (91%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/BatchTransformUtil.java (93%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/BatchTransformer.java (93%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/UpdateCallBack.java (87%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/ui/BatchTransformDialog.java (97%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/ui/BatchTransformPane.java (98%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/ui/PrepareTransformFileList.java (96%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/ui/TransformFileTree.java (98%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/ui/TransformPreparePane.java (95%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/ui/TransformResultList.java (89%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/ui/TransformResultPane.java (96%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/ui/UIListControlCellRenderer.java (98%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/ui/UpdateProgressDialog.java (95%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/transform/ui/UpdateProgressPane.java (91%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/utils/CompileTransformUtil.java (90%) rename designer-base/src/main/java/com/fr/{plugin => nx/app}/designer/utils/DesignerCptxFileUtils.java (94%) rename designer-base/src/test/java/com/fr/{plugin => nx/app}/designer/toolbar/TemplateTransformerDebugTest.java (97%) rename designer-base/src/test/java/com/fr/{plugin => nx/app}/designer/toolbar/TemplateTransformerTest.java (93%) rename designer-base/src/test/java/com/fr/{plugin => nx/app}/designer/toolbar/TransformResultInfoTest.java (97%) rename designer-base/src/test/java/com/fr/{plugin => nx/app}/designer/transform/BatchTransformProgressTest.java (95%) rename designer-base/src/test/java/com/fr/{plugin => nx/app}/designer/transform/BatchTransformUtilTest.java (96%) rename designer-base/src/test/java/com/fr/{plugin => nx/app}/designer/transform/BatchTransformerTest.java (99%) rename designer-base/src/test/java/com/fr/{plugin => nx/app}/designer/utils/CompileTransformUtilTest.java (96%) rename designer-realize/src/main/java/com/fr/{plugin => nx/app}/designer/CptxApp.java (93%) rename designer-realize/src/main/java/com/fr/{plugin => nx/app}/designer/JStreamBook.java (92%) rename designer-realize/src/main/java/com/fr/{plugin => nx/app}/designer/StartupAssist.java (98%) rename {designer-base/src/main/java/com/fr/plugin => designer-realize/src/main/java/com/fr/nx/app}/designer/cell/CellTreeAttrPanel.java (98%) rename {designer-base/src/main/java/com/fr/plugin => designer-realize/src/main/java/com/fr/nx/app}/designer/cell/CellTreeAttrPanelProvider.java (91%) rename designer-realize/src/main/java/com/fr/{plugin => nx/app}/designer/menu/CalculateAttrAction.java (96%) rename designer-realize/src/main/java/com/fr/{plugin => nx/app}/designer/menu/CalculateAttrPane.java (98%) rename designer-realize/src/main/java/com/fr/{plugin => nx/app}/designer/menu/FeatureFlagsPanel.java (96%) rename designer-realize/src/main/java/com/fr/{plugin => nx/app}/designer/menu/bean/FeatureFlagBean.java (96%) rename designer-realize/src/test/java/com/fr/{plugin => nx/app}/designer/CptxAppTest.java (94%) rename designer-realize/src/test/java/com/fr/{plugin => nx/app}/designer/JStreamBookTest.java (94%) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/BatchCompileAction.java b/designer-base/src/main/java/com/fr/design/actions/file/BatchCompileAction.java index 9fd492628..812d89e5f 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/BatchCompileAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/BatchCompileAction.java @@ -4,7 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.locale.InterProviderFactory; -import com.fr.plugin.designer.transform.ui.BatchTransformPane; +import com.fr.nx.app.designer.transform.ui.BatchTransformPane; import javax.swing.KeyStroke; import java.awt.Dialog; @@ -18,7 +18,7 @@ public class BatchCompileAction extends UpdateAction { this.setMenuKeySet(COMPILE); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/plugin/designer/transform/batch_transform.png")); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/nx/app/designer/transform/batch_transform.png")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java index 305a26335..358de5774 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java @@ -21,7 +21,7 @@ public class LocalAnalyzerAction extends UpdateAction { this.setMenuKeySet(ANALYZER); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/plugin/designer/transform/analyzer.png")); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/nx/app/designer/transform/analyzer.png")); } @Override diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java index 53fe50441..e0515fe81 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java @@ -48,8 +48,8 @@ public class FileTreeIcon { public static final Icon MODERN_CHT_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/modern_style_cht_file_icon_16x16.png"); - public static final Icon CPTX_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/cptx_file_icon.png"); - public static final Icon CPTX_LOCKED_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/cptx_file_icon_locked.png"); + public static final Icon CPTX_ICON = BaseUtils.readIcon("/com/fr/nx/app/designer/cptx_file_icon.png"); + public static final Icon CPTX_LOCKED_ICON = BaseUtils.readIcon("/com/fr/nx/app/designer/cptx_file_icon_locked.png"); public static final LockIcon FOLDER_LOCK_ICON = new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/fold.png")); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 3bddf0f48..f558f93fc 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -62,8 +62,8 @@ import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; -import com.fr.plugin.designer.toolbar.CompileAction; -import com.fr.plugin.designer.toolbar.TemplateTransformer; +import com.fr.nx.app.designer.toolbar.CompileAction; +import com.fr.nx.app.designer.toolbar.TemplateTransformer; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java b/designer-base/src/main/java/com/fr/nx/app/designer/cptx/io/DesignReadWritableProvider.java similarity index 92% rename from designer-base/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java rename to designer-base/src/main/java/com/fr/nx/app/designer/cptx/io/DesignReadWritableProvider.java index 60bcab26f..0896e66e9 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/cptx/io/DesignReadWritableProvider.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/cptx/io/DesignReadWritableProvider.java @@ -1,12 +1,11 @@ -package com.fr.plugin.designer.cptx.io; +package com.fr.nx.app.designer.cptx.io; import com.fr.common.annotations.Negative; import com.fr.file.FILE; +import com.fr.nx.app.designer.utils.DesignerCptxFileUtils; import com.fr.nx.cptx.io.handle.impl.AbstractCptxIOProvider; import com.fr.nx.cptx.pack.util.CompiledReportInputStream; import com.fr.nx.cptx.pack.util.CompiledReportOutputStream; -import com.fr.nx.cptx.utils.CptxFileUtils; -import com.fr.plugin.designer.utils.DesignerCptxFileUtils; import java.io.IOException; import java.io.InputStream; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java b/designer-base/src/main/java/com/fr/nx/app/designer/monitor/DesignerMetricRecorder.java similarity index 97% rename from designer-base/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java rename to designer-base/src/main/java/com/fr/nx/app/designer/monitor/DesignerMetricRecorder.java index 8c0ec55f8..0644bd511 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/monitor/DesignerMetricRecorder.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/monitor/DesignerMetricRecorder.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.monitor; +package com.fr.nx.app.designer.monitor; import com.fr.design.mainframe.errorinfo.ErrorInfo; import com.fr.intelli.record.MetricRegistry; @@ -6,7 +6,7 @@ import com.fr.json.JSON; import com.fr.json.JSONFactory; import com.fr.json.JSONObject; import com.fr.message.ErrorMessage; -import com.fr.plugin.designer.toolbar.TransformResult; +import com.fr.nx.app.designer.toolbar.TransformResult; /** * Created by loy on 2021/1/18. diff --git a/designer-base/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/CompileAction.java similarity index 96% rename from designer-base/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java rename to designer-base/src/main/java/com/fr/nx/app/designer/toolbar/CompileAction.java index 6a5b6d2e1..4496ecd9a 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/toolbar/CompileAction.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/CompileAction.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.toolbar; +package com.fr.nx.app.designer.toolbar; import com.fr.base.extension.FileExtension; import com.fr.design.actions.UpdateAction; @@ -11,7 +11,7 @@ import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.general.IOUtils; import com.fr.locale.InterProviderFactory; -import com.fr.plugin.designer.utils.CompileTransformUtil; +import com.fr.nx.app.designer.utils.CompileTransformUtil; import javax.swing.Icon; import javax.swing.JComponent; @@ -29,7 +29,7 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE; * Created by kerry on 2019-10-14 */ public class CompileAction extends UpdateAction { - public static final Icon TRANS_ICON = IOUtils.readIcon("/com/fr/plugin/designer/transform.png"); + public static final Icon TRANS_ICON = IOUtils.readIcon("/com/fr/nx/app/designer/transform.png"); private static final MenuKeySet COMPILE_ATTR = new MenuKeySet() { @Override diff --git a/designer-base/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TemplateTransformer.java similarity index 98% rename from designer-base/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java rename to designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TemplateTransformer.java index 9ce7ec272..6294fa4d8 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/toolbar/TemplateTransformer.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TemplateTransformer.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.toolbar; +package com.fr.nx.app.designer.toolbar; import com.fr.base.extension.FileExtension; import com.fr.design.file.HistoryTemplateListCache; @@ -11,6 +11,7 @@ import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.main.impl.WorkBook; +import com.fr.nx.app.designer.monitor.DesignerMetricRecorder; import com.fr.nx.compile.CompileStatus; import com.fr.nx.compile.ReportCompiler; import com.fr.nx.compile.adapter.LegacyWorkBookAdapter; @@ -19,13 +20,12 @@ import com.fr.nx.cptx.CptxIOManager; import com.fr.nx.cptx.cache.CptxTemplatePool; import com.fr.nx.cptx.entry.CptxTemplate; import com.fr.nx.cptx.io.handle.CptxTemplateHandle; -import com.fr.plugin.designer.cptx.io.DesignReadWritableProvider; +import com.fr.nx.app.designer.cptx.io.DesignReadWritableProvider; import com.fr.nx.cptx.monitor.CompileMonitorHandler; import com.fr.nx.cptx.utils.CptxFileUtils; import com.fr.nx.data.layer.LayerItem; import com.fr.nx.data.layer.LayerProps; import com.fr.nx.template.compile.CompiledReport; -import com.fr.plugin.designer.monitor.DesignerMetricRecorder; import com.fr.stable.StringUtils; import org.jetbrains.annotations.NotNull; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResult.java similarity index 97% rename from designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java rename to designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResult.java index 2fc45e703..9668ec805 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResult.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResult.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.toolbar; +package com.fr.nx.app.designer.toolbar; import com.fr.design.file.TemplateTreePane; import com.fr.design.mainframe.DesignerContext; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResultInfo.java similarity index 97% rename from designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java rename to designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResultInfo.java index 581f440bd..e988e04e7 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/toolbar/TransformResultInfo.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResultInfo.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.toolbar; +package com.fr.nx.app.designer.toolbar; import com.fr.locale.InterProviderFactory; import com.fr.stable.StringUtils; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformProgress.java similarity index 91% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformProgress.java index 25c089941..7b11cd34c 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformProgress.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformProgress.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform; +package com.fr.nx.app.designer.transform; /** * Created by kerry on 2019-12-10 diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformUtil.java similarity index 93% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformUtil.java index 4b12a2b02..aef4eed21 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformUtil.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformUtil.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform; +package com.fr.nx.app.designer.transform; import com.fr.file.filetree.FileNode; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformer.java similarity index 93% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformer.java index 5993dd45c..0f6a76f83 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/BatchTransformer.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformer.java @@ -1,10 +1,10 @@ -package com.fr.plugin.designer.transform; +package com.fr.nx.app.designer.transform; import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.file.filetree.FileNode; import com.fr.plugin.context.PluginContexts; -import com.fr.plugin.designer.toolbar.TransformResultInfo; -import com.fr.plugin.designer.utils.CompileTransformUtil; +import com.fr.nx.app.designer.toolbar.TransformResultInfo; +import com.fr.nx.app.designer.utils.CompileTransformUtil; import java.util.List; import java.util.Map; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/UpdateCallBack.java similarity index 87% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/UpdateCallBack.java index 221abbf0f..85e1a1151 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/UpdateCallBack.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/UpdateCallBack.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform; +package com.fr.nx.app.designer.transform; /** * Created by kerry on 2019-12-10 diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformDialog.java similarity index 97% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformDialog.java index e2287a4f4..75b32cb27 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformDialog.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformDialog.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform.ui; +package com.fr.nx.app.designer.transform.ui; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformPane.java similarity index 98% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformPane.java index 4b77554a1..c11e4e4ad 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/BatchTransformPane.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformPane.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform.ui; +package com.fr.nx.app.designer.transform.ui; import com.fr.base.extension.FileExtension; import com.fr.design.dialog.BasicPane; @@ -17,7 +17,7 @@ import com.fr.file.filetree.FileNode; import com.fr.file.filetree.IOFileNodeFilter; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; -import com.fr.plugin.designer.toolbar.TransformResultInfo; +import com.fr.nx.app.designer.toolbar.TransformResultInfo; import javax.swing.BorderFactory; import javax.swing.JPanel; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/PrepareTransformFileList.java similarity index 96% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/PrepareTransformFileList.java index 30b4960ab..22d6afcfd 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/PrepareTransformFileList.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/PrepareTransformFileList.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform.ui; +package com.fr.nx.app.designer.transform.ui; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; @@ -42,7 +42,7 @@ public class PrepareTransformFileList extends UIList { @Override protected Icon getRightLabelIcon(Object value) { - return BaseUtils.readIcon("/com/fr/plugin/designer/transform/tab_close.png"); + return BaseUtils.readIcon("/com/fr/nx/app/designer/transform/tab_close.png"); } }); this.addMouseListener(getListMouseListener()); diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java similarity index 98% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java index d03f31d10..cbfcd253f 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformFileTree.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform.ui; +package com.fr.nx.app.designer.transform.ui; import com.fr.base.FRContext; import com.fr.base.extension.FileExtension; @@ -9,7 +9,7 @@ import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.remote.ui.tree.FileAuthorityTree; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; -import com.fr.plugin.designer.transform.BatchTransformUtil; +import com.fr.nx.app.designer.transform.BatchTransformUtil; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeCellRenderer; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformPreparePane.java similarity index 95% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformPreparePane.java index db0bf2be8..efbded1b0 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformPreparePane.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformPreparePane.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform.ui; +package com.fr.nx.app.designer.transform.ui; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; @@ -6,9 +6,9 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.file.filetree.FileNode; import com.fr.locale.InterProviderFactory; -import com.fr.plugin.designer.toolbar.TransformResultInfo; -import com.fr.plugin.designer.transform.BatchTransformer; -import com.fr.plugin.designer.transform.UpdateCallBack; +import com.fr.nx.app.designer.toolbar.TransformResultInfo; +import com.fr.nx.app.designer.transform.BatchTransformer; +import com.fr.nx.app.designer.transform.UpdateCallBack; import javax.swing.BorderFactory; import javax.swing.Box; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultList.java similarity index 89% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultList.java index 5e53fee86..83eb53400 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultList.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultList.java @@ -1,11 +1,11 @@ -package com.fr.plugin.designer.transform.ui; +package com.fr.nx.app.designer.transform.ui; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilist.UIList; import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.file.filetree.FileNode; -import com.fr.plugin.designer.toolbar.TransformResultInfo; +import com.fr.nx.app.designer.toolbar.TransformResultInfo; import javax.swing.DefaultListModel; import javax.swing.Icon; @@ -18,9 +18,9 @@ import java.util.Map; */ public class TransformResultList extends UIList { private Map resultMap; - private static final Icon FAILED_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/transform/transform_failed.png"); - private static final Icon SUCCESS_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/transform/transform_success.png"); - private static final Icon UNSUPPORT_ICON = BaseUtils.readIcon("/com/fr/plugin/designer/transform/transform_unsupport.png"); + private static final Icon FAILED_ICON = BaseUtils.readIcon("/com/fr/nx/app/designer/transform/transform_failed.png"); + private static final Icon SUCCESS_ICON = BaseUtils.readIcon("/com/fr/nx/app/designer/transform/transform_success.png"); + private static final Icon UNSUPPORT_ICON = BaseUtils.readIcon("/com/fr/nx/app/designer/transform/transform_unsupport.png"); public TransformResultList() { super(); diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultPane.java similarity index 96% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultPane.java index 531ecad02..6bed5aafc 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/TransformResultPane.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultPane.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform.ui; +package com.fr.nx.app.designer.transform.ui; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; @@ -7,8 +7,8 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; import com.fr.locale.InterProviderFactory; -import com.fr.plugin.designer.toolbar.TransformResult; -import com.fr.plugin.designer.toolbar.TransformResultInfo; +import com.fr.nx.app.designer.toolbar.TransformResult; +import com.fr.nx.app.designer.toolbar.TransformResultInfo; import javax.swing.BorderFactory; import javax.swing.JPanel; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UIListControlCellRenderer.java similarity index 98% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UIListControlCellRenderer.java index 796ae62ea..47f677238 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UIListControlCellRenderer.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UIListControlCellRenderer.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform.ui; +package com.fr.nx.app.designer.transform.ui; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressDialog.java similarity index 95% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressDialog.java index a980dd822..6d9bb009b 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressDialog.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressDialog.java @@ -1,10 +1,10 @@ -package com.fr.plugin.designer.transform.ui; +package com.fr.nx.app.designer.transform.ui; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.locale.InterProviderFactory; -import com.fr.plugin.designer.transform.BatchTransformer; +import com.fr.nx.app.designer.transform.BatchTransformer; import javax.swing.JDialog; import javax.swing.JPanel; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressPane.java similarity index 91% rename from designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java rename to designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressPane.java index ad5296cc5..5fb57c369 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/transform/ui/UpdateProgressPane.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressPane.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform.ui; +package com.fr.nx.app.designer.transform.ui; import com.fr.base.BaseUtils; @@ -8,7 +8,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.ComparatorUtils; import com.fr.locale.InterProviderFactory; -import com.fr.plugin.designer.transform.UpdateCallBack; +import com.fr.nx.app.designer.transform.UpdateCallBack; import com.sun.java.swing.plaf.motif.MotifProgressBarUI; import javax.swing.BorderFactory; @@ -32,7 +32,7 @@ public class UpdateProgressPane extends BasicPane implements UpdateCallBack { private void initPane() { this.setPreferredSize(new Dimension(262, 60)); - UILabel icon = new UILabel(BaseUtils.readIcon("/com/fr/plugin/designer/transform/transforming.png")); + UILabel icon = new UILabel(BaseUtils.readIcon("/com/fr/nx/app/designer/transform/transforming.png")); icon.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); this.add(icon, BorderLayout.WEST); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); diff --git a/designer-base/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CompileTransformUtil.java similarity index 90% rename from designer-base/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java rename to designer-base/src/main/java/com/fr/nx/app/designer/utils/CompileTransformUtil.java index 564adc6c7..3de788cd1 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/utils/CompileTransformUtil.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CompileTransformUtil.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.utils; +package com.fr.nx.app.designer.utils; import com.fr.design.mainframe.JTemplate; import com.fr.file.FILE; @@ -6,9 +6,9 @@ import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.main.impl.WorkBook; -import com.fr.plugin.designer.toolbar.TemplateTransformer; -import com.fr.plugin.designer.toolbar.TransformResult; -import com.fr.plugin.designer.toolbar.TransformResultInfo; +import com.fr.nx.app.designer.toolbar.TemplateTransformer; +import com.fr.nx.app.designer.toolbar.TransformResult; +import com.fr.nx.app.designer.toolbar.TransformResultInfo; import com.fr.workspace.WorkContext; import java.io.InputStream; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java b/designer-base/src/main/java/com/fr/nx/app/designer/utils/DesignerCptxFileUtils.java similarity index 94% rename from designer-base/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java rename to designer-base/src/main/java/com/fr/nx/app/designer/utils/DesignerCptxFileUtils.java index 9578a0491..a51e04768 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/utils/DesignerCptxFileUtils.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/utils/DesignerCptxFileUtils.java @@ -1,11 +1,11 @@ -package com.fr.plugin.designer.utils; +package com.fr.nx.app.designer.utils; import com.fr.file.FILE; import com.fr.general.CommonIOUtils; import com.fr.log.FineLoggerFactory; import com.fr.main.impl.WorkBook; -import com.fr.marshal.impl.xml.DefaultXMLObjectUnmarshaler; -import com.fr.marshal.util.MarshalUtil; +import com.fr.nx.marshal.impl.xml.DefaultXMLObjectUnmarshaler; +import com.fr.nx.marshal.util.MarshalUtil; import com.fr.nx.cptx.entry.metadata.CptxMetadata; import com.fr.nx.cptx.io.handle.impl.OriginCptProvider; import com.fr.nx.cptx.marshal.util.CptxMarshalUtil; diff --git a/designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerDebugTest.java similarity index 97% rename from designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java rename to designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerDebugTest.java index 9010e0d6a..6a8f8247b 100644 --- a/designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerDebugTest.java +++ b/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerDebugTest.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.toolbar; +package com.fr.nx.app.designer.toolbar; import com.fr.base.Parameter; import com.fr.base.chart.BaseChartCollection; @@ -20,6 +20,7 @@ import com.fr.form.main.FormHyperlink; import com.fr.form.main.parameter.FormParameterUI; import com.fr.form.parameter.FormSubmitButton; import com.fr.form.plugin.DefaultSwitcherImpl; +import com.fr.general.xml.GeneralXMLTools; import com.fr.io.EncryptUtils; import com.fr.js.FormHyperlinkProvider; import com.fr.main.impl.WorkBook; @@ -119,8 +120,8 @@ public class TemplateTransformerDebugTest { StableFactory.registerXMLDescription(BaseChartCollection.XML_TAG, new ChartCollection()); StableFactory.registerXMLDescription(Parameter.XML_TAG, new Parameter()); FineRuntime.start(); - EssentialUtils.registerObjectTokenizer(new ReportXMLUtils.ReportObjectTokenizer()); - EssentialUtils.registerObjectXMLWriterFinder(new ReportXMLUtils.ReportObjectXMLWriterFinder()); + GeneralXMLTools.Object_Tokenizer = new ReportXMLUtils.ReportObjectTokenizer(); + GeneralXMLTools.Object_XML_Writer_Finder = new ReportXMLUtils.ReportObjectXMLWriterFinder(); DaoContext.setEntityDao(new LocalEntityDao()); DaoContext.setClassHelperDao(new LocalClassHelperDao()); DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); diff --git a/designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerTest.java similarity index 93% rename from designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java rename to designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerTest.java index babf65c34..e0afe9313 100644 --- a/designer-base/src/test/java/com/fr/plugin/designer/toolbar/TemplateTransformerTest.java +++ b/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerTest.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.toolbar; +package com.fr.nx.app.designer.toolbar; import com.fr.base.FRContext; import com.fr.base.operator.common.CommonOperator; @@ -14,9 +14,9 @@ import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import static com.fr.plugin.designer.toolbar.TemplateTransformer.OTHER; -import static com.fr.plugin.designer.toolbar.TemplateTransformer.TO_CPT; -import static com.fr.plugin.designer.toolbar.TemplateTransformer.TO_CPTX; +import static com.fr.nx.app.designer.toolbar.TemplateTransformer.OTHER; +import static com.fr.nx.app.designer.toolbar.TemplateTransformer.TO_CPT; +import static com.fr.nx.app.designer.toolbar.TemplateTransformer.TO_CPTX; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; diff --git a/designer-base/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TransformResultInfoTest.java similarity index 97% rename from designer-base/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java rename to designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TransformResultInfoTest.java index 362729278..66a32b95f 100644 --- a/designer-base/src/test/java/com/fr/plugin/designer/toolbar/TransformResultInfoTest.java +++ b/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TransformResultInfoTest.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.toolbar; +package com.fr.nx.app.designer.toolbar; import com.fr.locale.InterProviderFactory; import org.junit.Assert; diff --git a/designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformProgressTest.java similarity index 95% rename from designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java rename to designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformProgressTest.java index 43de999ee..c0b68c0ab 100644 --- a/designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformProgressTest.java +++ b/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformProgressTest.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform; +package com.fr.nx.app.designer.transform; import org.junit.Assert; import org.junit.Test; diff --git a/designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformUtilTest.java similarity index 96% rename from designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java rename to designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformUtilTest.java index 56e7c5e3a..b3adc1246 100644 --- a/designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformUtilTest.java +++ b/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformUtilTest.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform; +package com.fr.nx.app.designer.transform; import com.fr.file.filetree.FileNode; import org.junit.Assert; diff --git a/designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformerTest.java similarity index 99% rename from designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java rename to designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformerTest.java index ef272b434..d29d3e742 100644 --- a/designer-base/src/test/java/com/fr/plugin/designer/transform/BatchTransformerTest.java +++ b/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformerTest.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.transform; +package com.fr.nx.app.designer.transform; import org.junit.Before; import org.junit.Test; diff --git a/designer-base/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/utils/CompileTransformUtilTest.java similarity index 96% rename from designer-base/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java rename to designer-base/src/test/java/com/fr/nx/app/designer/utils/CompileTransformUtilTest.java index 9b67f5532..653bbdef2 100644 --- a/designer-base/src/test/java/com/fr/plugin/designer/utils/CompileTransformUtilTest.java +++ b/designer-base/src/test/java/com/fr/nx/app/designer/utils/CompileTransformUtilTest.java @@ -1,11 +1,11 @@ -package com.fr.plugin.designer.utils; +package com.fr.nx.app.designer.utils; import com.fr.base.FRContext; import com.fr.base.operator.common.CommonOperator; import com.fr.design.mainframe.JTemplate; import com.fr.file.FILE; import com.fr.file.filetree.FileNodes; -import com.fr.plugin.designer.toolbar.TemplateTransformer; +import com.fr.nx.app.designer.toolbar.TemplateTransformer; import org.easymock.EasyMock; import org.junit.Assert; import org.junit.Test; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java index 7cc912518..23ddcbe8a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java @@ -4,7 +4,7 @@ import com.fr.design.mainframe.App; import com.fr.design.mainframe.JTemplateFactory; import com.fr.module.Activator; import com.fr.module.extension.Prepare; -import com.fr.plugin.designer.CptxApp; +import com.fr.nx.app.designer.CptxApp; import java.util.List; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java index 13c288f92..e9af09a4e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java @@ -7,6 +7,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.ui.util.UIUtil; import com.fr.event.EventDispatcher; +import com.fr.nx.app.designer.cell.CellTreeAttrPanelProvider; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; @@ -19,7 +20,10 @@ import java.awt.BorderLayout; import java.awt.Component; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedHashSet; import java.util.List; +import java.util.Optional; import java.util.Set; import static com.fr.plugin.observer.PluginEventType.AfterRun; @@ -114,14 +118,14 @@ public class CellExpandExtraAttrPane extends JPanel { extras = new ArrayList<>(); } extras.clear(); - Set attrProviders = ExtraDesignClassManager.getInstance().getArray(CellExpandAttrPanelProvider.MARK_STRING); - if (attrProviders != null) { - for (CellExpandAttrPanelProvider attrProvider : attrProviders) { - if (attrProvider.isDisplayable()) { - BasicBeanPane extra = attrProvider.createPanel(); - if (extra != null) { - extras.add(extra); - } + Set attrProviders = new LinkedHashSet<>(Collections.singletonList(new CellTreeAttrPanelProvider())); + Optional.>of(ExtraDesignClassManager.getInstance().getArray(CellExpandAttrPanelProvider.MARK_STRING)) + .ifPresent(attrProviders::addAll); + for (CellExpandAttrPanelProvider attrProvider : attrProviders) { + if (attrProvider.isDisplayable()) { + BasicBeanPane extra = attrProvider.createPanel(); + if (extra != null) { + extras.add(extra); } } } diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/CptxApp.java b/designer-realize/src/main/java/com/fr/nx/app/designer/CptxApp.java similarity index 93% rename from designer-realize/src/main/java/com/fr/plugin/designer/CptxApp.java rename to designer-realize/src/main/java/com/fr/nx/app/designer/CptxApp.java index df1d672a3..9186a6734 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/CptxApp.java +++ b/designer-realize/src/main/java/com/fr/nx/app/designer/CptxApp.java @@ -1,11 +1,11 @@ -package com.fr.plugin.designer; +package com.fr.nx.app.designer; import com.fr.base.extension.FileExtension; import com.fr.design.mainframe.AbstractAppProvider; import com.fr.design.mainframe.JTemplate; import com.fr.file.FILE; import com.fr.main.impl.WorkBook; -import com.fr.plugin.designer.utils.DesignerCptxFileUtils; +import com.fr.nx.app.designer.utils.DesignerCptxFileUtils; /** * 支持设计器打开cptx文件 diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/JStreamBook.java b/designer-realize/src/main/java/com/fr/nx/app/designer/JStreamBook.java similarity index 92% rename from designer-realize/src/main/java/com/fr/plugin/designer/JStreamBook.java rename to designer-realize/src/main/java/com/fr/nx/app/designer/JStreamBook.java index abb413c88..2fa748f95 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/JStreamBook.java +++ b/designer-realize/src/main/java/com/fr/nx/app/designer/JStreamBook.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer; +package com.fr.nx.app.designer; import com.fr.base.extension.FileExtension; import com.fr.design.actions.file.export.CSVExportAction; @@ -14,12 +14,12 @@ import com.fr.general.ComparatorUtils; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.main.impl.WorkBook; +import com.fr.nx.app.designer.utils.DesignerCptxFileUtils; import com.fr.nx.cptx.entry.metadata.CptxMetadata; -import com.fr.plugin.designer.menu.CalculateAttrAction; -import com.fr.plugin.designer.toolbar.TemplateTransformer; -import com.fr.plugin.designer.toolbar.TransformResult; -import com.fr.plugin.designer.toolbar.TransformResultInfo; -import com.fr.plugin.designer.utils.DesignerCptxFileUtils; +import com.fr.nx.app.designer.menu.CalculateAttrAction; +import com.fr.nx.app.designer.toolbar.TemplateTransformer; +import com.fr.nx.app.designer.toolbar.TransformResult; +import com.fr.nx.app.designer.toolbar.TransformResultInfo; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.third.jodd.util.ArraysUtil; diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/StartupAssist.java b/designer-realize/src/main/java/com/fr/nx/app/designer/StartupAssist.java similarity index 98% rename from designer-realize/src/main/java/com/fr/plugin/designer/StartupAssist.java rename to designer-realize/src/main/java/com/fr/nx/app/designer/StartupAssist.java index 83e499d1d..be4d9ddc8 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/StartupAssist.java +++ b/designer-realize/src/main/java/com/fr/nx/app/designer/StartupAssist.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer; +package com.fr.nx.app.designer; import com.fr.base.Parameter; import com.fr.base.extension.FileExtension; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java b/designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanel.java similarity index 98% rename from designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java rename to designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanel.java index f6f884306..fcab8a861 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanel.java +++ b/designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanel.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.cell; +package com.fr.nx.app.designer.cell; import com.fr.design.beans.BasicBeanPane; import com.fr.design.event.UIObserverListener; diff --git a/designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java b/designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanelProvider.java similarity index 91% rename from designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java rename to designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanelProvider.java index ec4639a8f..e50e9309a 100644 --- a/designer-base/src/main/java/com/fr/plugin/designer/cell/CellTreeAttrPanelProvider.java +++ b/designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanelProvider.java @@ -1,10 +1,10 @@ -package com.fr.plugin.designer.cell; +package com.fr.nx.app.designer.cell; import com.fr.design.beans.BasicBeanPane; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.impl.AbstractCellExpandAttrPanelProvider; import com.fr.design.mainframe.JTemplate; -import com.fr.plugin.designer.JStreamBook; +import com.fr.nx.app.designer.JStreamBook; import com.fr.report.cell.TemplateCellElement; /** diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrAction.java b/designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrAction.java similarity index 96% rename from designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrAction.java rename to designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrAction.java index 37667220d..d318f725a 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrAction.java +++ b/designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrAction.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.menu; +package com.fr.nx.app.designer.menu; import com.fr.base.BaseUtils; import com.fr.design.actions.JTemplateAction; @@ -9,8 +9,8 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.MenuKeySet; import com.fr.locale.InterProviderFactory; import com.fr.main.impl.WorkBook; +import com.fr.nx.app.designer.JStreamBook; import com.fr.plugin.attr.CalculatorAttrMark; -import com.fr.plugin.designer.JStreamBook; import javax.swing.KeyStroke; import java.awt.event.ActionEvent; diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrPane.java b/designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrPane.java similarity index 98% rename from designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrPane.java rename to designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrPane.java index 2fe5f793f..a0f53c938 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/menu/CalculateAttrPane.java +++ b/designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrPane.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.menu; +package com.fr.nx.app.designer.menu; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; @@ -9,10 +9,10 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.locale.InterProviderFactory; +import com.fr.nx.app.designer.menu.bean.FeatureFlagBean; import com.fr.nx.feature.FeatureFlags; import com.fr.nx.feature.FeatureManager; import com.fr.plugin.attr.CalculatorAttrMark; -import com.fr.plugin.designer.menu.bean.FeatureFlagBean; import javax.swing.BorderFactory; import javax.swing.BoxLayout; diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/FeatureFlagsPanel.java b/designer-realize/src/main/java/com/fr/nx/app/designer/menu/FeatureFlagsPanel.java similarity index 96% rename from designer-realize/src/main/java/com/fr/plugin/designer/menu/FeatureFlagsPanel.java rename to designer-realize/src/main/java/com/fr/nx/app/designer/menu/FeatureFlagsPanel.java index 89aad3306..eaee45551 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/menu/FeatureFlagsPanel.java +++ b/designer-realize/src/main/java/com/fr/nx/app/designer/menu/FeatureFlagsPanel.java @@ -1,12 +1,12 @@ -package com.fr.plugin.designer.menu; +package com.fr.nx.app.designer.menu; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.locale.InterProviderFactory; +import com.fr.nx.app.designer.menu.bean.FeatureFlagBean; import com.fr.nx.feature.FeatureFlag; -import com.fr.plugin.designer.menu.bean.FeatureFlagBean; import com.fr.stable.collections.combination.Pair; import javax.swing.BorderFactory; diff --git a/designer-realize/src/main/java/com/fr/plugin/designer/menu/bean/FeatureFlagBean.java b/designer-realize/src/main/java/com/fr/nx/app/designer/menu/bean/FeatureFlagBean.java similarity index 96% rename from designer-realize/src/main/java/com/fr/plugin/designer/menu/bean/FeatureFlagBean.java rename to designer-realize/src/main/java/com/fr/nx/app/designer/menu/bean/FeatureFlagBean.java index a8de87323..4410d266d 100644 --- a/designer-realize/src/main/java/com/fr/plugin/designer/menu/bean/FeatureFlagBean.java +++ b/designer-realize/src/main/java/com/fr/nx/app/designer/menu/bean/FeatureFlagBean.java @@ -1,4 +1,4 @@ -package com.fr.plugin.designer.menu.bean; +package com.fr.nx.app.designer.menu.bean; import com.fr.nx.feature.FeatureFlag; import com.fr.nx.feature.FeatureManager; diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/CptxAppTest.java b/designer-realize/src/test/java/com/fr/nx/app/designer/CptxAppTest.java similarity index 94% rename from designer-realize/src/test/java/com/fr/plugin/designer/CptxAppTest.java rename to designer-realize/src/test/java/com/fr/nx/app/designer/CptxAppTest.java index 8fae48cac..831400793 100644 --- a/designer-realize/src/test/java/com/fr/plugin/designer/CptxAppTest.java +++ b/designer-realize/src/test/java/com/fr/nx/app/designer/CptxAppTest.java @@ -1,10 +1,10 @@ -package com.fr.plugin.designer; +package com.fr.nx.app.designer; import com.fr.file.AbstractFILE; import com.fr.file.FILE; import com.fr.main.impl.WorkBook; +import com.fr.nx.app.designer.utils.DesignerCptxFileUtils; import com.fr.nx.cptx.utils.CptxFileUtils; -import com.fr.plugin.designer.utils.DesignerCptxFileUtils; import org.easymock.EasyMock; import org.junit.Assert; import org.junit.FixMethodOrder; diff --git a/designer-realize/src/test/java/com/fr/plugin/designer/JStreamBookTest.java b/designer-realize/src/test/java/com/fr/nx/app/designer/JStreamBookTest.java similarity index 94% rename from designer-realize/src/test/java/com/fr/plugin/designer/JStreamBookTest.java rename to designer-realize/src/test/java/com/fr/nx/app/designer/JStreamBookTest.java index b7fa4a87f..236096f0d 100644 --- a/designer-realize/src/test/java/com/fr/plugin/designer/JStreamBookTest.java +++ b/designer-realize/src/test/java/com/fr/nx/app/designer/JStreamBookTest.java @@ -1,10 +1,10 @@ -package com.fr.plugin.designer; +package com.fr.nx.app.designer; import com.fr.file.FILE; import com.fr.main.impl.WorkBook; -import com.fr.plugin.designer.toolbar.TemplateTransformer; -import com.fr.plugin.designer.toolbar.TransformResult; -import com.fr.plugin.designer.toolbar.TransformResultInfo; +import com.fr.nx.app.designer.toolbar.TemplateTransformer; +import com.fr.nx.app.designer.toolbar.TransformResult; +import com.fr.nx.app.designer.toolbar.TransformResultInfo; import org.easymock.EasyMock; import org.easymock.IAnswer; import org.junit.Assert; From 99b2c3f97300055966a4392b6ada641b35fb0d0a Mon Sep 17 00:00:00 2001 From: loy Date: Fri, 29 Jan 2021 10:48:29 +0800 Subject: [PATCH 112/147] =?UTF-8?q?REPORT-46916=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/fr/nx/app/designer/CptxAppTest.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/designer-realize/src/test/java/com/fr/nx/app/designer/CptxAppTest.java b/designer-realize/src/test/java/com/fr/nx/app/designer/CptxAppTest.java index 831400793..26ca454c5 100644 --- a/designer-realize/src/test/java/com/fr/nx/app/designer/CptxAppTest.java +++ b/designer-realize/src/test/java/com/fr/nx/app/designer/CptxAppTest.java @@ -4,7 +4,6 @@ import com.fr.file.AbstractFILE; import com.fr.file.FILE; import com.fr.main.impl.WorkBook; import com.fr.nx.app.designer.utils.DesignerCptxFileUtils; -import com.fr.nx.cptx.utils.CptxFileUtils; import org.easymock.EasyMock; import org.junit.Assert; import org.junit.FixMethodOrder; @@ -22,7 +21,7 @@ import org.powermock.modules.junit4.PowerMockRunnerDelegate; @RunWith(PowerMockRunner.class) @PowerMockRunnerDelegate(JUnit4.class) @PrepareForTest({ - CptxFileUtils.class + DesignerCptxFileUtils.class }) public class CptxAppTest { @@ -35,7 +34,7 @@ public class CptxAppTest { @Test public void testAsIOFile() { - PowerMock.mockStatic(CptxFileUtils.class); + PowerMock.mockStatic(DesignerCptxFileUtils.class); FILE file = new AbstractFILE() { }; WorkBook workBook = new WorkBook(); @@ -43,12 +42,12 @@ public class CptxAppTest { .andReturn(workBook).once() .andReturn(null).once(); - PowerMock.replay(CptxFileUtils.class); + PowerMock.replay(DesignerCptxFileUtils.class); Assert.assertSame(workBook, new CptxApp().asIOFile(file)); Assert.assertNotNull(new CptxApp().asIOFile(file)); - PowerMock.verify(CptxFileUtils.class); + PowerMock.verify(DesignerCptxFileUtils.class); } From ebe3a7fa59e833ff2c7881c76ea4ac2b208f763a Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 29 Jan 2021 13:41:39 +0800 Subject: [PATCH 113/147] =?UTF-8?q?REPORT-47101=20=E6=B5=B7=E5=A4=96?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=80=9A=E8=A1=8C=E8=AF=81=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=93=BE=E6=8E=A5=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/extra/LoginWebBridge.java | 10 ++++- .../com/fr/design/extra/PluginWebBridge.java | 15 +++++-- .../design/locale/impl/BbsRegisterMark.java | 38 ++++++++++++++++++ .../fr/design/locale/impl/BbsResetMark.java | 38 ++++++++++++++++++ .../fr/design/locale/impl/BbsSpaceMark.java | 39 +++++++++++++++++++ .../java/com/fr/design/upm/UpmBridge.java | 15 +++++-- .../design/mainframe/bbs/BBSLoginDialog.java | 12 ++++-- .../design/mainframe/bbs/UserInfoLabel.java | 7 +++- 8 files changed, 159 insertions(+), 15 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java create mode 100644 designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java create mode 100644 designer-base/src/main/java/com/fr/design/locale/impl/BbsSpaceMark.java diff --git a/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java b/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java index 0862c7447..81e34335a 100644 --- a/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java +++ b/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java @@ -6,8 +6,12 @@ import com.fr.config.MarketConfig; import com.fr.design.dialog.UIDialog; import com.fr.design.extra.exe.PluginLoginExecutor; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.locale.impl.BbsRegisterMark; +import com.fr.design.locale.impl.BbsResetMark; import com.fr.general.CloudCenter; import com.fr.general.http.HttpClient; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import javafx.concurrent.Task; @@ -118,7 +122,8 @@ public class LoginWebBridge { */ public void registerHref() { try { - Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register"))); + LocaleMark registerMark = LocaleCenter.getMark(BbsRegisterMark.class); + Desktop.getDesktop().browse(new URI(registerMark.getValue())); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -129,7 +134,8 @@ public class LoginWebBridge { */ public void forgetHref() { try { - Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset"))); + LocaleMark resetMark = LocaleCenter.getMark(BbsResetMark.class); + Desktop.getDesktop().browse(new URI(resetMark.getValue())); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java b/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java index 159e6d6d9..d70901350 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java @@ -13,8 +13,13 @@ 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.gui.ilable.UILabel; +import com.fr.design.locale.impl.BbsRegisterMark; +import com.fr.design.locale.impl.BbsResetMark; +import com.fr.design.locale.impl.BbsSpaceMark; import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.general.CloudCenter; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginMarker; @@ -434,8 +439,8 @@ public class PluginWebBridge { */ public void getPriviteMessage() { try { - String loginUrl = CloudCenter.getInstance().acquireUrlByKind("bbs.default"); - Desktop.getDesktop().browse(new URI(loginUrl)); + LocaleMark spaceMark = LocaleCenter.getMark(BbsSpaceMark.class); + Desktop.getDesktop().browse(new URI(spaceMark.getValue())); } catch (Exception exp) { FineLoggerFactory.getLogger().info(exp.getMessage()); } @@ -497,7 +502,8 @@ public class PluginWebBridge { */ public void registerHref() { try { - Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register"))); + LocaleMark registerMark = LocaleCenter.getMark(BbsRegisterMark.class); + Desktop.getDesktop().browse(new URI(registerMark.getValue())); } catch (Exception e) { FineLoggerFactory.getLogger().info(e.getMessage()); } @@ -511,7 +517,8 @@ public class PluginWebBridge { */ public void forgetHref() { try { - Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset"))); + LocaleMark resetMark = LocaleCenter.getMark(BbsResetMark.class); + Desktop.getDesktop().browse(new URI(resetMark.getValue())); } catch (Exception e) { FineLoggerFactory.getLogger().info(e.getMessage()); } 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 new file mode 100644 index 000000000..d5afe26db --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java @@ -0,0 +1,38 @@ +package com.fr.design.locale.impl; + +import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleMark; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/29 + */ +public class BbsRegisterMark implements LocaleMark { + + private final Map map = new HashMap<>(); + private static final String BBS_REGISTER_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.register"); + private static final String BBS_REGISTER_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.register"); + private static final String BBS_REGISTER_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US"); + private static final String BBS_REGISTER_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US"); + private static final String BBS_REGISTER_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US"); + + public BbsRegisterMark() { + map.put(Locale.CHINA, BBS_REGISTER_CN); + map.put(Locale.KOREA, BBS_REGISTER_KR); + map.put(Locale.JAPAN, BBS_REGISTER_JP); + map.put(Locale.US, BBS_REGISTER_EN); + map.put(Locale.TAIWAN, BBS_REGISTER_TW); + } + + @Override + public String getValue() { + String result = map.get(GeneralContext.getLocale()); + return result == null ? BBS_REGISTER_EN : result; + } +} 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 new file mode 100644 index 000000000..4573aac3a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java @@ -0,0 +1,38 @@ +package com.fr.design.locale.impl; + +import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleMark; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/29 + */ +public class BbsResetMark implements LocaleMark { + + private final Map map = new HashMap<>(); + private static final String BBS_RESET_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset"); + private static final String BBS_RESET_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.reset"); + private static final String BBS_RESET_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US"); + private static final String BBS_RESET_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US"); + private static final String BBS_RESET_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US"); + + public BbsResetMark() { + map.put(Locale.CHINA, BBS_RESET_CN); + map.put(Locale.KOREA, BBS_RESET_KR); + map.put(Locale.JAPAN, BBS_RESET_JP); + map.put(Locale.US, BBS_RESET_EN); + map.put(Locale.TAIWAN, BBS_RESET_TW); + } + + @Override + public String getValue() { + String result = map.get(GeneralContext.getLocale()); + return result == null ? BBS_RESET_EN : result; + } +} diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/BbsSpaceMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/BbsSpaceMark.java new file mode 100644 index 000000000..2303dc250 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/BbsSpaceMark.java @@ -0,0 +1,39 @@ +package com.fr.design.locale.impl; + +import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleMark; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/29 + */ +public class BbsSpaceMark implements LocaleMark { + + private final Map map = new HashMap<>(); + private static final String BBS_SPACE_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.default"); + private static final String BBS_SPACE_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.default"); + private static final String BBS_SPACE_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US"); + private static final String BBS_SPACE_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US"); + private static final String BBS_SPACE_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US"); + + public BbsSpaceMark() { + map.put(Locale.CHINA, BBS_SPACE_CN); + map.put(Locale.KOREA, BBS_SPACE_KR); + map.put(Locale.JAPAN, BBS_SPACE_JP); + map.put(Locale.US, BBS_SPACE_EN); + map.put(Locale.TAIWAN, BBS_SPACE_TW); + } + + @Override + public String getValue() { + String result = map.get(GeneralContext.getLocale()); + return result == null ? BBS_SPACE_EN : result; + } + +} 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 46bb11b3c..0c25281d5 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 @@ -16,6 +16,9 @@ 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.locale.impl.BbsRegisterMark; +import com.fr.design.locale.impl.BbsResetMark; +import com.fr.design.locale.impl.BbsSpaceMark; import com.fr.design.upm.event.CertificateEvent; import com.fr.design.upm.event.DownloadEvent; import com.fr.design.upm.exec.UpmBrowserExecutor; @@ -23,6 +26,8 @@ import com.fr.design.upm.task.UpmTaskWorker; import com.fr.event.EventDispatcher; import com.fr.general.CloudCenter; import com.fr.general.GeneralUtils; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginMarker; @@ -424,8 +429,8 @@ public class UpmBridge { @JSBridge public void getPriviteMessage() { try { - String loginUrl = CloudCenter.getInstance().acquireUrlByKind("bbs.default"); - Desktop.getDesktop().browse(new URI(loginUrl)); + LocaleMark spaceMark = LocaleCenter.getMark(BbsSpaceMark.class); + Desktop.getDesktop().browse(new URI(spaceMark.getValue())); } catch (Exception exp) { FineLoggerFactory.getLogger().info(exp.getMessage()); } @@ -437,7 +442,8 @@ public class UpmBridge { @JSBridge public void forgetHref() { try { - Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset"))); + LocaleMark resetMark = LocaleCenter.getMark(BbsResetMark.class); + Desktop.getDesktop().browse(new URI(resetMark.getValue())); } catch (Exception e) { FineLoggerFactory.getLogger().info(e.getMessage()); } @@ -449,7 +455,8 @@ public class UpmBridge { @JSBridge public void registerHref() { try { - Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register"))); + LocaleMark registerMark = LocaleCenter.getMark(BbsRegisterMark.class); + Desktop.getDesktop().browse(new URI(registerMark.getValue())); } catch (Exception e) { FineLoggerFactory.getLogger().info(e.getMessage()); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java index b37c048e9..114d2e8a6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java @@ -8,11 +8,15 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ipasswordfield.UIPassWordField; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.locale.impl.BbsRegisterMark; +import com.fr.design.locale.impl.BbsResetMark; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpClient; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import com.fr.log.FineLoggerFactory; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; @@ -65,6 +69,8 @@ public class BBSLoginDialog extends UIDialog { private UILabel tipLabel; private BoxCenterAligmentPane passwordReset; private BoxCenterAligmentPane registerLabel; + private LocaleMark resetMark = LocaleCenter.getMark(BbsResetMark.class); + private LocaleMark registerMark = LocaleCenter.getMark(BbsRegisterMark.class); private KeyListener keyListener = new KeyAdapter() { public void keyPressed(KeyEvent e) { @@ -113,8 +119,8 @@ public class BBSLoginDialog extends UIDialog { nameField = new UITextField(); passField = new UIPassWordField(); loginButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_BBSLogin_Login")); - passwordReset = getURLActionLabel(CloudCenter.getInstance().acquireUrlByKind("bbs.reset")); - registerLabel = getURLActionLabel(CloudCenter.getInstance().acquireUrlByKind("bbs.register")); + passwordReset = getURLActionLabel(resetMark.getValue()); + registerLabel = getURLActionLabel(registerMark.getValue()); loginButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { @@ -311,7 +317,7 @@ public class BBSLoginDialog extends UIDialog { private BoxCenterAligmentPane getURLActionLabel(final String url) { ActionLabel actionLabel = new ActionLabel(url); - if (ComparatorUtils.equals(url, CloudCenter.getInstance().acquireUrlByKind("bbs.reset"))) { + if (ComparatorUtils.equals(url, resetMark.getValue())) { actionLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_BBSLogin_Forgot-Password")); } else { actionLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_BBSLogin_Register_Account")); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java index 4d168557f..92a288254 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java @@ -15,6 +15,7 @@ import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.locale.impl.BbsSpaceMark; import com.fr.design.mainframe.DesignerContext; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.upm.event.CertificateEvent; @@ -27,6 +28,8 @@ import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; import com.fr.general.DateUtils; import com.fr.general.http.HttpClient; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import com.fr.log.FineLoggerFactory; import com.fr.stable.EncodeConstants; import com.fr.stable.StableUtils; @@ -96,8 +99,8 @@ public class UserInfoLabel extends UILabel { public void mousePressed(MouseEvent e) { if (StringUtils.isNotEmpty(userName)) { try { - String loginUrl = CloudCenter.getInstance().acquireUrlByKind("bbs.default"); - Desktop.getDesktop().browse(new URI(loginUrl)); + LocaleMark spaceMark = LocaleCenter.getMark(BbsSpaceMark.class); + Desktop.getDesktop().browse(new URI(spaceMark.getValue())); } catch (Exception exp) { FineLoggerFactory.getLogger().info(exp.getMessage()); } From fe408bb274a6442539f2990548419994d0076507 Mon Sep 17 00:00:00 2001 From: vito Date: Mon, 1 Feb 2021 14:12:17 +0800 Subject: [PATCH 114/147] =?UTF-8?q?REPORT-46779=20=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E7=AC=AC=E4=B8=80=E8=A1=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/icontainer/UIModeControlContainer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java index 73bfa0ef7..1837711cd 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java @@ -166,10 +166,10 @@ public class UIModeControlContainer extends JLayeredPane { } // 拖动的距离,为正值表示往下拖动,为负值表示往上拖动 int deltaY = e.getY(); + toolPaneY += deltaY; if (toolPaneY < 0) { toolPaneY = 0; } - toolPaneY += deltaY; onResize(toolPaneY); refreshContainer(); } @@ -244,7 +244,7 @@ public class UIModeControlContainer extends JLayeredPane { }; protected void onModeChanged() { - //do nothing here + //do nothing here } /** @@ -315,7 +315,7 @@ public class UIModeControlContainer extends JLayeredPane { addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - // do nothing + // do nothing } }); } @@ -340,7 +340,7 @@ public class UIModeControlContainer extends JLayeredPane { @Override public void layoutContainer(Container parent) { - // do nothing + // do nothing } @Override From ac860281bf4fa7521cf258f1f2265d64cdcf5a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 1 Feb 2021 14:33:33 +0800 Subject: [PATCH 115/147] =?UTF-8?q?CHART-18176=20=20=E9=92=BB=E5=8F=96?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=A0=87=E8=AE=B0=E7=82=B9=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/designer/style/series/VanChartMapAnchorMarkerPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java index d34a89b5d..e5040c9df 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java @@ -21,7 +21,7 @@ public class VanChartMapAnchorMarkerPane extends BasicBeanPane Date: Mon, 1 Feb 2021 16:42:24 +0800 Subject: [PATCH 116/147] =?UTF-8?q?REPORT-47797=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=92=8C=E8=BF=9C=E7=A8=8B=E5=B7=A5=E7=A8=8B=E5=88=87=E6=8D=A2?= =?UTF-8?q?=EF=BC=8C=E6=97=A5=E5=BF=97=E6=9C=89=E4=B8=A4=E4=B8=AA=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E6=8A=A5=E9=94=99=20=E3=80=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91=E6=9C=89=E4=BA=9B=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=8F=AA=E7=94=A8=E4=BA=86=5Fnormal=E5=92=8C=5Fselect?= =?UTF-8?q?ed=E4=B8=A4=E7=A7=8D=E5=9B=BE=E6=A0=87=EF=BC=8C=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E4=BD=BF=E7=94=A8=5Fdisabled=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=EF=BC=8C=E4=BD=86=E6=98=AF=E4=B9=8B=E5=89=8D=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=B2=A1=E6=9C=89=E5=AF=B9=E8=B5=84=E6=BA=90=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=AD=98=E5=9C=A8=E8=BF=9B=E8=A1=8C=E5=88=A4=E6=96=AD?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E5=AF=BC=E8=87=B4IOUtils=E4=B8=AD=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97=20=E3=80=90?= =?UTF-8?q?=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=88=A4=E6=96=AD=EF=BC=9B=E6=8A=8A=E9=80=82=E9=85=8D=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E9=80=BB=E8=BE=91=E6=8A=BD=E5=8F=96=E4=B8=80?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/base/svg/IconUtils.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/base/svg/IconUtils.java b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java index 45c11c60c..4b5f1b881 100644 --- a/designer-base/src/main/java/com/fr/base/svg/IconUtils.java +++ b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java @@ -38,9 +38,8 @@ public class IconUtils { if (IOUtils.readResource(resource) != null) { return SVGIcon.readSVGIcon(resource); } - // 适配某些插件里是_normal.png、_selected.png的情况 - String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG); - return IOUtils.readIcon(pngResource); + // 适配插件 + return adjustPluginsPng(resource); } return IOUtils.readIcon(resource); } @@ -48,6 +47,17 @@ public class IconUtils { return readNoSuffixResource(resource, ICON_TYPE_NORMAL); } + /** + * 适配插件中使用_normal.png、_selected.png、_disabled.png的情况 + * @param resource 图片路径 + * @return Icon + */ + private static Icon adjustPluginsPng(String resource) { + String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG); + // 考虑到某些插件可能只会使用三种图标中的一部分,这里做个判断,不然就会因为资源不存在而报错 + return IOUtils.readResource(pngResource) == null ? new ImageIcon() : IOUtils.readIcon(pngResource); + } + /** * 尝试读取不带扩展名的图标,svg优先,其次png,最后gif,都没读到就打印错误日志,返回空白Icon * @param resource 图片路径 From 9f56de62b6d9842a02b4488f1f2f35a138aa03f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 2 Feb 2021 10:26:09 +0800 Subject: [PATCH 117/147] =?UTF-8?q?CHART-18182=20=E6=A8=A1=E7=B3=8A?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E6=96=B9=E6=B3=95=E7=A7=BB=E5=8A=A8=E5=88=B0?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=20&=20CHART-18190=20=E7=82=B9=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E9=80=8F=E6=98=8E=E5=BA=A6=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/chartx/component/MapAreaMatchPane.java | 4 ++-- .../java/com/fr/design/chartx/component/MatchAreaTable.java | 4 ++-- .../main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java index a3e610460..df68c4a43 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java @@ -6,6 +6,7 @@ import com.fr.data.TableDataSource; import com.fr.data.TableDataSourceTailor; import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.NameTableData; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataComboBox; @@ -21,7 +22,6 @@ import com.fr.general.GeneralUtils; import com.fr.general.data.DataModel; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.map.data.MapMatchResult; -import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.script.Calculator; import com.fr.stable.StringUtils; @@ -246,7 +246,7 @@ public class MapAreaMatchPane extends BasicBeanPane { private void populateMatchData(Object[] columnData) { Set geoAreas = matchAreaTable.getItems(); - Map resultMap = ChartGEOJSONHelper.matchAreaList(columnData, geoAreas, matchResultTable.getCustomResult()); + Map resultMap = GEOJSONHelper.getInstance().matchAreaList(columnData, geoAreas, matchResultTable.getCustomResult()); Object[][] data = new Object[resultMap.size()][2]; diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java index 9dd13e77f..4e1297dd3 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java @@ -1,8 +1,8 @@ package com.fr.design.chartx.component; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; import com.fr.design.i18n.Toolkit; import com.fr.general.GeneralUtils; -import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import javax.swing.AbstractCellEditor; import javax.swing.JTable; @@ -88,7 +88,7 @@ public class MatchAreaTable extends JTable { return; } int index = areaNameIndex.get(areaName); - String result = ChartGEOJSONHelper.matchArea(GeneralUtils.objectToString(areaName), items); + String result = GEOJSONHelper.getInstance().matchArea(GeneralUtils.objectToString(areaName), items, new HashMap<>()); getColumnModel().getColumn(1).getCellEditor().stopCellEditing(); this.setValueAt(result, index, 1); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index 2d1cb2304..a2adff77a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java @@ -443,7 +443,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { //不透明度 private JPanel createPointAlphaPane() { - pointAlphaPane = new UINumberDragPane(0, 100); + pointAlphaPane = new UINumberDragPaneWithPercent(0, 100); return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Alpha"), pointAlphaPane); } From 0309c66865c8fc34bf2eb94d612dbf2d405e71be Mon Sep 17 00:00:00 2001 From: abel Date: Tue, 2 Feb 2021 13:33:14 +0800 Subject: [PATCH 118/147] =?UTF-8?q?REPORT-47453=20=E5=92=8C=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E5=95=86=E9=87=8F=E4=B8=80=E4=B8=8B=EF=BC=8C=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E7=BC=96=E8=BE=91=E8=A1=8C=E9=BB=98=E8=AE=A4=E4=B8=8D?= =?UTF-8?q?=E5=BC=80=E5=90=AF=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/webattr/WriteToolBarPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java index 7d878659d..25ba62708 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java @@ -74,7 +74,7 @@ public class WriteToolBarPane extends AbstractEditToolBarPane { northPane.add(GUICoreUtils.createFlowPane(new Component[]{rptShowLocationLabel, centerRadioButton, leftRadioButton}, FlowLayout.LEFT)); colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background") + ":"); - colorBox.setSelected(true); + colorBox.setSelected(false); colorBox.addActionListener(colorListener); colorButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png")); northPane.add(GUICoreUtils.createFlowPane(new Component[]{colorBox, colorButton}, FlowLayout.LEFT)); From 67897e1a2384a3b127b0140c74b2e6badc16a05b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 3 Feb 2021 14:14:09 +0800 Subject: [PATCH 119/147] =?UTF-8?q?CHART-18127=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E5=8F=82=E6=95=B0=E5=88=86=E9=9A=94?= =?UTF-8?q?=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/component/richText/VanChartRichEditorPane.java | 4 +++- .../src/main/resources/com/fr/design/editor/rich_editor.html | 2 +- 2 files changed, 4 insertions(+), 2 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 69c93926c..e1b7a79c4 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 @@ -30,6 +30,8 @@ import java.util.Map; public class VanChartRichEditorPane { + private static final String PARAMS_SPLITTER = "|"; + private static final String NAME_SPACE = "Pool"; private static final String VARIABLE = "data"; @@ -163,7 +165,7 @@ public class VanChartRichEditorPane { if (paramsMap != null) { for (Map.Entry entry : paramsMap.entrySet()) { paramsStr.append(entry.getKey()).append(":").append(entry.getValue()); - paramsStr.append("-"); + paramsStr.append(PARAMS_SPLITTER); } } diff --git a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html index f62d7dbb2..967ff74a0 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html +++ b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html @@ -28,7 +28,7 @@ var getDimensionIds = function (params) { var result = []; - var paramGroup = params.split("-"); + var paramGroup = params.split("|"); for (var i = 0, len = paramGroup.length; i < len; i++) { var [key, value] = paramGroup[i].split(":"); From 2a56160bbc4f47261ca9092c02062f6cf01b351b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 3 Feb 2021 15:42:43 +0800 Subject: [PATCH 120/147] =?UTF-8?q?CHART-18055=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=E6=B1=87=E6=80=BB=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/component/richText/VanChartFieldButton.java | 4 ++-- .../src/main/resources/com/fr/design/editor/rich_editor.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java index 1e76d616c..a9caac791 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java @@ -2,11 +2,11 @@ package com.fr.van.chart.designer.component.richText; import com.fr.base.BaseUtils; import com.fr.data.util.function.DataFunction; -import com.fr.data.util.function.NoneFunction; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.plugin.chart.base.FirstFunction; import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.IntervalTimeFormat; @@ -40,7 +40,7 @@ public class VanChartFieldButton extends JPanel { private UIToggleButton fieldButton; private UIButton addButton; - private DataFunction dataFunction = new NoneFunction(); + private DataFunction dataFunction = new FirstFunction(); public VanChartFieldButton(String fieldName, AttrTooltipFormat format, VanChartFieldListener listener) { this(fieldName, format, false, false, listener); diff --git a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html index 967ff74a0..2b7677f5c 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html +++ b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html @@ -44,7 +44,7 @@ var getInitContent = function (params, initParams, align) { var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); - var paramGroup = params.split("-"); + var paramGroup = params.split("|"); content = ""; From 48bb2f22445a58b09386c67c7b03bc68fcae52ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 3 Feb 2021 18:45:57 +0800 Subject: [PATCH 121/147] =?UTF-8?q?CHART-18182=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/chartx/component/MapAreaMatchPane.java | 4 ++-- .../java/com/fr/design/chartx/component/MatchAreaTable.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java index df68c4a43..58068d10a 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java @@ -6,7 +6,7 @@ import com.fr.data.TableDataSource; import com.fr.data.TableDataSourceTailor; import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.NameTableData; -import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOMatchHelper; import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataComboBox; @@ -246,7 +246,7 @@ public class MapAreaMatchPane extends BasicBeanPane { private void populateMatchData(Object[] columnData) { Set geoAreas = matchAreaTable.getItems(); - Map resultMap = GEOJSONHelper.getInstance().matchAreaList(columnData, geoAreas, matchResultTable.getCustomResult()); + Map resultMap = GEOMatchHelper.getInstance().matchAreaList(columnData, geoAreas, matchResultTable.getCustomResult()); Object[][] data = new Object[resultMap.size()][2]; diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java index 4e1297dd3..cde622464 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java @@ -1,6 +1,6 @@ package com.fr.design.chartx.component; -import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOMatchHelper; import com.fr.design.i18n.Toolkit; import com.fr.general.GeneralUtils; @@ -88,7 +88,7 @@ public class MatchAreaTable extends JTable { return; } int index = areaNameIndex.get(areaName); - String result = GEOJSONHelper.getInstance().matchArea(GeneralUtils.objectToString(areaName), items, new HashMap<>()); + String result = GEOMatchHelper.getInstance().matchArea(GeneralUtils.objectToString(areaName), items, new HashMap<>()); getColumnModel().getColumn(1).getCellEditor().stopCellEditing(); this.setValueAt(result, index, 1); } From dde04792c4447fa4e761a9b427d4a19d02df3a35 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 4 Feb 2021 10:59:36 +0800 Subject: [PATCH 122/147] =?UTF-8?q?REPORT-47034=20FRM=E6=96=B0=E5=89=8D?= =?UTF-8?q?=E7=AB=AF&=E6=96=B0=E8=87=AA=E9=80=82=E5=BA=94=E5=90=88?= =?UTF-8?q?=E5=85=A5=E4=B8=BBJAR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/FormFitAttrAction.java | 83 + .../actions/NewFormMobileAttrAction.java | 115 + .../designer/creator/XWAbsoluteLayout.java | 6 +- .../design/designer/creator/XWFitLayout.java | 4 +- .../fr/design/fit/DesignerUIModeConfig.java | 124 + .../com/fr/design/fit/FitStateCompatible.java | 36 + .../java/com/fr/design/fit/JFormType.java | 133 ++ .../main/java/com/fr/design/fit/NewJForm.java | 285 +++ .../src/main/java/com/fr/design/fit/PX.java | 27 + .../com/fr/design/fit/PXReportLengthUNIT.java | 32 + .../ElementEditorExtendDefinePane.java | 91 + .../FRAbsoluteBodyLayoutExtendDefinePane.java | 161 ++ .../FRAbsoluteLayoutExtendDefinePane.java | 27 + .../attrpane/FRFitLayoutExtendDefinePane.java | 246 ++ .../fit/attrpane/PcFitExpandablePane.java | 107 + .../attrpane/RootDesignExtendDefinePane.java | 303 +++ .../design/fit/common/AdaptiveSwitchUtil.java | 225 ++ .../com/fr/design/fit/common/BaseUtils.java | 1266 ++++++++++ .../design/fit/common/FormDesignerUtil.java | 45 + .../com/fr/design/fit/common/LayoutTool.java | 177 ++ .../fr/design/fit/common/NewFormStyle.java | 2030 +++++++++++++++++ .../com/fr/design/fit/common/PaintUtils.java | 835 +++++++ .../fr/design/fit/common/TemplateTool.java | 214 ++ .../fit/menupane/BrowserFitAttrPane.java | 303 +++ .../design/fit/menupane/FitPreviewPane.java | 76 + .../fr/design/fit/menupane/FitRadioGroup.java | 80 + .../design/fit/menupane/FontRadioGroup.java | 17 + .../design/fit/menupane/FormFitAttrPane.java | 58 + .../fr/design/fit/toolbar/SwitchAction.java | 287 +++ .../fr/design/mainframe/CoverReportPane.java | 4 +- .../com/fr/design/mainframe/FormArea.java | 28 +- .../com/fr/design/mainframe/FormDesigner.java | 3 +- .../fr/design/preview/DeveloperPreview.java | 53 + .../design/preview/FormAdaptivePreview.java | 54 + .../design/form/images/developer_preview.png | Bin 0 -> 542 bytes .../form/images/developer_preview24.png | Bin 0 -> 862 bytes .../fr/design/form/images/icon_form_tab.png | Bin 0 -> 130 bytes .../com/fr/design/form/images/icon_switch.png | Bin 0 -> 304 bytes .../form/images/icon_switch_disable.png | Bin 0 -> 296 bytes .../design/form/images/icon_switch_new_ui.png | Bin 0 -> 413 bytes .../design/form/images/icon_switch_old_ui.png | Bin 0 -> 417 bytes .../com/fr/design/form/images/loading.png | Bin 0 -> 7641 bytes .../columnrow/ColumnRowSizingAction.java | 7 +- .../java/com/fr/design/condition/WHPane.java | 10 +- .../fit/AdaptiveCellElementPainter.java | 27 + .../design/fit/grid/AdaptiveGridListener.java | 123 + .../design/fit/grid/ElementCasePaneUtil.java | 186 ++ .../grid/GridHeaderWithBoundMouseHandler.java | 70 + .../fit/grid/GridLimitColumnMouseHandler.java | 194 ++ .../fit/grid/GridLimitRowMouseHandler.java | 190 ++ .../fit/grid/NewFormDesignerGridUI.java | 190 ++ .../fr/design/mainframe/ElementCasePane.java | 9 +- .../form/FormElementCaseDesigner.java | 4 + .../grid/AbstractGridHeaderMouseHandler.java | 9 +- .../com/fr/grid/DefaultGridUIProcessor.java | 10 +- .../src/main/java/com/fr/grid/GridColumn.java | 27 +- .../com/fr/grid/GridColumnMouseHandler.java | 4 - .../main/java/com/fr/grid/GridColumnUI.java | 7 +- .../src/main/java/com/fr/grid/GridCorner.java | 3 +- .../src/main/java/com/fr/grid/GridHeader.java | 3 +- .../java/com/fr/grid/GridMouseAdapter.java | 3 +- .../src/main/java/com/fr/grid/GridRow.java | 18 +- .../src/main/java/com/fr/grid/GridRowUI.java | 8 +- .../src/main/java/com/fr/grid/GridUtils.java | 5 +- .../fr/start/module/DesignerActivator.java | 15 +- 65 files changed, 8575 insertions(+), 82 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java create mode 100644 designer-form/src/main/java/com/fr/design/actions/NewFormMobileAttrAction.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/DesignerUIModeConfig.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/FitStateCompatible.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/JFormType.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/NewJForm.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/PX.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/PXReportLengthUNIT.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/attrpane/ElementEditorExtendDefinePane.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteBodyLayoutExtendDefinePane.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteLayoutExtendDefinePane.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/attrpane/FRFitLayoutExtendDefinePane.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/attrpane/PcFitExpandablePane.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/attrpane/RootDesignExtendDefinePane.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/common/BaseUtils.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/common/FormDesignerUtil.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/common/LayoutTool.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/common/NewFormStyle.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/common/PaintUtils.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/menupane/BrowserFitAttrPane.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/menupane/FitPreviewPane.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/menupane/FitRadioGroup.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/menupane/FontRadioGroup.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/menupane/FormFitAttrPane.java create mode 100644 designer-form/src/main/java/com/fr/design/fit/toolbar/SwitchAction.java create mode 100644 designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java create mode 100644 designer-form/src/main/java/com/fr/design/preview/FormAdaptivePreview.java create mode 100755 designer-form/src/main/resources/com/fr/design/form/images/developer_preview.png create mode 100755 designer-form/src/main/resources/com/fr/design/form/images/developer_preview24.png create mode 100755 designer-form/src/main/resources/com/fr/design/form/images/icon_form_tab.png create mode 100644 designer-form/src/main/resources/com/fr/design/form/images/icon_switch.png create mode 100755 designer-form/src/main/resources/com/fr/design/form/images/icon_switch_disable.png create mode 100755 designer-form/src/main/resources/com/fr/design/form/images/icon_switch_new_ui.png create mode 100755 designer-form/src/main/resources/com/fr/design/form/images/icon_switch_old_ui.png create mode 100644 designer-form/src/main/resources/com/fr/design/form/images/loading.png create mode 100644 designer-realize/src/main/java/com/fr/design/fit/AdaptiveCellElementPainter.java create mode 100644 designer-realize/src/main/java/com/fr/design/fit/grid/AdaptiveGridListener.java create mode 100644 designer-realize/src/main/java/com/fr/design/fit/grid/ElementCasePaneUtil.java create mode 100644 designer-realize/src/main/java/com/fr/design/fit/grid/GridHeaderWithBoundMouseHandler.java create mode 100644 designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitColumnMouseHandler.java create mode 100644 designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitRowMouseHandler.java create mode 100644 designer-realize/src/main/java/com/fr/design/fit/grid/NewFormDesignerGridUI.java diff --git a/designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java new file mode 100644 index 000000000..2828abef2 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java @@ -0,0 +1,83 @@ +package com.fr.design.actions; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.UIDialog; +import com.fr.design.fit.DesignerUIModeConfig; +import com.fr.design.fit.NewJForm; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.menu.MenuKeySet; +import com.fr.report.fit.FitProvider; +import com.fr.report.fit.ReportFitAttr; + +import javax.swing.KeyStroke; +import java.awt.event.ActionEvent; + +/** + * Created by Administrator on 2015/7/6 0006. + */ +public class FormFitAttrAction extends JTemplateAction { + private static final MenuKeySet REPORT_FIT_ATTR_ELEMENTCASE = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'T'; + } + + @Override + public String getMenuName() { + return DesignerUIModeConfig.getInstance().newUIMode() ? + com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_PC_Adaptive_Attr") : + com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; + + public FormFitAttrAction(JTemplate jTemplate) { + super(jTemplate); + initMenuStyle(); + } + + private void initMenuStyle() { + this.setMenuKeySet(REPORT_FIT_ATTR_ELEMENTCASE); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(DesignerUIModeConfig.getInstance().newUIMode() ? + "/com/fr/design/images/reportfit/fit.png": + "/com/fr/design/images/reportfit/fit"); + } + + /** + * Action触发事件 + * + * @param e 事件 + */ + @Override + public void actionPerformed(ActionEvent e) { + final JTemplate jwb = getEditingComponent(); + if (jwb == null || !(jwb instanceof NewJForm)) { + return; + } + final FitProvider wbTpl = (FitProvider) jwb.getTarget(); + ReportFitAttr fitAttr = wbTpl.getReportFitAttr(); + NewJForm newJForm = (NewJForm) jwb; + BasicBeanPane attrPane = newJForm.getJFormType().obtainAttrPane(newJForm); + showFitDialog(fitAttr, jwb, wbTpl, attrPane); + } + + private void showFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane attrPane) { + attrPane.populateBean(fitAttr); + UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + wbTpl.setReportFitAttr(attrPane.updateBean()); + jwb.fireTargetModified(); + } + }); + dialog.setVisible(true); + } +} diff --git a/designer-form/src/main/java/com/fr/design/actions/NewFormMobileAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/NewFormMobileAttrAction.java new file mode 100644 index 000000000..17ec76b83 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/actions/NewFormMobileAttrAction.java @@ -0,0 +1,115 @@ +package com.fr.design.actions; + + +import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.fit.NewJForm; +import com.fr.design.fit.common.AdaptiveSwitchUtil; +import com.fr.design.fit.common.TemplateTool; +import com.fr.design.form.mobile.FormMobileAttrPane; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.FormArea; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.file.FILE; +import com.fr.form.main.Form; +import com.fr.form.main.mobile.FormMobileAttr; +import com.fr.record.analyzer.EnableMetrics; +import com.fr.stable.StringUtils; + +import java.awt.event.ActionEvent; + +/** + * Created by fanglei on 2016/11/14. + */ +@EnableMetrics +public class NewFormMobileAttrAction extends FormMobileAttrAction { + + public NewFormMobileAttrAction(JForm jf) { + super(jf); + } + + /** + * 执行动作 + * + * @return 是否执行成功 + */ + @Override + public void actionPerformed(ActionEvent e) { + final JForm jf = getEditingComponent(); + if (jf == null) { + return; + } + final Form formTpl = jf.getTarget(); + FormMobileAttr mobileAttr = formTpl.getFormMobileAttr(); + + final FormMobileAttrPane mobileAttrPane = new FormMobileAttrPane(); + mobileAttrPane.populateBean(mobileAttr); + + final boolean oldMobileOnly = mobileAttr.isMobileOnly(); + final boolean oldAdaptive = mobileAttr.isAdaptivePropertyAutoMatch(); + BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + FormMobileAttr formMobileAttr = mobileAttrPane.updateBean(); + if (formMobileAttr.isMobileOnly() && jf.getTarget().getAttrMark(MobileOnlyTemplateAttrMark.XML_TAG) == null) { + // 如果是老模板,选择手机专属之后需要另存为 + FILE editingFILE = jf.getEditingFILE(); + if (editingFILE != null && editingFILE.exists()) { + String fileName = editingFILE.getName().substring(0, editingFILE.getName().length() - jf.suffix().length()) + "_mobile"; + if (!jf.saveAsTemplate(true, fileName)) { + return; + } + } + // 放到后面。如果提前 return 了,则仍然处于未设置状态,不要添加 + jf.getTarget().addAttrMark(new MobileOnlyTemplateAttrMark()); + } + // 设置移动端属性并刷新界面 + formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 + boolean changeSize = (!oldMobileOnly && formMobileAttr.isMobileOnly()) || (oldMobileOnly && !formMobileAttr.isMobileOnly()); + if (changeSize) { + ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); + } + //改变布局为自适应布局,只在移动端属性设置保存后改变一次 + boolean changeLayout = !oldAdaptive && formMobileAttr.isAdaptivePropertyAutoMatch(); + if (changeLayout) { + jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); + doChangeBodyLayout(); + WidgetPropertyPane.getInstance().refreshDockingView(); + } + jf.fireTargetModified(); + FILE editingFILE = jf.getEditingFILE(); + if(editingFILE != null && editingFILE.exists()){ + JForm jForm = getEditingComponent(); + TemplateTool.saveForm(jForm); + if (jForm instanceof NewJForm) { + AdaptiveSwitchUtil.switch2OldUI(); + } + }else { + AdaptiveSwitchUtil.switch2OldUIMode(); + NewJForm mobileJForm = new NewJForm(jf.getTarget(), jf.getEditingFILE()); + //设置临时的id,和新建的模板区分 + mobileJForm.getTarget().setTemplateID(StringUtils.EMPTY); + TemplateTool.resetTabPaneEditingTemplate(mobileJForm); + TemplateTool.activeAndResizeTemplate(mobileJForm); + } + } + }); + dialog.setVisible(true); + } + + private void doChangeBodyLayout(){ + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + XLayoutContainer rootLayout = formDesigner.getRootComponent(); + if (rootLayout.getComponentCount() == 1 && rootLayout.getXCreator(0).acceptType(XWAbsoluteBodyLayout.class)) { + rootLayout = (XWAbsoluteBodyLayout) rootLayout.getXCreator(0); + } + ((XWFitLayout)formDesigner.getRootComponent()).switch2FitBodyLayout(rootLayout); + } +} + 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 da268b0e6..86d9366de 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 @@ -14,6 +14,7 @@ import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI; +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.form.layout.FRAbsoluteLayout; import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.XCreatorConstants; @@ -30,7 +31,6 @@ import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WLayout; -import com.fr.general.FRScreen; import com.fr.general.IOUtils; import com.fr.share.ShareConstants; @@ -111,7 +111,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { private void initPercent(WAbsoluteLayout widget) { Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension scrnsize = toolkit.getScreenSize(); - double screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue(); + double screenValue = DesignerUIModeConfig.getInstance().getDesignScreenByDimension(scrnsize).getValue(); if (!AssistUtils.equals(screenValue, FormArea.DEFAULT_SLIDER)) { this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); } @@ -247,7 +247,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { */ @Override public void updateChildBound(int minHeight) { - double prevContainerPercent = FRScreen.getDesignScreenByDimension(toData().getDesigningResolution()).getValue() / FormArea.DEFAULT_SLIDER; + double prevContainerPercent = DesignerUIModeConfig.getInstance().getDesignScreenByDimension(toData().getDesigningResolution()).getValue() / FormArea.DEFAULT_SLIDER; if (toData().getCompState() == 0 && !AssistUtils.equals(containerPercent, prevContainerPercent)) { for (int i = 0; i < this.getComponentCount(); i++) { XCreator creator = getXCreator(i); 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 6d55c658f..450dfeae3 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 @@ -6,6 +6,7 @@ import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.properties.mobile.BodyMobilePropertyUI; +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.form.layout.FRFitLayout; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.mainframe.FormArea; @@ -20,7 +21,6 @@ import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WLayout; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; -import com.fr.general.FRScreen; import com.fr.stable.ArrayUtils; import com.fr.stable.AssistUtils; import javax.swing.JOptionPane; @@ -72,7 +72,7 @@ public class XWFitLayout extends XLayoutContainer { private void initPercent(){ Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension scrnsize = toolkit.getScreenSize(); - double screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue(); + double screenValue = DesignerUIModeConfig.getInstance().getDesignScreenByDimension(scrnsize).getValue(); if (!AssistUtils.equals(FormArea.DEFAULT_SLIDER, screenValue)) { this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); } diff --git a/designer-form/src/main/java/com/fr/design/fit/DesignerUIModeConfig.java b/designer-form/src/main/java/com/fr/design/fit/DesignerUIModeConfig.java new file mode 100644 index 000000000..5e743d383 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/DesignerUIModeConfig.java @@ -0,0 +1,124 @@ +package com.fr.design.fit; + +import com.fr.base.ScreenResolution; +import com.fr.design.fun.ReportLengthUNITProvider; +import com.fr.design.unit.UnitConvertUtil; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRScreen; +import com.fr.stable.Constants; + +import java.awt.Dimension; + +/** + * Created by kerry on 2020-06-05 + */ +public class DesignerUIModeConfig { + private DesignerUIMode mode = DesignerUIMode.NEW_UI_MODE; + + private static class DesignerUIModeConfigHolder { + private static final DesignerUIModeConfig designerUIModeConfig = new DesignerUIModeConfig(); + } + + private DesignerUIModeConfig() { + + } + + public static DesignerUIModeConfig getInstance() { + return DesignerUIModeConfigHolder.designerUIModeConfig; + } + + + /** + * 判断是否是新ui模式 + * + * @return boolean + */ + public boolean newUIMode() { + return ComparatorUtils.equals(DesignerUIMode.NEW_UI_MODE, mode); + } + + /** + * 设置新ui模式 + */ + public void setNewUIMode() { + this.mode = DesignerUIMode.NEW_UI_MODE; + } + + /** + * 设置老ui模式 + */ + public void setOldUIMode() { + this.mode = DesignerUIMode.OLD_UI_MODE; + } + + /** + * 解析不同模式下的尺寸单位 + * + * @param unitType 尺寸类型 + * @return ReportLengthUNITProvider对象 + */ + public ReportLengthUNITProvider parseLengthUNIT(int unitType) { + return mode.parseLengthUNIT(unitType); + } + + /** + * 获取不同模式下的屏幕分辨率 + * + * @return 分辨率 + */ + public int getScreenResolution() { + return mode.getScreenResolution(); + } + + /** + * 根据屏幕尺寸获取设计时的FRScreen + * + * @param screen 屏幕尺寸 + * @return FRScreen + */ + public FRScreen getDesignScreenByDimension(Dimension screen) { + return mode.getDesignScreenByDimension(screen); + } + + private enum DesignerUIMode { + OLD_UI_MODE { + @Override + protected ReportLengthUNITProvider parseLengthUNIT(int unitType) { + return UnitConvertUtil.parseLengthUNIT(unitType); + } + + @Override + protected FRScreen getDesignScreenByDimension(Dimension screen) { + return FRScreen.getDesignScreenByDimension(screen); + } + + @Override + protected int getScreenResolution() { + return ScreenResolution.getScreenResolution(); + } + }, + NEW_UI_MODE { + @Override + protected ReportLengthUNITProvider parseLengthUNIT(int unitType) { + return new PXReportLengthUNIT(); + } + + @Override + protected FRScreen getDesignScreenByDimension(Dimension screen) { + return FRScreen.p1440; + } + + @Override + protected int getScreenResolution() { + return Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION; + } + }; + + protected abstract ReportLengthUNITProvider parseLengthUNIT(int unitType); + + protected abstract FRScreen getDesignScreenByDimension(Dimension screen); + + protected abstract int getScreenResolution(); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/fit/FitStateCompatible.java b/designer-form/src/main/java/com/fr/design/fit/FitStateCompatible.java new file mode 100644 index 000000000..06934e98e --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/FitStateCompatible.java @@ -0,0 +1,36 @@ +package com.fr.design.fit; + +/** + * Created by kerry on 2020-04-27 + */ +public enum FitStateCompatible { + DOUBLE_FIT(2, 0), + HOR_FIT(1, 1), + NO_FIT(3, 2); + + private final int newType; + private final int oldType; + + FitStateCompatible(int oldType, int newType) { + this.oldType = oldType; + this.newType = newType; + } + + public static int getNewTypeFromOld(int oldValue) { + for (FitStateCompatible compatible : values()) { + if (compatible.oldType == oldValue) { + return compatible.newType; + } + } + return DOUBLE_FIT.newType; + } + + public static int getOldTypeFromNew(int newValue) { + for (FitStateCompatible compatible : values()) { + if (compatible.newType == newValue) { + return compatible.oldType; + } + } + return DOUBLE_FIT.oldType; + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/JFormType.java b/designer-form/src/main/java/com/fr/design/fit/JFormType.java new file mode 100644 index 000000000..7fe795c6f --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/JFormType.java @@ -0,0 +1,133 @@ +package com.fr.design.fit; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fit.common.AdaptiveSwitchUtil; +import com.fr.form.fit.NewFormMarkAttr; +import com.fr.form.fit.config.FormFitConfig; +import com.fr.design.fit.menupane.FormFitAttrPane; +import com.fr.design.fun.PreviewProvider; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.preview.FormAdaptivePreview; +import com.fr.design.preview.FormPreview; +import com.fr.design.report.fit.menupane.ReportFitAttrPane; +import com.fr.form.main.Form; +import com.fr.report.fit.ReportFitAttr; + +public enum JFormType { + OLD_TYPE(0, new FormPreview()) { + @Override + public void switchUI() { + AdaptiveSwitchUtil.switch2OldUI(); + } + + @Override + public void switchUIMode() { + AdaptiveSwitchUtil.switch2OldUIMode(); + } + + @Override + public ReportFitAttr obtainFitAttr() { + return FormFitConfig.getInstance().getOldFitAttr(); + } + + @Override + public void updateFitAttr(ReportFitAttr attr) { + FormFitConfig.getInstance().setOldFitAttr(attr); + } + + @Override + public BasicBeanPane obtainAttrPane(NewJForm newJForm) { + return new ReportFitAttrPane(); + } + + }, + NEW_TYPE(1, new FormAdaptivePreview()) { + @Override + public void switchUI() { + AdaptiveSwitchUtil.switch2NewUI(); + } + + @Override + public void switchUIMode() { + AdaptiveSwitchUtil.switch2NewUIMode(); + } + + @Override + public ReportFitAttr obtainFitAttr() { + return FormFitConfig.getInstance().getNewFitAttr(); + } + + @Override + public void updateFitAttr(ReportFitAttr attr) { + FormFitConfig.getInstance().setNewFitAttr(attr); + } + + @Override + public BasicBeanPane obtainAttrPane(NewJForm newJForm) { + return new FormFitAttrPane(newJForm); + } + }; + private int type; + private boolean newType; + private PreviewProvider previewType; + + JFormType(int type, PreviewProvider previewType) { + this.type = type; + this.newType = (type == 1); + this.previewType = previewType; + } + + public int getType() { + return type; + } + + public boolean isNewType() { + return newType; + } + + public PreviewProvider getPreviewType() { + return previewType; + } + + public abstract void switchUI(); + + public abstract void switchUIMode(); + + public abstract ReportFitAttr obtainFitAttr(); + + public abstract void updateFitAttr(ReportFitAttr attr); + + public abstract BasicBeanPane obtainAttrPane(NewJForm newJForm); + + /** + * @Description: 更新模板的标志位 + * @param jTemplate + * @return: + * @Author: Henry.Wang + * @date: 2020/12/17 16:17 + */ + public void updateJFromTemplateType(JTemplate jTemplate) { + if (jTemplate instanceof NewJForm) { + NewJForm newJForm = (NewJForm) jTemplate; + Form form = newJForm.getTarget(); + NewFormMarkAttr newFormMarkAttr = form.getAttrMark(NewFormMarkAttr.XML_TAG); + if (newFormMarkAttr == null) { + newFormMarkAttr = new NewFormMarkAttr(this.getType()); + form.addAttrMark(newFormMarkAttr); + } + newFormMarkAttr.setType(this.getType()); + newJForm.setJFormType(this); + } + } + + /** + * @Description: 更新预览方式 + * @param jTemplate + * @return: + * @Author: Henry.Wang + * @date: 2020/12/17 16:17 + */ + public void updatePreviewType(JTemplate jTemplate) { + jTemplate.setPreviewType(this.getPreviewType()); + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java new file mode 100644 index 000000000..4df8b4386 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java @@ -0,0 +1,285 @@ +package com.fr.design.fit; + +import com.fr.base.DynamicUnitList; +import com.fr.design.actions.TemplateParameterAction; +import com.fr.design.designer.beans.AdapterBus; +import com.fr.design.designer.beans.LayoutAdapter; +import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter; +import com.fr.design.designer.beans.events.DesignerEditListener; +import com.fr.design.designer.beans.events.DesignerEvent; +import com.fr.design.designer.creator.*; +import com.fr.design.fit.common.AdaptiveSwitchUtil; +import com.fr.design.fit.common.LayoutTool; +import com.fr.form.fit.NewFormMarkAttr; +import com.fr.design.fit.common.TemplateTool; +import com.fr.design.actions.FormFitAttrAction; +import com.fr.design.actions.NewFormMobileAttrAction; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.preview.DeveloperPreview; +import com.fr.design.preview.FormAdaptivePreview; +import com.fr.design.fit.toolbar.SwitchAction; +import com.fr.design.fun.PreviewProvider; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.menu.ShortCut; +import com.fr.design.preview.FormPreview; +import com.fr.design.preview.MobilePreview; +import com.fr.design.utils.ComponentUtils; +import com.fr.file.FILE; +import com.fr.form.FormElementCaseProvider; +import com.fr.form.main.Form; +import com.fr.form.main.mobile.FormMobileAttr; +import com.fr.form.ui.ElementCaseEditor; +import com.fr.stable.ArrayUtils; + +import javax.swing.JComponent; +import java.awt.Dimension; +import java.awt.Rectangle; + + +/** + * Created by kerry on 2020-05-31 + */ +public class NewJForm extends JForm { + private static final int FUZZY_EDGE = 10; + private static final int TITLE_HEIGHT = 36; + private JFormType jFormType; + + public NewJForm() { + super(); + init(); + changePaneSize(); + } + + public NewJForm(Form form, FILE file) { + super(form, file); + if (DesignerUIModeConfig.getInstance().newUIMode()) { + init(); + } + changePaneSize(); + } + + /** + * @Description:改变body的大小,主要针对新模式下打开老模板出现截断的情况 + * @param + * @return: + * @Author: Henry.Wang + * @date: 2020/9/13 23:23 + */ + private void changePaneSize() { + if (mobileForm()) + return; + NewFormMarkAttr newFormMarkAttr = this.getTarget().getAttrMark(NewFormMarkAttr.XML_TAG); + if (newFormMarkAttr.isNotSetOriginSize()) { + newFormMarkAttr.setBodyHeight(LayoutTool.getBodyHeight(this)); + newFormMarkAttr.setBodyWidth(LayoutTool.getBodyWidth(this)); + return; + } + //这种是针对body为绝对布局时,可能出现截断的情况 + if (LayoutTool.absoluteLayoutForm(this)) { + int bodyHeight = newFormMarkAttr.getBodyHeight(); + int bodyWidth = newFormMarkAttr.getBodyWidth(); + Rectangle rectangle = LayoutTool.getAbsoluteBodySize(this); + if (!isNewJFrom() && (rectangle.width != bodyWidth || rectangle.height != bodyHeight)) { + TemplateTool.onlyChangeAbsoluteBodySize(bodyHeight, bodyWidth, this); + } else if(isNewJFrom()){ + if (rectangle.width > bodyWidth && rectangle.height > bodyHeight) { + TemplateTool.onlyChangeAbsoluteBodySize(rectangle.height, rectangle.width, this); + } else if (rectangle.width > bodyWidth) { + TemplateTool.onlyChangeAbsoluteBodySize(bodyHeight, rectangle.width, this); + } else if (rectangle.height > bodyHeight) { + TemplateTool.onlyChangeAbsoluteBodySize(rectangle.height, bodyWidth, this); + } + } + } else if (AdaptiveSwitchUtil.isSwitchJFromIng()) { + //这种是针对body中有绝对画布块,导致截断的情况 + double scale = LayoutTool.getContainerPercent(); + if (isNewJFrom()) { + LayoutTool.scaleAbsoluteBlockComponentsBounds(this.getFormDesign().getRootComponent(), 1 / scale); + } else { + LayoutTool.scaleAbsoluteBlockComponentsBounds(this.getFormDesign().getRootComponent(), scale); + } + } + } + + public JFormType getJFormType() { + return this.jFormType; + } + + public void setJFormType(JFormType jFormType) { + this.jFormType = jFormType; + } + + + /** + * 模板菜单 + * + * @return 返回菜单 + */ + @Override + public ShortCut[] shortcut4TemplateMenu() { + if (this.index == FORM_TAB) { + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), new FormFitAttrAction(this)}, new ShortCut[0]); + } else { + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), new FormFitAttrAction(this)}, this.getElementCaseDesign().shortcut4TemplateMenu()); + } + } + + + private void init() { + this.getFormDesign().addDesignerEditListener(new DesignerEditListener() { + private Rectangle oldRec; + + @Override + public void fireCreatorModified(DesignerEvent evt) { + if (evt.getAffectedCreator() == null) { + return; + } + if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) { + XComponent affectedCreator = evt.getAffectedCreator(); + if (isElementCase((JComponent) affectedCreator)) { + processAbsorbingEffect((XWTitleLayout) affectedCreator); + } + } + if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { + XComponent affectedCreator = evt.getAffectedCreator(); + oldRec = new Rectangle(affectedCreator.getBounds()); + } + } + + private boolean isElementCase(JComponent component) { + return component.getComponents().length > 0 && component.getComponent(0) instanceof XElementCase; + } + + private void processAbsorbingEffect(XWTitleLayout xwTitleLayout) { + NewJForm.this.getFormDesign().repaint(); + Dimension bound = new Dimension(xwTitleLayout.getSize()); + ElementCaseEditor elementCaseEditor = (ElementCaseEditor) xwTitleLayout.toData().getBodyBoundsWidget().getWidget(); + FormElementCaseProvider elementCase = elementCaseEditor.getElementCase(); + if (oldRec.width != bound.width) { + processColumnAbsorbingEffect(xwTitleLayout, elementCase.getColumnWidthList_DEC(), bound); + oldRec.width = bound.width; + } + if (oldRec.height != bound.height) { + processRowAbsorbingEffect(xwTitleLayout, elementCase.getRowHeightList_DEC(), bound); + oldRec.height = bound.height; + } + NewJForm.this.getFormDesign().refreshDesignerUI(); + } + + private boolean hasTitle(XWTitleLayout xwTitleLayout) { + return xwTitleLayout.getComponentCount() > 1; + } + + private void processColumnAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList columnUnitList, Dimension bound) { + int temp = 0; + int resolution = DesignerUIModeConfig.getInstance().getScreenResolution();; + int difference = 0; + int i = 0; + while (true) { + if (i < columnUnitList.size()) { + temp += columnUnitList.get(i++).toPixI(resolution); + } else { + //在处理吸附效果时,columnUnitList数组长度可能比实际显示的列数少,所以用默认值来补充 + temp += columnUnitList.getDefaultUnit().toPixI(resolution); + } + if (bound.width - temp < 0) { + break; + } + if (bound.width - temp < FUZZY_EDGE) { + difference = bound.width - temp; + bound.width = temp; + break; + } + } + fixLayout(xwTitleLayout, bound, difference, 0); + } + + private void processRowAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList rowUnitList, Dimension bound) { + int temp = hasTitle(xwTitleLayout) ? TITLE_HEIGHT : 0; + int resolution =DesignerUIModeConfig.getInstance().getScreenResolution(); + int difference = 0; + int i = 0; + while (true) { + if (i < rowUnitList.size()) { + temp += rowUnitList.get(i++).toPixI(resolution); + } else { + //在处理吸附效果时,rowUnitList数组长度可能比实际显示的行数少,所以用默认值来补充 + temp += rowUnitList.getDefaultUnit().toPixI(resolution); + } + if (bound.height - temp < 0) { + break; + } + if (bound.height - temp < FUZZY_EDGE) { + difference = bound.height - temp; + bound.height = temp; + break; + } + } + fixLayout(xwTitleLayout, bound, difference, 1); + } + + + private void fixLayout(XWTitleLayout xwTitleLayout, Dimension bound, int difference, int row) { + Rectangle backupBounds = getBound(xwTitleLayout); + xwTitleLayout.setSize(bound); + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + LayoutAdapter adapter = AdapterBus.searchLayoutAdapter(formDesigner, xwTitleLayout); + if (adapter instanceof FRFitLayoutAdapter) { + FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) adapter; + layoutAdapter.setEdit(true); + layoutAdapter.calculateBounds(backupBounds, xwTitleLayout.getBounds(), xwTitleLayout, row, difference); + } + XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xwTitleLayout); + if (parent != null && parent.toData() != null) { + parent.toData().setBounds(xwTitleLayout.toData(), xwTitleLayout.getBounds()); + } + + } + + }); + } + + + public Rectangle getBound(XWTitleLayout creator) { + Rectangle bounds = new Rectangle(creator.getBounds()); + if (creator.getParent() == null) { + return bounds; + } + Rectangle rec = ComponentUtils.getRelativeBounds(creator.getParent()); + bounds.x += rec.x; + bounds.y += rec.y; + return bounds; + + } + + @Override + public PreviewProvider[] supportPreview() { + if (isNewJFrom()) { + return new PreviewProvider[]{new FormAdaptivePreview(), new DeveloperPreview(), new MobilePreview()}; + } + return new PreviewProvider[]{new FormPreview(), new MobilePreview()}; + } + + public boolean mobileForm() { + FormMobileAttr mobileAttr = this.getTarget().getFormMobileAttr(); + if (mobileAttr.isMobileOnly() && mobileAttr.isAdaptivePropertyAutoMatch()) { + return true; + } + return false; + } + + private SwitchAction switchAction; + + public UIButton[] createExtraButtons() { + UIButton[] extraButtons = super.createExtraButtons(); + switchAction = new SwitchAction(); + return ArrayUtils.addAll(extraButtons, new UIButton[]{switchAction.getToolBarButton()}); + } + + + public boolean isNewJFrom() { + return jFormType == null || jFormType.isNewType(); + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/PX.java b/designer-form/src/main/java/com/fr/design/fit/PX.java new file mode 100644 index 000000000..720268ea6 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/PX.java @@ -0,0 +1,27 @@ +package com.fr.design.fit; + +import com.fr.stable.Constants; +import com.fr.stable.unit.LEN_UNIT; + +public class PX extends LEN_UNIT { + private static final long FU_SCALE = 36576L; + + public PX(float var1) { + super(var1); + } + + + public boolean equals(Object var1) { + return var1 instanceof PX && super.equals(var1); + } + + protected long getMoreFUScale() { + int dpi = DesignerUIModeConfig.getInstance().getScreenResolution(); + return FU_SCALE / dpi; + } + + public static double toPixWithResolution(double value, int resolution) { + return value * resolution / Constants.FR_PAINT_RESOLUTION; + } + +} diff --git a/designer-form/src/main/java/com/fr/design/fit/PXReportLengthUNIT.java b/designer-form/src/main/java/com/fr/design/fit/PXReportLengthUNIT.java new file mode 100644 index 000000000..8d8f1de16 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/PXReportLengthUNIT.java @@ -0,0 +1,32 @@ +package com.fr.design.fit; + +import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public class PXReportLengthUNIT extends AbstractReportLengthUNITProvider { + public static final short UNIT_TYPE = 4; + + @Override + public String unitText() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Px"); + } + + @Override + public int unitType() { + return UNIT_TYPE; + } + + @Override + public float unit2Value4Scale(UNIT value) { + int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + return value.toPixF(resolution); + } + + @Override + public UNIT float2UNIT(float value) { + return new PX(value); + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/ElementEditorExtendDefinePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/ElementEditorExtendDefinePane.java new file mode 100644 index 000000000..3d25590f4 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/attrpane/ElementEditorExtendDefinePane.java @@ -0,0 +1,91 @@ +package com.fr.design.fit.attrpane; + +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.design.widget.ui.designer.layout.WTitleLayoutDefinePane; +import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.web.FormToolBarManager; +import com.fr.general.ComparatorUtils; +import com.fr.report.fit.ReportFitAttr; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by kerry on 2020-04-09 + */ +public class ElementEditorExtendDefinePane extends WTitleLayoutDefinePane { + private PaddingBoundPane paddingBoundPane; + private AccessibleElementCaseToolBarEditor elementCaseToolBarEditor; + private PropertyGroupPane extraPropertyGroupPane; + private PcFitExpandablePane pcFitExpandablePane; + + private static final String FIT_STATE_PC = "fitStateInPC"; + + public ElementEditorExtendDefinePane(XCreator xCreator) { + super(xCreator); + } + + protected JPanel createCenterPane() { + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + paddingBoundPane = new PaddingBoundPane(); + elementCaseToolBarEditor = new AccessibleElementCaseToolBarEditor(); + Component[][] components = new Component[][]{ + new Component[]{paddingBoundPane, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_EC_Toolbar")), elementCaseToolBarEditor}, + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); + panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); + CRPropertyDescriptor[] extraTableEditor = removeOldFitEditor(((XElementCase) creator).getExtraTableEditor()); + extraPropertyGroupPane = new PropertyGroupPane(extraTableEditor, creator); + centerPane.add(panel, BorderLayout.NORTH); + if (extraTableEditor.length > 0) { + centerPane.add(extraPropertyGroupPane, BorderLayout.CENTER); + } + pcFitExpandablePane = new PcFitExpandablePane(this); + centerPane.add(pcFitExpandablePane, BorderLayout.SOUTH); + return centerPane; + } + + private CRPropertyDescriptor[] removeOldFitEditor(CRPropertyDescriptor[] extraTableEditor) { + List list = new ArrayList(); + for (CRPropertyDescriptor crPropertyDescriptor : extraTableEditor) { + if (!ComparatorUtils.equals(FIT_STATE_PC, crPropertyDescriptor.getName())) { + list.add(crPropertyDescriptor); + } + } + return list.toArray(new CRPropertyDescriptor[list.size()]); + } + + protected ElementCaseEditor updateSubBean() { + ElementCaseEditor elementCaseEditor = (ElementCaseEditor) creator.toData(); + if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate"))) { + paddingBoundPane.update(elementCaseEditor); + } + elementCaseEditor.setToolBars((FormToolBarManager[]) elementCaseToolBarEditor.getValue()); + ReportFitAttr fitAttr = pcFitExpandablePane.update(); + elementCaseEditor.setReportFitAttr(fitAttr); + return elementCaseEditor; + } + + + protected void populateSubBean(ElementCaseEditor ob) { + paddingBoundPane.populate(ob); + elementCaseToolBarEditor.setValue(ob.getToolBars()); + extraPropertyGroupPane.populate(ob); + pcFitExpandablePane.populate(ob.getReportFitAttr()); + + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteBodyLayoutExtendDefinePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteBodyLayoutExtendDefinePane.java new file mode 100644 index 000000000..69781e7a6 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteBodyLayoutExtendDefinePane.java @@ -0,0 +1,161 @@ +package com.fr.design.fit.attrpane; + +import com.fr.base.io.IOFile; +import com.fr.base.iofile.attr.WatermarkAttr; +import com.fr.design.data.DataCreatorUI; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.properties.items.FRLayoutTypeItems; +import com.fr.design.designer.properties.items.Item; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor; +import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.design.widget.ui.designer.layout.FRAbsoluteLayoutDefinePane; +import com.fr.form.ui.LayoutBorderStyle; +import com.fr.form.ui.container.WAbsoluteBodyLayout; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WBodyLayoutType; +import com.fr.report.core.ReportUtils; + +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +/** + * Created by kerry on 2020-04-22 + */ +public class FRAbsoluteBodyLayoutExtendDefinePane extends FRAbsoluteLayoutDefinePane { + private static final int MAX_LABEL_WIDTH = 80; + + private AccessibleWLayoutBorderStyleEditor borderStyleEditor; + private AccessibleBodyWatermarkEditor watermarkEditor; + + private UIComboBox layoutCombox; + private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE; + + public FRAbsoluteBodyLayoutExtendDefinePane(XCreator xCreator) { + super(xCreator); + } + + + public void initComponent() { + initCenterPane(); + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + borderStyleEditor = new AccessibleWLayoutBorderStyleEditor(); + watermarkEditor = new AccessibleBodyWatermarkEditor(); + JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane( + new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style")), borderStyleEditor}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), watermarkEditor} + }, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); + JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + borderPane.add(jPanel, BorderLayout.CENTER); + UIExpandablePane advancedPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, borderPane); + centerPane.add(advancedPane, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.NORTH); + } + + private void initCenterPane(){ + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + initUIComboBox(); + JPanel thirdPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel jPanel = createThirdPane(); + jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + thirdPane.add(jPanel, BorderLayout.CENTER); + UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, thirdPane); + this.add(layoutExpandablePane, BorderLayout.CENTER); + + } + + public JPanel createThirdPane() { + initLayoutComboBox(); + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] rowSize = {p}; + double[] colSize = {p, f}; + + UILabel layoutTypeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type")); + JPanel northPane = TableLayoutHelper.createGapTableLayoutPane( + new Component[][]{ + new Component[]{layoutTypeLabel, UIComponentUtils.wrapWithBorderLayoutPane(layoutCombox)}}, + rowSize, colSize, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + jPanel.add(northPane, BorderLayout.NORTH); + return jPanel; + + } + + public void initLayoutComboBox() { + Item[] items = FRLayoutTypeItems.ITEMS; + DefaultComboBoxModel model = new DefaultComboBoxModel(); + for (Item item : items) { + model.addElement(item); + } + layoutCombox = new UIComboBox(model); + layoutCombox.setSelectedIndex(1); + } + + @Override + public String title4PopupWindow() { + return "absoluteBodyLayout"; + } + + public void populateSubPane(WAbsoluteLayout ob) { + layoutCombox.setSelectedIndex(1); + borderStyleEditor.setValue(ob.getBorderStyle()); + watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile())); + } + + public WAbsoluteBodyLayout updateSubPane() { + WAbsoluteBodyLayout layout = (WAbsoluteBodyLayout) creator.toData(); + Item item = (Item) layoutCombox.getSelectedItem(); + Object value = item.getValue(); + int state = 0; + if (value instanceof Integer) { + state = (Integer) value; + } + + if (layoutType == WBodyLayoutType.ABSOLUTE) { + ((XWFitLayout) creator.getBackupParent()).toData().resetStyle(); + if (state == WBodyLayoutType.FIT.getTypeValue()) { + XWFitLayout xwFitLayout = ((XWFitLayout)creator.getBackupParent()); + xwFitLayout.switch2FitBodyLayout(creator); + copyLayoutAttr(layout, xwFitLayout.toData()); + } + } + layout.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue()); + updateWatermark(); + return layout; + } + + private void updateWatermark() { + WatermarkAttr watermark = (WatermarkAttr) watermarkEditor.getValue(); + if (watermark != null) { + IOFile ioFile = getCurrentIOFile(); + ioFile.addAttrMark(watermark); + } + } + + private IOFile getCurrentIOFile() { + return WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget(); + } + + @Override + public DataCreatorUI dataUI() { + return null; + } + + +} diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteLayoutExtendDefinePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteLayoutExtendDefinePane.java new file mode 100644 index 000000000..60ffae3eb --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteLayoutExtendDefinePane.java @@ -0,0 +1,27 @@ +package com.fr.design.fit.attrpane; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.widget.ui.designer.layout.AbstractFRLayoutDefinePane; +import com.fr.form.ui.container.WAbsoluteLayout; + +/** + * Created by kerry on 2020-04-22 + */ +public class FRAbsoluteLayoutExtendDefinePane extends AbstractFRLayoutDefinePane { + + public FRAbsoluteLayoutExtendDefinePane(XCreator xCreator) { + super(xCreator); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + } + + @Override + public void populateBean(WAbsoluteLayout ob) { + } + + @Override + public WAbsoluteLayout updateBean() { + WAbsoluteLayout wAbsoluteLayout = (WAbsoluteLayout) creator.toData(); + return wAbsoluteLayout; + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/FRFitLayoutExtendDefinePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/FRFitLayoutExtendDefinePane.java new file mode 100644 index 000000000..3dd0f1c48 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/attrpane/FRFitLayoutExtendDefinePane.java @@ -0,0 +1,246 @@ +package com.fr.design.fit.attrpane; + +import com.fr.base.io.IOFile; +import com.fr.base.iofile.attr.WatermarkAttr; +import com.fr.design.data.DataCreatorUI; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.creator.XWScaleLayout; +import com.fr.design.designer.properties.items.FRLayoutTypeItems; +import com.fr.design.designer.properties.items.Item; +import com.fr.design.foldablepane.UIExpandablePane; +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.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.FormSelectionUtils; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor; +import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.design.widget.ui.designer.component.PaddingBoundPane; +import com.fr.design.widget.ui.designer.layout.AbstractFRLayoutDefinePane; +import com.fr.form.ui.LayoutBorderStyle; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteBodyLayout; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WBodyLayoutType; +import com.fr.form.ui.container.WFitLayout; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.report.core.ReportUtils; + +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; + +/** + * Created by kerry on 2020-04-22 + */ +public class FRFitLayoutExtendDefinePane extends AbstractFRLayoutDefinePane { + private static final int ADAPT_LABEL_MAX_WIDTH = 80; + private XWFitLayout xWFitLayout; + private WFitLayout wFitLayout; + private UIComboBox layoutComboBox; + private UISpinner componentIntervel; + private PaddingBoundPane paddingBound; + private AccessibleWLayoutBorderStyleEditor stylePane; + private AccessibleBodyWatermarkEditor watermarkEditor; + + public FRFitLayoutExtendDefinePane(XCreator xCreator) { + super(xCreator); + this.xWFitLayout = (XWFitLayout) xCreator; + wFitLayout = xWFitLayout.toData(); + initComponent(); + } + + + public void initComponent() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel advancePane = createAdvancePane(); + UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, advancePane); + this.add(advanceExpandablePane, BorderLayout.NORTH); + UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, createLayoutPane()); + this.add(layoutExpandablePane, BorderLayout.CENTER); + } + + public JPanel createAdvancePane() { + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + stylePane = new AccessibleWLayoutBorderStyleEditor(); + watermarkEditor = new AccessibleBodyWatermarkEditor(); + paddingBound = new PaddingBoundPane(); + JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane( + new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style")), stylePane}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), watermarkEditor} + }, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); + jp2.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + jPanel.add(paddingBound, BorderLayout.CENTER); + jPanel.add(jp2, BorderLayout.NORTH); + return jPanel; + } + + public JPanel createLayoutPane() { + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + jPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + layoutComboBox = initUIComboBox(FRLayoutTypeItems.ITEMS); + componentIntervel = new UISpinner(0, Integer.MAX_VALUE, 1, 0); + JPanel componentIntervelPane = UIComponentUtils.wrapWithBorderLayoutPane(componentIntervel); + + UILabel intervalLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Interval")); + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}, {1, 1}}; + + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type")), layoutComboBox}, + 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, 0, 0, 0)); + jPanel.add(centerPane, BorderLayout.CENTER); + return jPanel; + } + + + public UIComboBox initUIComboBox(Item[] items) { + DefaultComboBoxModel model = new DefaultComboBoxModel(); + for (Item item : items) { + model.addElement(item); + } + return new UIComboBox(model); + } + + + @Override + public String title4PopupWindow() { + return "fitLayout"; + } + + @Override + public void populateBean(WFitLayout ob) { + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + XLayoutContainer rootLayout = selectedBodyLayout(formDesigner); + if (rootLayout != formDesigner.getRootComponent() + && formDesigner.getSelectionModel().getSelection().getSelectedCreator() == formDesigner.getRootComponent()) { + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()})); + + } + paddingBound.populate(ob); + layoutComboBox.setSelectedIndex(ob.getBodyLayoutType().getTypeValue()); + componentIntervel.setValue(ob.getCompInterval()); + stylePane.setValue(ob.getBorderStyle()); + watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile())); + } + + private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) { + XLayoutContainer rootLayout = formDesigner.getRootComponent(); + if (rootLayout.getComponentCount() == 1 && rootLayout.getXCreator(0).acceptType(XWAbsoluteBodyLayout.class)) { + rootLayout = (XWAbsoluteBodyLayout) rootLayout.getXCreator(0); + } + return rootLayout; + } + + + @Override + public WFitLayout updateBean() { + WFitLayout layout = (WFitLayout) creator.toData(); + if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate"))) { + paddingBound.update(layout); + } + LayoutBorderStyle borderStyle = (LayoutBorderStyle) stylePane.getValue(); + if (borderStyle != null) { + layout.setBorderStyle(borderStyle); + } + updateWatermark(); + Item item = (Item) layoutComboBox.getSelectedItem(); + Object value = item.getValue(); + int state = 0; + if (value instanceof Integer) { + state = (Integer) value; + } + //todo 验证下 + layout.setLayoutType(WBodyLayoutType.parse(state)); + try { + if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) { + WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body"); + wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); + Component[] components = xWFitLayout.getComponents(); + xWFitLayout.removeAll(); + layout.resetStyle(); + XWAbsoluteBodyLayout xwAbsoluteBodyLayout = xWFitLayout.getBackupParent() == null ? new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)) : (XWAbsoluteBodyLayout) xWFitLayout.getBackupParent(); + xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); + for (Component component : components) { + XCreator xCreator = (XCreator) component; + //部分控件被ScaleLayout包裹着,绝对布局里面要放出来 + if (xCreator.acceptType(XWScaleLayout.class)) { + if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { + component = xCreator.getComponent(0); + component.setBounds(xCreator.getBounds()); + } + } + xwAbsoluteBodyLayout.add(component); + } + copyLayoutAttr(wFitLayout, wAbsoluteBodyLayout); + xWFitLayout.setBackupParent(xwAbsoluteBodyLayout); + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout})); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + + } + + int intervelValue = (int) componentIntervel.getValue(); + if (xWFitLayout.canAddInterval(intervelValue)) { +// 设置完间隔后,要同步处理界面组件,容器刷新后显示出对应效果 + setLayoutGap(intervelValue); + } + + return layout; + } + + private void updateWatermark() { + WatermarkAttr watermark = (WatermarkAttr) watermarkEditor.getValue(); + if (watermark != null) { + IOFile ioFile = getCurrentIOFile(); + ioFile.addAttrMark(watermark); + } + } + + private IOFile getCurrentIOFile() { + return WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget(); + } + + private void setLayoutGap(int value) { + int interval = wFitLayout.getCompInterval(); + if (value != interval) { + xWFitLayout.moveContainerMargin(); + xWFitLayout.moveCompInterval(xWFitLayout.getAcualInterval()); + wFitLayout.setCompInterval(value); + xWFitLayout.addCompInterval(xWFitLayout.getAcualInterval()); + } + } + + @Override + public DataCreatorUI dataUI() { + return null; + } + +} diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/PcFitExpandablePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/PcFitExpandablePane.java new file mode 100644 index 000000000..0bd1e2bd2 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/attrpane/PcFitExpandablePane.java @@ -0,0 +1,107 @@ +package com.fr.design.fit.attrpane; + +import com.fr.design.designer.IntervalConstants; +import com.fr.design.fit.FitStateCompatible; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.widget.DataModify; +import com.fr.report.fit.FitAttrState; +import com.fr.report.fit.ReportFitAttr; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + + +/** + * Created by kerry on 2020-04-22 + */ +public class PcFitExpandablePane extends JPanel { + UIComboBox comboBox = new UIComboBox( + new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_Double_Fit"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_Hor_Fit"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_No_Fit")}); + UILabel tipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_No_Fit_Tip")); + + public PcFitExpandablePane(DataModify attrPane) { + init(attrPane); + } + + public void init(final DataModify attrPane) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel pcFitPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + final JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + borderPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); + tipLabel.setForeground(Color.gray); + comboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + tipLabel.setText(ScaleTipType.getScaleTip(comboBox.getSelectedIndex()).getTip()); + } + }); + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_Content_Display_Type")), comboBox}, + new Component[]{tipLabel, null}, + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_W0); + panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); + + borderPane.add(panel, BorderLayout.CENTER); + borderPane.add(tipLabel, BorderLayout.SOUTH); + pcFitPane.add(borderPane, BorderLayout.CENTER); + this.add(pcFitPane, BorderLayout.CENTER); + } + + public ReportFitAttr update() { + ReportFitAttr fitAttr = getReportFitAttr(); + fitAttr.setFitStateInPC(FitStateCompatible.getOldTypeFromNew(comboBox.getSelectedIndex())); + return fitAttr; + } + + public void populate(ReportFitAttr fitAttr) { + if (fitAttr == null) { + fitAttr = getReportFitAttr(); + } + int selectIndex = FitStateCompatible.getNewTypeFromOld(fitAttr.fitStateInPC()); + comboBox.setSelectedIndex(selectIndex); + tipLabel.setText(ScaleTipType.getScaleTip(selectIndex).getTip()); + } + + private ReportFitAttr getReportFitAttr() { + ReportFitAttr fitAttr = new ReportFitAttr(); + fitAttr.setFitStateInPC(FitAttrState.NOT_FIT.getState()); + return fitAttr; + } + + private enum ScaleTipType { + EC_DOUBLE_FIT(0, com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_Double_Fit_Tip")), + EC_HOR_FIT(1, com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_Hor_Fit_Tip")), + EC_NO_FIT(2, com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_No_Fit_Tip")); + private int index; + private String tip; + + ScaleTipType(int index, String tip) { + this.index = index; + this.tip = tip; + } + + public String getTip() { + return tip; + } + + public static ScaleTipType getScaleTip(int selectIndex) { + for (ScaleTipType tipType : values()) { + if (selectIndex == tipType.index) { + return tipType; + } + } + return EC_NO_FIT; + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/RootDesignExtendDefinePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/RootDesignExtendDefinePane.java new file mode 100644 index 000000000..8a8aa404a --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/attrpane/RootDesignExtendDefinePane.java @@ -0,0 +1,303 @@ +package com.fr.design.fit.attrpane; + +import com.fr.base.BaseUtils; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.data.DataCreatorUI; +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.XWParameterLayout; +import com.fr.design.designer.properties.PropertyTab; +import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.fit.DesignerUIModeConfig; +import com.fr.design.fit.common.TemplateTool; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.fun.ParameterExpandablePaneUIProvider; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.FormSelection; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor; +import com.fr.design.utils.gui.LayoutUtils; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.ui.designer.AbstractDataModify; +import com.fr.design.widget.ui.designer.component.UIBoundSpinner; +import com.fr.form.ui.container.WParameterLayout; +import com.fr.general.Background; +import com.fr.report.stable.FormConstants; + +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Rectangle; +import java.util.Set; + +public class RootDesignExtendDefinePane extends AbstractDataModify { + private XWParameterLayout root; + private UISpinner designerWidth; + private UISpinner paraHeight; + private UICheckBox displayReport; + private UICheckBox useParamsTemplate; + private AccessibleBackgroundEditor background; + private UIButtonGroup hAlignmentPane; + private UITextField labelNameTextField; + //是否是新设计模式下决策报表 + private boolean newForm; + private PropertyGroupPane extraPropertyGroupPane; + + public RootDesignExtendDefinePane(XCreator xCreator) { + super(xCreator); + newForm = TemplateTool.getCurrentEditingNewJForm() != null && DesignerUIModeConfig.getInstance().newUIMode(); + this.root = (XWParameterLayout) xCreator; + initComponent(); + } + + + public void initComponent() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + if (newForm) { + paraHeight = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0); + } else { + designerWidth = new UIBoundSpinner(1, Integer.MAX_VALUE, 1); + } + JPanel advancePane = createAdvancePane(); + UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, advancePane); + this.add(advanceExpandablePane, BorderLayout.NORTH); + JPanel layoutPane = createBoundsPane(); + UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Size"), 280, 20, layoutPane); + this.add(layoutExpandablePane, BorderLayout.CENTER); + this.addExtraUIExpandablePaneFromPlugin(); + } + + private void addExtraUIExpandablePaneFromPlugin() { + Set pluginCreators = ExtraDesignClassManager.getInstance().getArray(ParameterExpandablePaneUIProvider.XML_TAG); + JPanel panel = FRGUIPaneFactory.createYBoxEmptyBorderPane(); + for (ParameterExpandablePaneUIProvider provider : pluginCreators) { + UIExpandablePane uiExpandablePane = provider.createUIExpandablePane(); + PropertyTab propertyTab = provider.addToWhichPropertyTab(); + if (uiExpandablePane != null && propertyTab == PropertyTab.ATTR) { + panel.add(uiExpandablePane); + } + } + this.add(panel, BorderLayout.SOUTH); + } + + public JPanel createBoundsPane() { + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}}; + Component[] component = newForm ? new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Design_Height")), paraHeight} : + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Desin_Width")), designerWidth}; + Component[][] components = new Component[][]{component}; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + jPanel.add(panel); + return jPanel; + } + + public JPanel createAdvancePane() { + if (newForm) { + return getNewFormAdvancePane(); + } else { + return getTemplateAdvancePane(); + } + } + + /** + * @Description: 获取的非新决策报表AdvancePane + * @param + * @return: + * @Author: Henry.Wang + * @date: 2020/11/05 15:36 + */ + private JPanel getTemplateAdvancePane() { + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + labelNameTextField = new UITextField(); + displayReport = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Display_Nothing_Before_Query")); + UIComponentUtils.setLineWrap(displayReport); + useParamsTemplate = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Use_Params_Template")); + background = new AccessibleBackgroundEditor(); + Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), + BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), + BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),}; + Integer[] hAlignment = new Integer[]{FormConstants.LEFTPOSITION, FormConstants.CENTERPOSITION, FormConstants.RIGHTPOSITION}; + hAlignmentPane = new UIButtonGroup(hAlignmentIconArray, hAlignment); + hAlignmentPane.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")}); + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p, p, p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background}, + new Component[]{displayReport, null}, + new Component[]{useParamsTemplate, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Display_Position")), hAlignmentPane} + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); + panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); + CRPropertyDescriptor[] extraTableEditor = new CRPropertyDescriptor[0]; + extraTableEditor = root.getExtraTableEditor(); + extraPropertyGroupPane = new PropertyGroupPane(extraTableEditor, root); + + jPanel.add(panel, BorderLayout.NORTH); + jPanel.add(extraPropertyGroupPane, BorderLayout.CENTER); + return jPanel; + } + + /** + * @Description: 获取新决策报表的AdvancePane + * @param + * @return: + * @Author: Henry.Wang + * @date: 2020/11/05 15:36 + */ + private JPanel getNewFormAdvancePane() { + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + labelNameTextField = new UITextField(); + displayReport = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Display_Nothing_Before_Query")); + UIComponentUtils.setLineWrap(displayReport); + useParamsTemplate = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Use_Params_Template")); + background = new AccessibleBackgroundEditor(); + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p, p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background}, + new Component[]{displayReport, null}, + new Component[]{useParamsTemplate, null} + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); + panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); + + jPanel.add(panel, BorderLayout.NORTH); + + return jPanel; + } + + @Override + public String title4PopupWindow() { + return "parameter"; + } + + @Override + public void populateBean(WParameterLayout ob) { + labelNameTextField.setText(ob.getLabelName()); + background.setValue(ob.getBackground()); + displayReport.setSelected(ob.isDelayDisplayContent()); + useParamsTemplate.setSelected(ob.isUseParamsTemplate()); + if (newForm) { + FormDesigner designer = TemplateTool.getCurrentEditingNewJForm().getFormDesign(); + paraHeight.setValue(designer.getParaHeight()); + } else { + designerWidth.setValue(ob.getDesignWidth()); + hAlignmentPane.setSelectedItem(ob.getPosition()); + + if (extraPropertyGroupPane != null) { + extraPropertyGroupPane.populate(ob); + } + } + } + + + @Override + public WParameterLayout updateBean() { + if (newForm) { + return updateNewFormBean(); + } else { + return updateTemplateBean(); + } + } + + /** + * @Description: 更新非新决策报表的bean + * @param + * @return: + * @Author: Henry.Wang + * @date: 2020/11/05 15:36 + */ + private WParameterLayout updateTemplateBean() { + WParameterLayout wParameterLayout = (WParameterLayout) creator.toData(); + wParameterLayout.setLabelName(labelNameTextField.getText()); + if (isCompsOutOfDesignerWidth((int) designerWidth.getValue())) { + designerWidth.setValue(wParameterLayout.getDesignWidth()); + } else { + wParameterLayout.setDesignWidth((int) designerWidth.getValue()); + } + wParameterLayout.setDelayDisplayContent(displayReport.isSelected()); + wParameterLayout.setUseParamsTemplate(useParamsTemplate.isSelected()); + JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); + wParameterLayout.setBackground((Background) background.getValue()); + wParameterLayout.setPosition((Integer) hAlignmentPane.getSelectedItem()); + return wParameterLayout; + } + + /** + * @Description: 更新新决策报表的bean + * @param + * @return: + * @Author: Henry.Wang + * @date: 2020/11/05 15:36 + */ + private WParameterLayout updateNewFormBean() { + WParameterLayout wParameterLayout = (WParameterLayout) creator.toData(); + wParameterLayout.setLabelName(labelNameTextField.getText()); + + wParameterLayout.setDelayDisplayContent(displayReport.isSelected()); + wParameterLayout.setUseParamsTemplate(useParamsTemplate.isSelected()); + JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); + wParameterLayout.setBackground((Background) background.getValue()); + //设置参数模板面板的高度 + int height = (int) paraHeight.getTextField().getValue(); + FormDesigner designer = TemplateTool.getCurrentEditingNewJForm().getFormDesign(); + FormSelection selection = designer.getSelectionModel().getSelection(); + XCreator creator = designer.getParaComponent(); + Rectangle rectangle = creator.getBounds(); + Rectangle newRectangle = new Rectangle(rectangle.x, rectangle.y, rectangle.width, height); + creator.setBounds(newRectangle); + if (paraHeight.getValue() != newRectangle.height) + paraHeight.setValue(newRectangle.height); + designer.setParaHeight(newRectangle.height); + designer.getArea().doLayout(); + LayoutUtils.layoutContainer(creator); + selection.fixCreator(designer); + designer.repaint(); + return wParameterLayout; + } + + private boolean isCompsOutOfDesignerWidth(int designerWidth) { + for (int i = 0; i < root.getComponentCount(); i++) { + Component comp = root.getComponent(i); + if (comp.getX() + comp.getWidth() > designerWidth) { + return true; + } + } + return false; + } + + @Override + public DataCreatorUI dataUI() { + return null; + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java b/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java new file mode 100644 index 000000000..5d9c9463c --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java @@ -0,0 +1,225 @@ +package com.fr.design.fit.common; + +import com.fr.design.data.DesignTableDataManager; +import com.fr.design.fit.DesignerUIModeConfig; +import com.fr.design.fit.NewJForm; +import com.fr.design.fit.attrpane.ElementEditorExtendDefinePane; +import com.fr.design.fit.attrpane.FRAbsoluteBodyLayoutExtendDefinePane; +import com.fr.design.fit.attrpane.FRAbsoluteLayoutExtendDefinePane; +import com.fr.design.fit.attrpane.FRFitLayoutExtendDefinePane; +import com.fr.design.fit.attrpane.RootDesignExtendDefinePane; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.JTemplateFactory; +import com.fr.design.parameter.RootDesignDefinePane; +import com.fr.design.preview.FormAdaptivePreview; +import com.fr.design.preview.FormPreview; +import com.fr.design.widget.Appearance; +import com.fr.design.widget.FormWidgetDefinePaneFactoryBase; +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; +import com.fr.design.widget.ui.designer.layout.FRFitLayoutDefinePane; +import com.fr.file.FILE; +import com.fr.file.MemFILE; +import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteBodyLayout; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WFitLayout; +import com.fr.form.ui.container.WParameterLayout; +import com.fr.form.ui.widget.CRBoundsWidget; +import com.fr.log.FineLoggerFactory; +import com.fr.report.fit.ReportFitAttr; + +import javax.swing.SwingUtilities; + +/** + * Created by kerry on 2020-06-02 + */ +public class AdaptiveSwitchUtil { + + private static int switchJFromIng = 0; + + private AdaptiveSwitchUtil() { + + } + + public static void switch2NewUI() { + switch2NewUIMode(); + reload(); + } + + public static void switch2NewUIMode() { + DesignerUIModeConfig.getInstance().setNewUIMode(); + FormWidgetDefinePaneFactoryBase.registerDefinePane(ElementCaseEditor.class, + new Appearance(ElementEditorExtendDefinePane.class, "elementCaseEditor")); + FormWidgetDefinePaneFactoryBase.registerDefinePane(WFitLayout.class, + new Appearance(FRFitLayoutExtendDefinePane.class, "wFitLayout")); + FormWidgetDefinePaneFactoryBase.registerDefinePane(WAbsoluteBodyLayout.class, + new Appearance(FRAbsoluteBodyLayoutExtendDefinePane.class, "wAbsoluteBodyLayout")); + FormWidgetDefinePaneFactoryBase.registerDefinePane(WAbsoluteLayout.class, + new Appearance(FRAbsoluteLayoutExtendDefinePane.class, "wAbsoluteLayout")); + FormWidgetDefinePaneFactoryBase.registerDefinePane(WParameterLayout.class, + new Appearance(RootDesignExtendDefinePane.class, "wParameterLayout")); + } + + public static void switch2OldUI() { + switch2OldUIMode(); + reload(); + } + + public static void switch2OldUIMode() { + DesignerUIModeConfig.getInstance().setOldUIMode(); + FormWidgetDefinePaneFactoryBase.registerDefinePane(WAbsoluteLayout.class, + new Appearance(FRAbsoluteLayoutDefinePane.class, "wAbsoluteLayout")); + FormWidgetDefinePaneFactoryBase.registerDefinePane(ElementCaseEditor.class, + new Appearance(ElementEditorDefinePane.class, "elementCaseEditor")); + FormWidgetDefinePaneFactoryBase.registerDefinePane(WAbsoluteBodyLayout.class, + new Appearance(FRAbsoluteBodyLayoutDefinePane.class, "wAbsoluteBodyLayout")); + FormWidgetDefinePaneFactoryBase.registerDefinePane(WFitLayout.class, + new Appearance(FRFitLayoutDefinePane.class, "wFitLayout")); + FormWidgetDefinePaneFactoryBase.registerDefinePane(WParameterLayout.class, + new Appearance(RootDesignDefinePane.class, "wParameterLayout")); + } + + public static void reload() { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + synchronized (AdaptiveSwitchUtil.class) { + try { + if (DesignerContext.getDesignerFrame() == null) { + return; + } + JTemplate old = TemplateTool.getCurrentEditingTemplate(); + if (old == null || !(old instanceof JForm)) { + return; + } + JTemplate template = createNewJTemplate(old); + if (template != null) { + DesignTableDataManager.closeTemplate(old); + TemplateTool.resetTabPaneEditingTemplate(template); + TemplateTool.activeAndResizeTemplate(template); + setPreviewType(); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } finally { + switchJFromIng = 0; + } + } + } + }); + } + + /** + * @Description: 设置预览方式 + * @return: 新创建的模板 + * @Author: Henry.Wang + * @date: 2020/10/13 14:08 + */ + private static void setPreviewType() { + JTemplate jTemplate = TemplateTool.getCurrentEditingTemplate(); + if (jTemplate != null) { + if (DesignerUIModeConfig.getInstance().newUIMode()) { + jTemplate.setPreviewType(new FormAdaptivePreview()); + } else { + jTemplate.setPreviewType(new FormPreview()); + } + } + } + + /** + * @Description: 创建模板 + * @param old 以前的模板 + * @return: 新创建的模板 + * @Author: Henry.Wang + * @date: 2020/9/6 14:08 + */ + public static JTemplate createNewJTemplate(JTemplate old) { + JTemplate template; + template = createNewJTemplateInternal(old); + if (template instanceof NewJForm) { + NewJForm jForm = ((NewJForm) template); + //如果是从旧的设计模板转化为新的设计模式,并且不是全局配置的模板。则更新新模板的Pc端自适应属性 + if (DesignerUIModeConfig.getInstance().newUIMode() && jForm.getTarget().getReportFitAttr() != null && isSwitchJFromIng()) { + jForm.getTarget().setReportFitAttr(shiftReportFitAttr(old, jForm.getTarget().getReportFitAttr().isFitFont())); + } + TemplateTool.saveForm(jForm); + } + return template; + } + + /** + * @Description: 创建模板核心方法 + * @param old 以前的方法 + * @return: 新创建的模板 + * @Author: Henry.Wang + * @date: 2020/9/6 14:09 + */ + private static JTemplate createNewJTemplateInternal(JTemplate old) { + FILE file = old.getEditingFILE(); + if ((file instanceof MemFILE) || !old.isSaved()) { + if (old instanceof NewJForm) { + TemplateTool.resetAbsoluteBodySize((NewJForm) old); + } + TemplateTool.saveForm(old); + } + return JTemplateFactory.createJTemplate(old.getEditingFILE()); + } + + /** + * @Description: 老模板切换到新模板的属性配置转换( + * 1、绝对布局-适应区域--》双向自适应 + * 2、自适应布局-双向自适应--》双向自适应 + * 3、自适应布局-横向自适应--》横向自适应 + * 4、绝对布局-固定大小--》不自适应 + * ) + * @param old + * @param fitFont 字体是否自适应 + * @return: + * @Author: Henry.Wang + * @date: 2020/9/6 14:01 + */ + private static ReportFitAttr shiftReportFitAttr(JTemplate old, boolean fitFont) { + if (old instanceof JForm && DesignerUIModeConfig.getInstance().newUIMode()) { + JForm jForm = (JForm) old; + try { + int layoutType = LayoutTool.getFormLayoutType(jForm); + int compState = -1; + //自适应布局 + if (layoutType == 0) { + compState = ((WFitLayout) jForm.getFormDesign().getRootComponent().toData()).getCompState(); + if (compState == WFitLayout.STATE_FULL) { + return new ReportFitAttr(2, fitFont); + } else if (compState == WFitLayout.STATE_ORIGIN) { + return new ReportFitAttr(1, fitFont); + } + } else if (layoutType == 1) {//绝对布局 + Widget widget = ((CRBoundsWidget) jForm.getFormDesign().getRootComponent().toData().getWidget(0)).getWidget(); + if (widget instanceof WAbsoluteLayout) { + compState = ((WAbsoluteLayout) widget).getCompState(); + } + if (compState == WAbsoluteLayout.STATE_FIT) { + return new ReportFitAttr(2, fitFont); + } else if (compState == WAbsoluteLayout.STATE_FIXED) { + return new ReportFitAttr(3, fitFont); + } + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + return null; + } + + public static void setSwitchJFromIng(int switchJFromIng) { + AdaptiveSwitchUtil.switchJFromIng = switchJFromIng; + } + + public static boolean isSwitchJFromIng() { + return switchJFromIng == 1; + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/common/BaseUtils.java b/designer-form/src/main/java/com/fr/design/fit/common/BaseUtils.java new file mode 100644 index 000000000..829d320e8 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/common/BaseUtils.java @@ -0,0 +1,1266 @@ +package com.fr.design.fit.common; + +import com.fr.base.AutoChangeLineAndDrawManager; +import com.fr.base.FRContext; +import com.fr.base.GraphHelper; +import com.fr.base.Style; +import com.fr.base.SynchronizedLiveDataModelUtils; +import com.fr.base.TableData; +import com.fr.base.regist.LicenseConfigManager; +import com.fr.config.ServerPreferenceConfig; +import com.fr.data.api.TableDataAssist; +import com.fr.design.fit.PX; +import com.fr.general.ComparatorUtils; +import com.fr.general.FArray; +import com.fr.general.FRFont; +import com.fr.general.GeneralContext; +import com.fr.general.GeneralUtils; +import com.fr.general.IOUtils; +import com.fr.general.data.DataModel; +import com.fr.general.data.TableDataException; +import com.fr.general.xml.GeneralXMLTools; +import com.fr.json.JSONArray; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.json.JSONUtils; +import com.fr.json.revise.EmbedJson; +import com.fr.locale.InterProviderFactory; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.injectable.PluginModule; +import com.fr.report.fun.VerticalTextProcessor; +import com.fr.report.fun.impl.DefaultVerticalTextProcessor; +import com.fr.script.Calculator; +import com.fr.stable.ColumnRow; +import com.fr.stable.Constants; +import com.fr.stable.GraphDrawHelper; +import com.fr.stable.ListSet; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.bridge.ObjectHolder; +import com.fr.stable.fun.AutoChangeLineAndDrawProcess; +import com.fr.stable.fun.FontProcessor; +import com.fr.stable.plugin.ExtraClassManagerProvider; +import com.fr.stable.project.ProjectConstants; +import com.fr.stable.script.CalculatorProvider; +import com.fr.stable.unit.FU; +import com.fr.stable.unit.UNIT; +import com.fr.workspace.WorkContext; + +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Paint; +import java.awt.geom.AffineTransform; +import java.awt.geom.Dimension2D; +import java.awt.image.BufferedImage; +import java.awt.image.CropImageFilter; +import java.awt.image.FilteredImageSource; +import java.io.IOException; +import java.io.InputStream; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; + + +/** + * 基本的工具类 + */ +public class BaseUtils { + + private BaseUtils() { + } + + /** + * 从缓存中读取图片(如果缓存中存在的话则直接从缓存中读取,如果不存在则从磁盘读取并将读取的结果缓存起来) + * + * @param resource 图片的路径 + * @return 图片 + * @see IOUtils#readImageWithCache(String) + * @deprecated + */ + public static BufferedImage readImageWithCache(String resource) { + return IOUtils.readImageWithCache(resource); + } + + /** + * 从缓存中读取图片,如果缓存中不存在则返回null + * + * @param resource 图片路径 + * @return 图片,缓存中没有则返回null + * @see IOUtils#readCacheImage(String) + * @deprecated + */ + public static BufferedImage readCacheImage(String resource) { + return IOUtils.readCacheImage(resource); + } + + /** + * 直接从磁盘中读取图片,这种方法效率稍低但每次图片更改了也能即时反应出来 + * + * @param resource 图片的路径 + * @return 图片 + * @see IOUtils#readImage(String) + * @deprecated + */ + public static BufferedImage readImage(String resource) { + //daniel bug 5400 图片读取 默认关闭缓存 + return IOUtils.readImage(resource); + } + + /** + * 读取图标,该方法启用了缓存 + * + * @param resource 图标文件的存放路径 + * @return 图标 + * @see IOUtils#readIcon(String) + * @deprecated + */ + public static Icon readIcon(String resource) { + return IOUtils.readIcon(resource); + } + + /** + * 从输入流中读取图片 + * + * @param input 输入流 + * @return 图片 + * @throws IOException + * @see IOUtils#readImage(InputStream) + * @deprecated + */ + public static BufferedImage readImage(InputStream input) throws IOException { + return IOUtils.readImage(input); + } + + /** + * 将行列对象转换成其字符串的表示形式 + * 转换后的字符串将像A2,B4,C45这样的 + *

+ * 将A1单元格转化成字符串"A1": + *

+ * BaseUtils.convertColumnRowToCellString(ColumnRow.valueOf(0,0)); + * + * @param columnRow 要转换的行列对象 + * @return 表示行列位置的字符串 + */ + public static String convertColumnRowToCellString(ColumnRow columnRow) { + if (columnRow == null) { + return ""; + } + + return columnRow.toString(); + } + + /** + * 将表示行列位置的字符串转换成行列对象 + * 如果转换失败,将会返回{@link ColumnRow} + * + * @param columnRowString 表示行列位置的字符串对象 + * @return 行列对象 + * @see ColumnRow#valueOf(String) + * @deprecated + */ + public static ColumnRow convertCellStringToColumnRow(String columnRowString) { + return ColumnRow.valueOf(columnRowString); + } + + /** + * 读取jar的版本号 + * + * @return 版本号 + * @see GeneralUtils#readBuildNO() + * @deprecated + */ + public static String readBuildNO() { + return GeneralUtils.readBuildNO(); + } + + /** + * 把指定位置的资源以默认的GBK编码的形式读取成字符串 + * + * @param path 资源存放的路径 + * @return 表示资源内容的字符串 + * @see IOUtils#readResourceAsString(String) + * @deprecated + */ + public static String readResourceAsString(String path) { + return IOUtils.readResourceAsString(path); + } + + /** + * 将指定位置的资源以指定的编码形式读取成字符串 + * + * @param path 资源存放的路径 + * @param encode 读取资源所用的编码 + * @return 表示资源内容的字符串 + * @see IOUtils#readResourceAsString(String, String) + * @deprecated + */ + public static String readResourceAsString(String path, String encode) { + return IOUtils.readResourceAsString(path, encode); + } + + @Deprecated + public static String[] getDependence(Object value, CalculatorProvider c) { + + try { + return (String[]) StableUtils.invokeMethod("com.fr.form.FormUtils", "getDependence", new Class[]{Object.class, CalculatorProvider.class}, new Object[]{value, c}); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; + } + + /** + * 读取资源 + * + * @param path 资源存放的路径,可以是一个URL + * @return 返回资源的输入流 + * @see IOUtils#readResource(String) + * @deprecated + */ + public static InputStream readResource(String path) { + return IOUtils.readResource(path); + } + + /** + * 截取图片的指定区域作为一个图标 + * + * @param image 原始的图片 + * @param startx 截取的横向起始位置 + * @param starty 截取的纵向起始位置 + * @param width 截取的图标的宽度 + * @param height 截取的图标的高度 + * @return 图标 + */ + public static ImageIcon createIcon(Image image, int startx, int starty, int width, int height) { + JFrame jc = new JFrame(); + Image cropImage = jc.createImage(new FilteredImageSource(image.getSource(), new CropImageFilter(startx, starty, width, height))); + return new ImageIcon(cropImage); + } + + /** + * 将一个长整形数组以指定的分隔符转化成一个字符串 + * + * @param array 数组 + * @param decimal 分隔符 + * @return 表示数组的字符串 + */ + public static String toLongArrayString(long[] array, char decimal) { + StringBuffer sb = new StringBuffer(); + if (array != null) { + for (int i = 0; i < array.length; i++) { + if (i != 0) { + sb.append(decimal); + } + sb.append(array[i]); + } + } + return sb.toString(); + } + + /** + * 将一个有规则的字符串按指定的分隔符分割并转化成一个长整型数组 + * + * @param str 有规则的字符串 + * @param decimal 分隔符 + * @return 长整型数组 + */ + public static long[] toLongArrayFromStr(String str, char decimal) { + List list = new ArrayList(); + if (str == null) { + return new long[0]; + } + String[] strarray = StableUtils.splitString(str, String.valueOf(decimal)); + for (int i = 0; i < strarray.length; i++) { + String text = strarray[i].trim(); + list.add(Long.valueOf(text)); + } + + long[] res = new long[list.size()]; + for (int i = 0; i < res.length; i++) { + res[i] = ((Long) list.get(i)).longValue(); + } + + return res; + } + + + /** + * 获取样式中字体的类型 + * + * @param g2d 图形上下文 + * @param style 样式 + * @param resolution 屏幕分辨率 + * @return 字体 + */ + public static Font getStyleFont(Graphics2D g2d, Style style, int resolution) { + FRFont font = style.getFRFont(); + Font rfont = initFontWithLocaleAndG2d(g2d, font, resolution); + if (!ComparatorUtils.equals(rfont, g2d.getFont())) { + g2d.setFont(rfont); + } + Color foreground = font.getForeground(); + if (!ComparatorUtils.equals(foreground, g2d.getPaint())) { + g2d.setPaint(foreground); + } + + return rfont; + } + + + private static Font initFontWithLocaleAndG2d(Graphics2D g2d, FRFont font, int resolution) { + Locale locale = GeneralContext.getLocale(); + Font rfont; + if (ComparatorUtils.equals(Locale.ENGLISH, locale)) { + rfont = FRFont.getInstance("Dialog", font.getStyle(), font.getSize()); + } + + rfont = font.applyResolutionNP(resolution); + //itext的bug 用SimSun导出无法实现粗体斜体, 其作者解释是使用basefont是不支持这些style的, 要转成itext的亚洲字体 + //这边不用instance of的原因就是不想把itext包引到applet包里面去. + if (g2d.toString().indexOf("PdfGraphics2D") != -1 && ComparatorUtils.equals(FRFont.DEFAULT_FONTNAME, font.getName())) { + //不要把这边的'宋体'改成'Simsun', 就这么设定的 + rfont = FRFont.getInstance(InterProviderFactory.getProvider().getLocText("Fine-Core_Base_Song_TypeFace"), rfont.getStyle(), rfont.getSize(), + font.getForeground(), font.getUnderline(), font.isStrikethrough(), font.isShadow(), + font.isSuperscript(), font.isSubscript()); + } + + return rfont; + } + + /** + * 获取样式中关于水平方向上的对齐类型 + * + * @param style 样式 + * @return 水平方向上的对齐类型 + */ + public static int getAlignment4Horizontal(Style style) { + return getAlignment4Horizontal(style, null); + } + + /** + * 获取DataMoodel中第columnIndex列的数据. + * + * @param model 取数的数据来源 + * @param columnIndex 取数的数据列序号 + * @return 返回数据数组Object[] + */ + public static Object[] getDistinctValues(DataModel model, int columnIndex) throws TableDataException { + ListSet list = new ListSet(); + if (columnIndex != DataModel.COLUMN_NAME_NOT_FOUND) { + for (int i = 0, len = model.getRowCount(); i < len; i++) { + list.add(model.getValueAt(i, columnIndex)); + } + } + + return list.toArray(); + } + + /** + * 获取水平方向上的对齐样式 + * + * @param style 样式 + * @param value 单元格的值,默认情况下,当不设置对齐类型时,如果单元格的值是数字则靠右对齐,字符串则靠左对齐 + * @return 水平方向上的对齐样式 + */ + public static int getAlignment4Horizontal(Style style, Object value) { + int horizontalAlignment = style.getHorizontalAlignment(); + //若是默认值:判断 bug5188 数字居右 + if (value != null && horizontalAlignment == Constants.NULL) { + if (value instanceof String) { + if (style.getFormat() instanceof NumberFormat || StableUtils.isNumber((String) value)) { + horizontalAlignment = Constants.RIGHT; + } else { + //字符串:靠左 + horizontalAlignment = Constants.LEFT; + } + } else if (value instanceof Number) { + horizontalAlignment = Constants.RIGHT; + } + } + return horizontalAlignment; + } + + /** + * 基本的画文本的方法,只考虑样式中的字体和对齐方式 + * + * @param g2d 图形上下文 + * @param width 画文本的区域的宽度 + * @param height 画文本的区域的高度 + * @param text 要画的文本 + * @param style 样式 + * @param resolution 屏幕分辨率 + */ + public static void drawStringStyleInRotation(Graphics2D g2d, int width, int height, String text, Style style, int resolution) { + if (StringUtils.isBlank(text)) { + return; + } + + Paint oldPaint = g2d.getPaint(); + Font oldFont = g2d.getFont(); + + if (style == null) { + style = Style.DEFAULT_STYLE; + } + + Font font = getStyleFont(g2d, style, resolution); + font = readExtraFont(g2d, font); + int horizontalAlignment = BaseUtils.getAlignment4Horizontal(style, text); + + if (style.getRotation() != 0 && style.getVerticalText() == Style.HORIZONTALTEXT) { + drawHorizontalText(g2d, text, font, style, width, height, horizontalAlignment); + } else { + drawRotationText(g2d, text, style, font, width, height, horizontalAlignment, resolution); + } + + g2d.setFont(oldFont); + g2d.setPaint(oldPaint); + } + + private static Font readExtraFont(Graphics2D g2d, Font font) { + ExtraClassManagerProvider pluginProvider = PluginModule.getAgent(PluginModule.ExtraCore); + if (pluginProvider != null) { + FontProcessor processor = pluginProvider.getSingle(FontProcessor.MARK_STRING); + if (processor != null) { + font = processor.readExtraFont(font); + g2d.setFont(font); + } + } + return font; + } + + private static void drawHorizontalText(Graphics2D g2d, String text, Font rfont, Style style, double width, double height, int horizontalAlignment) { + AffineTransform trans = new AffineTransform(); + trans.rotate(-Math.toRadians(style.getRotation())); + + double textX = width / 2.0; + double textY = height / 2.0; + + Dimension2D textDimension = GraphHelper.stringDimensionWithRotation(text, rfont, -style.getRotation(), g2d.getFontRenderContext()); + + if (textDimension.getWidth() < width) { + if (horizontalAlignment == Constants.LEFT) { + textX = textDimension.getWidth() / 2.0; + } else if (horizontalAlignment == Constants.RIGHT) { + textX = width - textDimension.getWidth() / 2.0 - style.getPaddingLeft() * + Math.cos(Math.toRadians(style.getRotation())); + } else { + } + } + + // adjust y, height. + if (textDimension.getHeight() < height) { + if (style.getVerticalAlignment() == Constants.TOP) { + textY = textDimension.getHeight() / 2.0; + } else if (style.getVerticalAlignment() == Constants.BOTTOM) { + textY = height - textDimension.getHeight() / 2.0 - style.getPaddingLeft() * Math.sin(Math.toRadians(style.getRotation())); + } else { + } + } + + GraphHelper.drawRotatedString(g2d, text, textX, textY, -style.getRotation()); + } + + private static void drawRotationText(Graphics2D g2d, String text, Style style, Font rfont, int width, int height, int horizontalAlignment, int resolution) { + AutoChangeLineAndDrawProcess process = AutoChangeLineAndDrawManager.getProcess(); + if (process != null) { + process.drawRotationText(g2d, text, new ObjectHolder(style), rfont, width, height, horizontalAlignment, resolution); + return; + } + + FontMetrics cellFM = GraphHelper.getFontMetrics(rfont); + List lineTextList = BaseUtils.getLineTextList(text, style, rfont, height, width, resolution); + + if (width <= 0 || lineTextList.isEmpty()) { + return; + } + + int textAscent = cellFM.getAscent(); + int textHeight = cellFM.getHeight(); + + int textY = calculateTextY(style, height, textHeight, textAscent, lineTextList, resolution); + + int maxWidth = 0; + for (int i = 0; i < lineTextList.size(); i++) { + String paint_str = (String) lineTextList.get(i); + int textWidth = cellFM.stringWidth(paint_str); + if (textWidth > maxWidth) { + maxWidth = textWidth; + } + } + for (int i = 0; i < lineTextList.size(); i++) { + String paint_str = (String) lineTextList.get(i); + //把自定义角度为0的横排和竖排区分开来 + if (style.getRotation() == 0 && style.getVerticalText() == style.HORIZONTALTEXT) { + maxWidth = cellFM.stringWidth(paint_str); + } + boolean textLonger = false;//KevinWang: 标志一下:是否串长大于列宽 + if (maxWidth > width - style.getPaddingLeft() - style.getPaddingRight()) { + textLonger = true;//added by KevinWang <处理分散对齐时使用> + } //待会串长大于列宽时需要特别处理:只从中抽取合适长度的串值显示 + + int textX = (int) calculateTextX(style, width, maxWidth, horizontalAlignment, resolution); + int textWidth = width - style.getPaddingRight(); + if (isAutomaticLine(style, horizontalAlignment, textLonger)) {//自动换行时 + GraphHelper.drawString2(g2d, paint_str, textX, textY, textWidth); + } else if (isDistributeAlign(style, horizontalAlignment, textLonger)) { + drawTextWihenDistributeAlign(g2d, paint_str, cellFM, textWidth, textX, textY); + } else { //这里不能删除 + GraphHelper.drawString(g2d, paint_str, textX, textY); + } + textY += textHeight;// TODO 只增加了Y. + textY += PX.toPixWithResolution(style.getLineSpacing(), resolution); + } + } + + public static int calculateTextY(Style style, int height, int textHeight, int textAscent, List lineTextList, int resolution) { + return calculateTextY(style, height, textHeight, textAscent, lineTextList, resolution, 1); + } + + /** + * 计算Y的高度 + * + * @param style 样式 + * @param height 总高度 + * @param textHeight 文本高度 + * @param textAscent 字体的基线到大多数字母数字字符顶部的距离 + * @param lineTextList 文本列 + * @param resolution 分辨率 + * @return Y高度 + */ + public static int calculateTextY(Style style, int height, int textHeight, int textAscent, List lineTextList, int resolution, int scale) { + // 计算Y的高度. + int textY = 0; + int textAllHeight = textHeight * lineTextList.size(); + double spacingBefore = PX.toPixWithResolution(style.getSpacingBefore() * scale, resolution); + double spacingAfter = PX.toPixWithResolution(style.getSpacingAfter() * scale, resolution); + double lineSpacing = PX.toPixWithResolution(style.getLineSpacing() * scale, resolution); + textAllHeight += spacingBefore + spacingAfter + lineSpacing * lineTextList.size(); + if (style.getVerticalAlignment() == Constants.TOP) { + } else if (style.getVerticalAlignment() == Constants.CENTER) { + if (height > textAllHeight) {// 如果所有文本的高度小于当前可以绘区域的高度,就从0开始画字符. + textY = (height - textAllHeight) / 2; + } + } else if (style.getVerticalAlignment() == Constants.BOTTOM) { + if (height > textAllHeight) { + textY = height - textAllHeight; + } + } + textY += textAscent;// 在绘画的时候,必须添加Ascent的高度. + textY += spacingBefore + lineSpacing;//james:加上"段前间距"+“行间距” + return textY; + } + + + public static int calculateTextX(Style style, Font rfont, String paint_str, int width, int textWidth, int horizontalAlignment) { + return calculateTextX(style, rfont, paint_str, width, textWidth, horizontalAlignment, 1); + } + + /** + * 计算X宽度 + * + * @param style 样式 + * @param rfont 字体 + * @param paint_str 字符串 + * @param width 宽度 + * @param textWidth 文本宽度 + * @param horizontalAlignment 垂向对齐 + * @return X宽度 + */ + public static int calculateTextX(Style style, Font rfont, String paint_str, int width, int textWidth, int horizontalAlignment, int scale) { + int textX = style.getPaddingLeft() * scale; + if (horizontalAlignment == Constants.CENTER) { + textX += (width - textWidth - textX) / 2; + } else if (horizontalAlignment == Constants.RIGHT) { + textX = width - style.getPaddingRight() * scale - textWidth; +//// // TODO alex:just for flash print && for font.Tahoma +// if (Boolean.TRUE == FRCoreContext.TMAP.get() +// && ComparatorUtils.equals(rfont.getFontName(), "Tahoma")) { +// textX -= paint_str.length() / 3; +// } + } + return textX; + } + + /** + * 计算X宽度 + * + * @param style 样式 + * @param width 宽度 + * @param textWidth 文本宽度 + * @param horizontalAlignment 垂向对齐 + * @param resolution 分辨率 + * @return X宽度 + */ + public static double calculateTextX(Style style, int width, int textWidth, int horizontalAlignment, int resolution) { + return calculateTextX(style, width, textWidth, horizontalAlignment, resolution, 1); + } + + /** + * 计算文本X位置 + * + * @param style 样式 + * @param width 宽度 + * @param textWidth 文本宽度 + * @param horizontalAlignment 水平对齐 + * @return X宽度 + */ + public static double calculateTextX(Style style, int width, int textWidth, int horizontalAlignment, int resolution, int scale) { + double textX = padding2PixExcludeRight(style.getPaddingLeft(), resolution); + if (horizontalAlignment == Constants.CENTER) { + textX += (width - textWidth - textX) / 2f; + } else if (horizontalAlignment == Constants.RIGHT) { + textX = width - style.getPaddingRight() * scale - textWidth; + } + return textX; + } + + /** + * 将缩减、段间距转为对应dpi下的pix Ps:除了右缩进 + * + * @param padding + * @param resolution + * @return + */ + public static double padding2PixExcludeRight(int padding, int resolution) { + return PX.toPixWithResolution(padding, resolution); + } + + /** + * 将右缩进转为对应dpi下的pix + * + * @param paddingRight + * @param resolution + * @return + */ + public static double paddingRight2Pix(int paddingRight, int resolution) { + if (paddingRight == Style.DEFAULT_PADDING) { + return 0; + } + return paddingRight; + } + + public static boolean isAutomaticLine(Style style, int horizontalAlignment, boolean textLonger) { + return horizontalAlignment == Constants.DISTRIBUTED + && style.getTextStyle() == Style.TEXTSTYLE_WRAPTEXT + || horizontalAlignment == Constants.DISTRIBUTED + && style.getTextStyle() == Style.TEXTSTYLE_SINGLELINE + && !textLonger; + } + + public static boolean isDistributeAlign(Style style, int horizontalAlignment, boolean textLonger) { + return horizontalAlignment == Constants.DISTRIBUTED + && style.getTextStyle() == Style.TEXTSTYLE_SINGLELINE + && textLonger; + } + + public static void drawTextWihenDistributeAlign(Graphics2D g2d, String paint_str, FontMetrics cellFM, int width, int textX, int textY) { + drawTextWihenDistributeAlign(g2d, paint_str, cellFM, width, textX, textY, 1f); + } + + /** + * 画字符串:分散对齐 + * @param scale 缩放比例,主目前要用于删除线、下划线及阴影的绘制 + */ + public static void drawTextWihenDistributeAlign(Graphics2D g2d, String paint_str, FontMetrics cellFM, int width, int textX, int textY, float scale) { + String lineText = getSingleLineText(paint_str, cellFM, width); + if (StringUtils.isNotEmpty(lineText)) { + GraphDrawHelper.drawString4DistributeAlign(g2d, lineText, textX, textY, width, scale); + } + } + + /** + * 获取用于单行显示的text + * + * @param lineText 分行显示时第i行的内容,但是也可能单行 + * @param cellFM 字体 + * @param width 宽度 + * @return 拆分后的字符串 + */ + private static String getSingleLineText(String lineText, FontMetrics cellFM, int width) { + // 单行显示时的分散对齐实现e + // 串长大于列宽时需要特别处理:只从中抽取合适长度的串值显示 + StringBuffer strBuff = new StringBuffer(); + for (int charIndex = 0; charIndex < lineText.length(); charIndex++) { + strBuff.append(lineText.charAt(charIndex)); + int buffWidth = cellFM.stringWidth(new String(strBuff)); + if (buffWidth > width) { //长度足够了,开始显示 + return strBuff.substring(0, 0 == charIndex ? 0 : charIndex - 1);//只画一行 + } + } + //上面的width没有减去padding-left,可能啥也没画 + return strBuff.toString(); + } + + /** + * 将输入字符串转换为实际字符,\代表转义字符。 + * + * @param text 字符串 + * @return the real value 实际字符 + */ + public static String textToString(String text) { + //跟这里的drawText算法是一致的,这样"所见即所得", + //如果把drawText的参数text先用此方法转换也行的,但是会遍历俩次,所以先留着 + if (text == null) { + return ""; + } + + int len = text.length(); + StringBuffer sb = new StringBuffer(len); + + for (int i = 0; i < len; i++) { + char c = text.charAt(i); + if (c == '\\' && i + 1 < len) { + char next = text.charAt(i + 1); + if (next == 'n') { + i++; + c = '\n'; + } else if (next == '\\') { + i++; + } + + } + sb.append(c); + } + return sb.toString(); + } + + /** + * daniel: 自动换行算法, 这个算法要求跟DHTML中Table的自动换行表现结果一样 + * 所以统一72dpi进行处理 + * + * @param text + * @param style + * @param paintWidth + * @return + */ + public static List getLineTextList(String text, Style style, Font font, double paintWidth, int resolution) { + List lineTextList = new ArrayList(); + if (text == null || text.length() <= 0) { + return lineTextList; + } + + style = style == null ? Style.DEFAULT_STYLE : style; + + if (style.getRotation() != 0) { + lineTextList.add(text); + return lineTextList; + } + + if (style.getTextStyle() != Style.TEXTSTYLE_WRAPTEXT) { + return lineTextListNotChangeLine(lineTextList, text); + } + // 自动换行 + else { + UNIT width = FU.valueOfPix((int) paintWidth, resolution); + return lineTextListAutoChangeLine(lineTextList, text, font, style, width, resolution); + } + } + + private static List lineTextListNotChangeLine(List lineTextList, String text) { + char tmpChar; + StringBuffer tmpTextBuf = new StringBuffer(); + for (int t = 0; t < text.length(); t++) { + tmpChar = text.charAt(t); + if (tmpChar == '\\') {// 判断是否是 "\n" + if (t + 1 < text.length() && text.charAt(t + 1) == 'n') { + // 是"\n"字符串,但不是换行符. + t++; + lineTextList.add(tmpTextBuf.toString()); + tmpTextBuf.delete(0, tmpTextBuf.length()); + } else { + tmpTextBuf.append(tmpChar); + } + } else { + tmpTextBuf.append(tmpChar); + } + } + + // 最后一个 + if (tmpTextBuf.length() > 0) { + lineTextList.add(tmpTextBuf.toString()); + tmpTextBuf.delete(0, tmpTextBuf.length()); + } + + return lineTextList; + } + + /** + * 这里需要用resolution 72的dpi进行分行,因为96dpi会导致font有小数导致获取的宽度不正确 + * + * @param lineTextList + * @param text + * @param style + * @return + */ + private static List lineTextListAutoChangeLine(List lineTextList, String text, Font font, Style style, UNIT unitWidth, int resolution) { + + AutoChangeLineAndDrawProcess process = AutoChangeLineAndDrawManager.getProcess(); + if (process != null) { + return process.autoChangeLine(text, new ObjectHolder(style), unitWidth); + } + if (font == null) { + font = style.getFRFont(); + } + FontMetrics fontMetrics = GraphHelper.getFontMetrics(font); + double paintWidth = unitWidth.toPixD(resolution); + double width = paintWidth - style.getPaddingLeft() - style.getPaddingRight() - style.getBorderLeftWidth(); + StringBuffer lineTextBuf = new StringBuffer(); + int lineTextWidth = 0; + + StringBuffer wordBuf = new StringBuffer(); + int wordWidth = 0; + int[] tmpWidth = new int[2]; + tmpWidth[0] = wordWidth; + tmpWidth[1] = lineTextWidth; + + lineTextListDealWithText(text, lineTextList, width, tmpWidth, wordBuf, lineTextBuf, fontMetrics); + + // 最后处理 + if (tmpWidth[1] + tmpWidth[0] > width && lineTextBuf.length() > 0) { + lineTextList.add(lineTextBuf.toString()); + lineTextList.add(wordBuf.toString()); + } else { + lineTextBuf.append(wordBuf); + lineTextList.add(lineTextBuf.toString()); + } + return lineTextList; + } + private static void lineTextListDealWithText(String text, List lineTextList, double width, int[] tmpWidth, + StringBuffer wordBuf, StringBuffer lineTextBuf, FontMetrics fontMetrics) { + for (int t = 0; t < text.length(); t++) { + if (t != 0 && isNumOrLetter(text.charAt(t)) && isNumOrLetter(text.charAt(t - 1))) { + dealWithTextNumOrLetter(text, t, lineTextList, width, tmpWidth, wordBuf, lineTextBuf, fontMetrics); + } else if (text.charAt(t) == '\n' || (text.charAt(t) == '\r' && t + 1 < text.length() - 1 && text.charAt(t + 1) != '\n')) { + dealWithTextChangeLineSymbol(text, t, lineTextList, width, tmpWidth, wordBuf, lineTextBuf, fontMetrics); + } else if (text.charAt(t) == '\\' && t + 1 < text.length() && text.charAt(t + 1) == 'n') {// 判断是否是 "\n" + // 是"\n"字符串,但不是换行符,依然需要换行. + dealWidthTextManualChangeLine(text, t, lineTextList, width, tmpWidth, wordBuf, lineTextBuf, fontMetrics); + // 需要跳过后面的n + t++; + } else { + int increaseStep = 0; + if (text.charAt(t) == '\\' && t + 1 < text.length() && text.charAt(t + 1) == '\\') {// 判断是否是转义字符'\' + // _denny: 增加了转义字符'\\'用来表示\,使"\n"可以输入 + t++; + increaseStep++; + } + if (tmpWidth[1] + tmpWidth[0] > width && lineTextBuf.length() > 0) { + if (isPunctuationAtLineHead(t, text)) { + for (int index = lineTextBuf.length(); index > 0; index--) { + char prec = lineTextBuf.charAt(index - 1); + lineTextBuf.deleteCharAt(index - 1); + if (!isPunctuation(prec)) { + break; + } + } + } + lineTextList.add(lineTextBuf.toString()); + lineTextBuf.delete(0, lineTextBuf.length()); + tmpWidth[1] = isPunctuationAtLineHead(t, text) ? dealWithPunctuationAtLinehead(t, fontMetrics, text, lineTextBuf, wordBuf.length(), increaseStep) : 0; + } + lineTextBuf.append(wordBuf); + tmpWidth[1] += tmpWidth[0]; + + wordBuf.delete(0, wordBuf.length()); + tmpWidth[0] = 0; + wordBuf.append(text.charAt(t)); + tmpWidth[0] = fontMetrics.charWidth(text.charAt(t)); + } + } + } + + + + /** + * 标点符号是否在换行后的行首 + */ + private static boolean isPunctuationAtLineHead(int t, String text) { + return t > 1 && BaseUtils.isPunctuation(text.charAt(t - 1)); + } + + private static int dealWithPunctuationAtLinehead(int t, FontMetrics fontMetrics, String text, StringBuffer lineTextBuf, int wordBufLength, int increaseStep) { + //lineTextBuf 最后一个字符下标 与 text当前字符下标 t 的距离 + 1 + int indexDistance = 1 + wordBufLength + increaseStep; + if (t < indexDistance) { + return 0; + } + int lineWidth = 0; + for (int index = t - indexDistance; index >= 0; index--) { + lineWidth += fontMetrics.charWidth(text.charAt(index)); + lineTextBuf.insert(0, text.charAt(index)); + if (!isPunctuation(text.charAt(index))) { + break; + } + } + return lineWidth; + } + + private static void dealWithTextNumOrLetter(String text, int t, List lineTextList, double width, int[] tmpWidth, + StringBuffer wordBuf, StringBuffer lineTextBuf, FontMetrics fontMetrics) { + if (tmpWidth[0] + fontMetrics.charWidth(text.charAt(t)) > width) { + if (tmpWidth[1] > 0) { + lineTextList.add(lineTextBuf.toString()); + lineTextBuf.delete(0, lineTextBuf.length()); + tmpWidth[1] = 0; + } + + lineTextList.add(wordBuf.toString()); + wordBuf.delete(0, wordBuf.length()); + tmpWidth[0] = 0; + } + + wordBuf.append(text.charAt(t)); + tmpWidth[0] += fontMetrics.charWidth(text.charAt(t)); + } + + private static void dealWithTextChangeLineSymbol(String text, int t, List lineTextList, double width, int[] tmpWidth, + StringBuffer wordBuf, StringBuffer lineTextBuf, FontMetrics fontMetrics) { + wordBuf.append('\n'); + if (tmpWidth[1] + tmpWidth[0] > width && lineTextBuf.length() > 0) { + lineTextList.add(lineTextBuf.toString()); + lineTextList.add(wordBuf.toString()); + } else { + lineTextBuf.append(wordBuf); + lineTextList.add(lineTextBuf.toString()); + } + lineTextBuf.delete(0, lineTextBuf.length()); + tmpWidth[1] = 0; + wordBuf.delete(0, wordBuf.length()); + tmpWidth[0] = 0; + } + + private static void dealWidthTextManualChangeLine(String text, int t, List lineTextList, double width, int[] tmpWidth, + StringBuffer wordBuf, StringBuffer lineTextBuf, FontMetrics fontMetrics) { + t++;// 忽略'n'字符. + wordBuf.append('\n'); + if (tmpWidth[1] + tmpWidth[0] > width && lineTextBuf.length() > 0) { + lineTextList.add(lineTextBuf.toString()); + lineTextList.add(wordBuf.toString()); + } else { + lineTextBuf.append(wordBuf); + lineTextList.add(lineTextBuf.toString()); + } + lineTextBuf.delete(0, lineTextBuf.length()); + tmpWidth[1] = 0; + wordBuf.delete(0, wordBuf.length()); + tmpWidth[0] = 0; + } + + + /** + * @param cuChar + * @return + * @see StableUtils + * @deprecated + */ + public static boolean isNum(char cuChar) { + return StableUtils.isNum(cuChar); + } + + + /** + * 判断字符是否为数字或字母 + * + * @param curChar 被检查的字符 + * @return 是否为数字或字母 + */ + public static boolean isNumOrLetter(char curChar) { + return GeneralUtils.isLetter(curChar) || StableUtils.isNum(curChar); + } + + public static boolean isPunctuation(char c) { + int type = Character.getType(c); + return type == Character.OTHER_PUNCTUATION + || type == Character.DASH_PUNCTUATION + || type == Character.START_PUNCTUATION + || type == Character.END_PUNCTUATION + || type == Character.CONNECTOR_PUNCTUATION; + } + + + public static List getLineTextList(String text, Style style, Font font, double paintHeight, double paintWidth) { + return getLineTextList(text, style, font, paintHeight, paintWidth, Constants.DEFAULT_PRINT_AND_EXPORT_RESOLUTION); + } + + /** + * james daniel 放一起 + * 同时含有height和width参数表示会根据style自动判断字体为竖排还是横排 + * TODO + */ + public static List getLineTextList(String text, Style style, Font font, double paintHeight, double paintWidth, int resolution) { + //正常文字 + if (style == null + || style.getVerticalText() != Style.VERTICALTEXT) {//james:正常的文字时 + return BaseUtils.getLineTextList(text, style, font, paintWidth, resolution); + } + ExtraClassManagerProvider pluginProvider = PluginModule.getAgent(PluginModule.ExtraCore); + if (pluginProvider != null) { + VerticalTextProcessor processor = pluginProvider.getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class); + String[] res = processor.process(text, style, font, paintHeight, paintWidth, resolution); + return Arrays.asList(res); + } + String[] res = new DefaultVerticalTextProcessor().process(text, style, font, paintHeight, paintWidth, resolution); + return Arrays.asList(res); + } + + /** + * 返回边框宽 + * + * @param borderType 边框类型 + * @return 宽度 + */ + public static int getBorderWidth(int borderType) { + switch (borderType) { + case Constants.LINE_NONE: + return 0; + case Constants.LINE_SLIM: + return 1; + case Constants.LINE_THIN: + return 1; + case Constants.LINE_DASH: + return 1; + case Constants.LINE_HAIR: + return 1; + case Constants.LINE_HAIR2: + return 1; + case Constants.LINE_THICK: + return 3; + case Constants.LINE_DOT: + return 1; + default: + return 2; + } + } + + /** + * 将边框转为对应的字符串描述 + * + * @param borderStyle 边框线型 + * @return web端对应的边框 + */ + public static String border2Style(int borderStyle) { + switch (borderStyle) { + case Constants.LINE_NONE: + return "none"; + case Constants.LINE_SLIM: + return "solid"; + case Constants.LINE_THIN: + return "solid"; + case Constants.LINE_MEDIUM: + return "solid"; + case Constants.LINE_THICK: + return "solid"; + case Constants.LINE_DOUBLE: + return "double"; + case Constants.LINE_DOT: + return "double"; + case Constants.LINE_DASH_DOT: + return "double"; + case Constants.LINE_DASH_DOT_DOT: + return "dotted"; + default: + return "dashed"; + } + } + + /** + * 克隆对象 + * + * @param object 对象 + * @return 克隆出的对象 + * @throws CloneNotSupportedException 不被支持的克隆异常 + * @see StableUtils#cloneObject(Object) + * @deprecated + */ + public static Object cloneObject(Object object) throws CloneNotSupportedException { + return StableUtils.cloneObject(object); + } + + + /** + * 把java.util.Map转成一段JSONObject的String与上面方法对应 + * + * @param map map对象 + * @return json对象 + * @throws JSONException json异常 + */ + public static JSONObject map2JSON(Map map) throws JSONException { + JSONObject jo = new JSONObject(); + Iterator iter = map.keySet().iterator(); + while (iter.hasNext()) { + Map.Entry entry = (Map.Entry) iter.next(); + Object value = entry.getValue(); + if (value instanceof FArray) { + JSONArray ja = new JSONArray(); + FArray array = (FArray) value; + for (int i = 0; i < array.length(); i++) { + ja.put(array.elementAt(i)); + } + value = ja; + } + jo.put((String) entry.getKey(), value); + } + return jo; + } + + /** + * 将一个对象转化成json样式的字符串 + * + * @param o 待转化的对象 + * @return json样式的字符串 + * @throws JSONException json异常 + * @see EmbedJson#encode(Object) (Object) + * @deprecated + */ + public static String jsonEncode(Object o) throws JSONException { + return EmbedJson.encode(o); + } + + + /** + * 将一个字符串转化成JSON格式的对象 + * + * @param str 要转化的字符串 + * @return JSON格式的对象 + * @throws JSONException json异常 + * @see JSONUtils#jsonDecode(String) + * @deprecated + */ + public static Object jsonDecode(String str) throws JSONException { + return JSONUtils.jsonDecode(str); + } + + /** + * 检查图片1和2是否相同. + * + * @param img1 图片1 + * @param img2 图片2 + * @return 图片1和2是否相同 + */ + public static boolean imageEquals(Image img1, Image img2) { + if (img1 == img2) { + return true; + } + + if (img1 == null || img2 == null) {//null < not null + return img1 == null && img2 == null; + } + + //开始比较图片. + byte[] buf1 = GeneralXMLTools.imageEncode(img1); + byte[] buf2 = GeneralXMLTools.imageEncode(img2); + if (buf1.length != buf2.length) { + return false; + } + + for (int i = 0; i < buf1.length; i++) { + if (buf1[i] != buf2[i]) { + return false; + } + } + + return true; + } + + /** + * 根据数据集名获取数据模型 + * + * @param cal 算子 + * @param tdName 列表名 + * @return 数据模型 + */ + public static DataModel getDataModelFromTableDataName(Calculator cal, String tdName) { + String tableDataName = tdName; + //先看当前的报表中的私有数据源 + DataModel resultSet = SynchronizedLiveDataModelUtils.getSELiveDataModel4Share(cal, tableDataName); + if (resultSet == null) { + TableData td = TableDataAssist.getTableData(cal, tableDataName); + resultSet = td == null ? null : td.createDataModel(cal); + } + return resultSet; + } + + + /** + * kunsnat: List转化为二维表 + * + * @param list 列表 + * @return 二维数组 + */ + public static Object[][] list2Array2D(List list) { + int rowNum = list.size(); + int colNum = 0; + for (int i = 0; i < rowNum; i++) { + List row = (List) list.get(i); + if (row.size() > colNum) { + colNum = row.size(); + } + } + Object[][] result = new Object[rowNum][colNum]; + + for (int i = 0; i < rowNum; i++) { + List row = (List) list.get(i); + for (int j = 0; j < colNum; j++) { + if (j < row.size()) { + result[i][j] = row.get(j); + } else { + result[i][j] = null; + } + } + } + + return result; + } + + /** + * 判断当前Env下是否有lic文件 + * + * @return 判断当前Env下是否有lic文件 + */ + public static boolean checkLicExist() { + + if (ServerPreferenceConfig.getInstance().isLicUseLock()) { + return true;//加密狗 + } else if (!LicenseConfigManager.getInstance().isUseFile()) { + //不使用文件,说明用户配置了注册信息,一定是注册了 + return true; + } + + try { + String licName = FRContext.getCommonOperator().getLicenseName(); + byte[] bytes = WorkContext.getWorkResource().readFully(StableUtils.pathJoin(ProjectConstants.RESOURCES_NAME, licName)); + return bytes != null && bytes.length != 0; + } catch (Exception ignored) { + } + + return false; + } + + /** + * 判断是否内容为图表相关. + * + * @param cellOption 单元格属性 + * @return 返回是否为图表单元格相关. + */ + public static boolean isChartCell(JSONObject cellOption) { + if (cellOption != null) { + JSONObject value = cellOption.optJSONObject("value"); + if (value != null) { + return ComparatorUtils.equals("simplechart", value.optString("type")); + } + } + + return false; + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/common/FormDesignerUtil.java b/designer-form/src/main/java/com/fr/design/fit/common/FormDesignerUtil.java new file mode 100644 index 000000000..6e0739a01 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/common/FormDesignerUtil.java @@ -0,0 +1,45 @@ +package com.fr.design.fit.common; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XElementCase; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.form.FormElementCaseProvider; +import com.fr.form.ui.ElementCaseEditor; + +import java.util.Iterator; +import java.util.List; + +/** + * Created by kerry on 2020-06-12 + */ +public class FormDesignerUtil { + private FormDesignerUtil(){ + + } + public static XElementCase getXelementCase(XLayoutContainer rootContainer, FormElementCaseProvider elementCaseProvider) { + for (int i = 0; i < rootContainer.getComponentCount(); i++) { + XCreator creator = rootContainer.getXCreator(i); + if (creator instanceof XElementCase && elementCaseProvider == ((ElementCaseEditor) creator.toData()).getElementCase()) { + return (XElementCase) creator; + } + if (creator instanceof XLayoutContainer) { + XElementCase temp = getXelementCase((XLayoutContainer) creator, elementCaseProvider); + if (temp != null) { + return temp; + } + } + } + return null; + } + + + public static void removeDeletedEC(List currentECList, List waitToProcessECList) { + Iterator iterator = waitToProcessECList.iterator(); + while (iterator.hasNext()) { + Object editor = iterator.next(); + if (!currentECList.contains(editor)) { + iterator.remove(); + } + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/common/LayoutTool.java b/designer-form/src/main/java/com/fr/design/fit/common/LayoutTool.java new file mode 100644 index 000000000..6bebbbbe8 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/common/LayoutTool.java @@ -0,0 +1,177 @@ +package com.fr.design.fit.common; + +import com.fr.design.designer.creator.XCreator; +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.designer.creator.cardlayout.XWCardLayout; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; +import com.fr.design.fit.NewJForm; +import com.fr.design.mainframe.FormArea; +import com.fr.design.mainframe.JForm; +import com.fr.design.utils.gui.LayoutUtils; +import com.fr.form.ui.container.WAbsoluteBodyLayout; +import com.fr.form.ui.container.WFitLayout; +import com.fr.form.ui.container.WLayout; +import com.fr.form.ui.widget.CRBoundsWidget; +import com.fr.general.FRScreen; +import com.fr.log.FineLoggerFactory; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Rectangle; +import java.awt.Toolkit; + +/** + * @description:布局工具类 + * @author: Henry.Wang + * @create: 2020/09/03 14:18 + */ +public class LayoutTool { + /** + * @Description: 获取布局类型 + * @param jForm + * @return: + * @Author: Henry.Wang + * @date: 2020/9/6 14:31 + */ + public static int getFormLayoutType(JForm jForm) { + JForm tempJForm = jForm; + if (tempJForm == null) + tempJForm = TemplateTool.getCurrentEditingNewJForm(); + if (tempJForm == null || tempJForm.getFormDesign().getRootComponent() == null) + return -1; + return ((WFitLayout) tempJForm.getFormDesign().getRootComponent().toData()).getBodyLayoutType().getTypeValue(); + + } + + /** + * @Description: 是否为绝对布局 + * @param jForm + * @return: + * @Author: Henry.Wang + * @date: 2020/9/6 14:31 + */ + public static boolean absoluteLayoutForm(NewJForm jForm) { + if (getFormLayoutType(jForm) == 1) + return true; + return false; + } + + /** + * @Description: 如果为绝对布局则获取XWAbsoluteBodyLayout,否则返回null + * @param jForm + * @return: + * @Author: Henry.Wang + * @date: 2020/9/6 14:26 + */ + public static XWAbsoluteBodyLayout getXWAbsoluteBodyLayout(NewJForm jForm) { + NewJForm tempJForm = jForm; + if (tempJForm == null) + tempJForm = TemplateTool.getCurrentEditingNewJForm(); + if (tempJForm != null) { + if (absoluteLayoutForm(tempJForm)) { + XLayoutContainer xLayoutContainer = tempJForm.getFormDesign().getRootComponent(); + if (xLayoutContainer != null && xLayoutContainer.getComponentCount() > 0) { + Component component = xLayoutContainer.getComponent(0); + if (component instanceof XWAbsoluteBodyLayout) { + return (XWAbsoluteBodyLayout) component; + } + } + } + } + return null; + } + + /** + * @Description: 通过子组件的位置获取绝对布局body的尺寸。为什么不直接调用getRootComponent().toData().getContentHeight()呢?因为在截断的情况下就不不一致了 + * @param newJForm + * @return: + * @Author: Henry.Wang + * @date: 2020/9/11 15:24 + */ + public static Rectangle getAbsoluteBodySize(NewJForm newJForm) { + int width = 0; + int height = 0; + XWAbsoluteBodyLayout xwAbsoluteBodyLayout = LayoutTool.getXWAbsoluteBodyLayout(newJForm); + if (xwAbsoluteBodyLayout != null) { + WAbsoluteBodyLayout wAbsoluteBodyLayout = xwAbsoluteBodyLayout.toData(); + if (wAbsoluteBodyLayout.getWidgetCount() > 0) { + for (int i = 0; i < wAbsoluteBodyLayout.getWidgetCount(); i++) { + Rectangle rectangle = ((CRBoundsWidget) wAbsoluteBodyLayout.getWidget(i)).getBounds(); + if (rectangle.x + rectangle.width > width) + width = rectangle.x + rectangle.width; + if (rectangle.y + rectangle.height > height) + height = rectangle.y + rectangle.height; + } + } + } + return new Rectangle(0, 0, width, height); + } + + + public static int getBodyHeight(NewJForm newJForm) { + return newJForm.getFormDesign().getRootComponent().toData().getContentHeight(); + } + + public static int getBodyWidth(NewJForm newJForm) { + return newJForm.getFormDesign().getRootComponent().toData().getContentWidth(); + } + + /** + * @Description: 对绝对画布块里的组件进行缩放 + * @param xCreator + * @param scale 缩放比例 + * @return: + * @Author: Henry.Wang + * @date: 2020/10/26 20:39 + */ + public static void scaleAbsoluteBlockComponentsBounds(XCreator xCreator, Double scale) { + try { + Component[] components = xCreator.getComponents(); + for (Component component : components) { + if (component instanceof XWCardMainBorderLayout) { + XWCardLayout xwCardLayout = ((XWCardMainBorderLayout)component).getCardPart(); + for (Component tabComponent : xwCardLayout.getComponents()) { + scaleAbsoluteBlockComponentsBounds((XCreator) tabComponent, scale); + scaleAbsoluteBlockComponentsBoundsInternal((XCreator) tabComponent, scale); + } + } else if (component instanceof XWAbsoluteLayout) { + scaleAbsoluteBlockComponentsBounds((XCreator) component, scale); + scaleAbsoluteBlockComponentsBoundsInternal((XCreator) component, scale); + } + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } + + } + + public static void scaleAbsoluteBlockComponentsBoundsInternal(XCreator parentXCreator, Double scale) { + if (parentXCreator instanceof XWAbsoluteLayout) { + XWAbsoluteLayout xwAbsoluteLayout = (XWAbsoluteLayout) parentXCreator; + Component[] absoluteComponents = xwAbsoluteLayout.getComponents(); + for (Component absoluteComponent : absoluteComponents) { + XCreator xCreator = (XCreator) absoluteComponent; + Rectangle bounds = new Rectangle(absoluteComponent.getBounds()); + Rectangle newBounds = new Rectangle((int) (bounds.x * scale), (int) (bounds.y * scale), (int) (bounds.width * scale), (int) (bounds.height * scale)); + WLayout wAbsoluteLayout = xwAbsoluteLayout.toData(); + wAbsoluteLayout.setBounds(xCreator.toData(), newBounds); + xCreator.setBounds(newBounds); + LayoutUtils.layoutContainer(xCreator); + } + } + } + + /** + * @Description: 获取老预览时的缩放比例 + * @return: + * @Author: Henry.Wang + * @date: 2020/10/26 20:39 + */ + public static double getContainerPercent(){ + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + double screenValue = FRScreen.getFRScreenByDimension(screen).getValue(); + return screenValue / FormArea.DEFAULT_SLIDER; + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/common/NewFormStyle.java b/designer-form/src/main/java/com/fr/design/fit/common/NewFormStyle.java new file mode 100644 index 000000000..a937ba2d4 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/common/NewFormStyle.java @@ -0,0 +1,2030 @@ +/* + * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. + */ +package com.fr.design.fit.common; + +import com.fr.base.BaseFormula; +import com.fr.base.CoreDecimalFormat; +import com.fr.base.FRContext; +import com.fr.base.FormatRepository; +import com.fr.base.GraphHelper; +import com.fr.base.ImageProvider; +import com.fr.base.Painter; +import com.fr.base.Style; +import com.fr.base.Utils; +import com.fr.base.background.ImageBackground; +import com.fr.common.annotations.Open; +import com.fr.data.DataBaseUtils; +import com.fr.general.Background; +import com.fr.general.ComparatorUtils; +import com.fr.general.DateUtils; +import com.fr.general.DefaultValues; +import com.fr.general.FRFont; +import com.fr.general.GeneralUtils; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.stable.AssistUtils; +import com.fr.stable.Constants; +import com.fr.stable.CoreGraphHelper; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.unit.PT; +import com.fr.stable.web.Repository; +import com.fr.stable.web.ServletContext; +import com.fr.stable.web.ServletContextAdapter; +import org.jetbrains.annotations.Nullable; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Paint; +import java.awt.Rectangle; +import java.awt.Shape; +import java.awt.geom.Rectangle2D; +import java.io.InvalidObjectException; +import java.io.Serializable; +import java.sql.Clob; +import java.text.DateFormat; +import java.text.Format; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * 用于表示样式的类,包括边框、颜色、字体、缩进、间距等 + * 注意:这是一个开放类,所有的修改都要注意保持兼容 + */ +@Open +public class NewFormStyle extends Style implements Serializable, Cloneable { + + // temp rectangle + private static Rectangle2D tempRectangle2D = new Rectangle2D.Double(0, 0, 0, 0); + + public static final int TEXTSTYLE_WRAPTEXT = 0; // 换行. + public static final int TEXTSTYLE_SINGLELINE = 1; // 单行,超出部分不显示. + public static final int TEXTSTYLE_SINGLELINEADJUSTFONT = 2; // 单行,调整字体来显示所有的字. + public static final int TEXTSTYLE_MULTILINEADJUSTFONT = 3; //多行,固定单元格高和宽,调整字体来显示所有的字 + + public static final int VERTICALTEXT = 1;// 竖排,与Excel中的设置值相同 + public static final int HORIZONTALTEXT = 0;// 横排 + + public static final int LEFT_TO_RIGHT = 1;// JAMES:垂直文字时,文字为从左向右顺序排列 + public static final int RIGHT_TO_LEFT = 0;// JAMES:垂直文字时,文字为从右向左顺序排列 + + //EXCEL 宋体11号字, 一个缩进单位对应96dpi下27px + public static final int PADDING_ARG = 27; + public static final int DEFAULT_PADDING = 2; + /** + * 细线透明度值 + */ + public static final double FACTORY_ALPHA = 0.4; + public static final NewFormStyle NULL_STYLE = null; + + /** + * Default Style + */ + public static final NewFormStyle DEFAULT_STYLE = new NewFormStyle(); + + /** + * Border Style + */ + public static final NewFormStyle BORDER_STYLE = new NewFormStyle(); + + private static final long serialVersionUID = -1675056857456167839L; + private static final int MAX_FONT_SIZE = 100; + private static final int N_SIZE = 9; + private static final int MIN_SIZE = 8; + private static final int MAX_SIZE = 26; + + private static final int LINE_HEIGHT_FIX = 4; + private static final int LINE_HEIGHT_FIX2 = 3; + + private static class ContentLineGroup { + Style style; + List newLineTextList; + int newTextHeight; + + public ContentLineGroup(Style style, List lineList, int textHeight) { + this.style = style; + this.newLineTextList = lineList; + this.newTextHeight = textHeight; + } + + public int totalHeight() { + return newTextHeight * newLineTextList.size(); + } + } + + private static Map clsFontFamily = null; + + // 全局Style的map + private static Map initializeStyle = new ConcurrentHashMap();// + + static { + ServletContext.addServletContextListener(new ServletContextAdapter() { + @Override + public void onServletStop() { + initializeStyle.clear(); + } + }); + } + + // format + private Format format = null; + + // element font. + private FRFont frFont = null; + + private Background background = null; + + // border. + private byte border_top = Constants.LINE_NONE; + private byte border_left = Constants.LINE_NONE; + private byte border_bottom = Constants.LINE_NONE; + private byte border_right = Constants.LINE_NONE; + private Color border_top_color = Color.BLACK; + private Color border_left_color = Color.BLACK; + private Color border_bottom_color = Color.BLACK; + private Color border_right_color = Color.BLACK; + + // alignment. + private int horizontal_alignment = Constants.NULL; + private int vertical_alignment = Constants.CENTER; + + // TextStyle + private int textStyle = NewFormStyle.TEXTSTYLE_WRAPTEXT; + + // james: verticalText + private int verticalText = NewFormStyle.HORIZONTALTEXT;// 默认为0,水平方向 + + // james: the direction of text when the text is vertical + private int textDirection = NewFormStyle.RIGHT_TO_LEFT;// 默认为从右向左的顺序 + + private int rotation = 0; + + private byte imageLayout = Constants.IMAGE_CENTER;//现在默认改为center了 + + //padding有两个计量单位, 一种是以前的pt, 一种是现在的, 为了兼容excel的 + //设计器中设置1个单位, 兼容为以前的27pt + // 左缩进 + private int paddingLeft = DEFAULT_PADDING; + // 右缩进 + private int paddingRight = DEFAULT_PADDING; + + // 段前间距 + private byte spacingBefore = 0; + // 段后间距 + private byte spacingAfter = 0; + // 行间距h + private byte lineSpacing = 0; + + private String contentClsCss = StringUtils.EMPTY; + private Map contentStyleCssMap = new HashMap(); + + private String borderClsCss = StringUtils.EMPTY; + private Map borderStyleCssMap = new HashMap(); + + /** + * Constructor. + */ + protected NewFormStyle() { + //peter:这里主动从Context, 获得默认的FRFont的值. + DefaultValues defaultValues = FRContext.getDefaultValues(); + this.frFont = defaultValues.getFRFont(); + + // HTML输出 CSS初始化 + this.contentClsCss = this.contentStyle2class(this.contentStyleCssMap); + this.borderClsCss = this.border2Class(this.borderStyleCssMap); + } + + private NewFormStyle(Background background, Format format, FRFont frFont, + int border_top, Color border_top_color, int border_bottom, Color border_bottom_color, + int border_left, Color border_left_color, int border_right, Color border_right_color, + int horizontal_alignment, int vertical_alignment, int textStyle, + int verticalText, int textDirection, int rotation, int imageLayout, + int paddingLeft, int paddingRight, int spacingBefore, int spacingAfter, int lineSpacing) { + this.background = background; + this.format = format; + this.frFont = frFont; + + this.border_top = (byte) border_top; + this.border_top_color = border_top_color; + this.border_bottom = (byte) border_bottom; + this.border_bottom_color = border_bottom_color; + this.border_left = (byte) border_left; + this.border_left_color = border_left_color; + this.border_right = (byte) border_right; + this.border_right_color = border_right_color; + + this.horizontal_alignment = (byte) horizontal_alignment; + this.vertical_alignment = (byte) vertical_alignment; + this.textStyle = (byte) textStyle; + + this.verticalText = (byte) verticalText; + this.textDirection = (byte) textDirection; + this.rotation = (short) rotation; + this.imageLayout = (byte) imageLayout; + + this.paddingLeft = paddingLeft; + this.paddingRight = paddingRight; + + this.spacingBefore = (byte) spacingBefore; + this.spacingAfter = (byte) spacingAfter; + this.lineSpacing = (byte) lineSpacing; + + // HTML输出 CSS初始化 + this.contentClsCss = this.contentStyle2class(this.contentStyleCssMap); + this.borderClsCss = this.border2Class(this.borderStyleCssMap); + } + + private static Map getclsFontFamily() { + if (clsFontFamily == null) { + clsFontFamily = new HashMap() { + { + put("Arial Black", "fnab"); + put("Basic Sans SF", "fnbs"); + put("Book Antiqua", "fnba"); + put("Calibri", "fnci"); + put("Comic Sans MS", "fncs"); + put("Courier New", "fncn"); + put("Elementary SF", "fnes"); + put("Garamond", "fngd"); + put("Georgia", "fnga"); + put("Letter Gothic", "fnlg"); + put("Lucida Console", "fnlc"); + put("Marigold", "fnmd"); + put("MS Sans Serif", "fnms"); + put("MS Gothic", "fnmg"); + put("MS PGothic", "fnmpg"); + put("MS Mincho", "fnmm"); + put("MS P Mincho", "fnmpm"); + put("MingLiU", "fnml"); + put("SimHei", "fnsh"); + put("System", "fnsm"); + put("Tahoma", "fnta"); + put("Times New Roman", "fntn"); + put("Trebuchet MS", "fntms"); + put("Verdana", "fnva"); + + put("SimSun", "fnss"); + put("Arial", "fnar"); + put("Microsoft YaHei", "fnyh"); + put("KaiTi", "fnkt"); + } + }; + } + + return clsFontFamily; + } + + /** + * 设置样式 + * + * @param format 格式g + * @return 样式y + */ + public NewFormStyle deriveFormat(Format format) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 获取实例 + */ + public static NewFormStyle getInstance(Format format) { + return DEFAULT_STYLE.deriveFormat(format); + } + + /** + * 设置字体 + * + * @param frFont 字体 + * @return 样式 + */ + public NewFormStyle deriveFRFont(FRFont frFont) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * getInstance + */ + public static NewFormStyle getInstance() { + NewFormStyle style = new NewFormStyle(); + + Object valueStyle = initializeStyle.get(style); + if (valueStyle != null) { + return (NewFormStyle) valueStyle; + } else { + initializeStyle.put(style, style); + return style; + } + } + + /** + * getInstance + */ + private static NewFormStyle getInstance(Background background, Format format, FRFont frFont, + int border_top, Color border_top_color, int border_bottom, Color border_bottom_color, + int border_left, Color border_left_color, int border_right, Color border_right_color, + int horizontal_alignment, int vertical_alignment, int textStyle, + int verticalText, int textDirection, int rotation, int imageLayout, + int paddingLeft, int paddingRight, int spacingBefore, int spacingAfter, int lineSpacing) { + NewFormStyle style = new NewFormStyle(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + + Object valueStyle = initializeStyle.get(style); + if (valueStyle != null) { + return (NewFormStyle) valueStyle; + } else { + initializeStyle.put(style, style); + return style; + } + } + + /** + * getInstance + */ + public static NewFormStyle getInstance(FRFont frFont) { + if (frFont == null) { + return NewFormStyle.getInstance(); + } + return DEFAULT_STYLE.deriveFRFont(frFont); + } + + /** + * 设置背景 + * + * @param background 背景 b + * @return 样式 y + */ + public NewFormStyle deriveBackground(Background background) { + if (background instanceof ImageBackground) { + return new NewFormStyle(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * getInstance + */ + public static NewFormStyle getInstance(Background background) { + return DEFAULT_STYLE.deriveBackground(background); + } + + /** + * 去掉边框和单元格背景 + * + * @return 样式y + */ + public NewFormStyle deriveBorderBackgroundNone() { + return getInstance(null, format, frFont, + Constants.LINE_NONE, border_top_color, Constants.LINE_NONE, border_bottom_color, + Constants.LINE_NONE, border_left_color, Constants.LINE_NONE, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置边框 + * + * @param border_top 上边框像素 + * @param border_top_color 上边框颜色s + * @param border_bottom 下 x + * @param border_bottom_color 下 x + * @param border_left 左 z + * @param border_left_color 左z + * @param border_right 右y + * @param border_right_color 右y + * @return 样式y + */ + public NewFormStyle deriveBorder(int border_top, Color border_top_color, + int border_bottom, Color border_bottom_color, + int border_left, Color border_left_color, + int border_right, Color border_right_color) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置上边框 + * + * @param border_top 上边框尺寸s + * @param border_top_color 上边框颜色 s + * @return 样式 y + */ + public NewFormStyle deriveBorderTop(int border_top, Color border_top_color) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置下边框 + * + * @param border_bottom 下边框尺寸 x + * @param border_bottom_color 下颜色x + * @return 样式y + */ + public NewFormStyle deriveBorderBottom(int border_bottom, Color border_bottom_color) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置左边框 + * + * @param border_left 尺寸 z + * @param border_left_color 颜色y + * @return 样式y + */ + public NewFormStyle deriveBorderLeft(int border_left, Color border_left_color) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置右边框 + * + * @param border_right 尺寸 c + * @param border_right_color 颜色 y + * @return 样式 y + */ + public NewFormStyle deriveBorderRight(int border_right, Color border_right_color) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置水平方向 + * + * @param horizontal_alignment 水平方向s + * @return 样式 y + */ + public NewFormStyle deriveHorizontalAlignment(int horizontal_alignment) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置垂直方向 + * + * @param vertical_alignment 垂直方向c + * @return 样式 + * @see Constants#TOP + * @see Constants#CENTER + * @see Constants#BOTTOM + */ + public NewFormStyle deriveVerticalAlignment(int vertical_alignment) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置单元格展示样式(自动换行, 单行显示, 多行显示等) + * + * @param textStyle 文字样式 + * @return 样式 + * @see NewFormStyle#TEXTSTYLE_WRAPTEXT + * @see NewFormStyle#TEXTSTYLE_SINGLELINE + * @see NewFormStyle#TEXTSTYLE_SINGLELINEADJUSTFONT + * @see NewFormStyle#TEXTSTYLE_MULTILINEADJUSTFONT + */ + public NewFormStyle deriveTextStyle(int textStyle) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置单元格方向 + * + * @param textDirection 文本方向w + * @return 样式t + */ + public NewFormStyle deriveTextDirection(int textDirection) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置单元格垂直方向 + * + * @param verticalText 垂直方向c + * @return 样式 + */ + public NewFormStyle deriveVerticalText(int verticalText) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置旋转方向 + * + * @param rotation 旋转方向 the new rotation of cell (between -90 and 90 degrees). + * @return 样式 + */ + public NewFormStyle deriveRotation(int rotation) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置图片布局 + * + * @param imageLayout the new image layout 图片布局t + * @return 样式 + * @see Constants#IMAGE_TILED + * @see Constants#IMAGE_CENTER + * @see Constants#IMAGE_EXTEND + */ + public NewFormStyle deriveImageLayout(int imageLayout) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置缩进 + * + * @param paddingLeft 左缩进 + * @param paddingRight 右缩进 + * @return 样式 + */ + public NewFormStyle derivePadding(int paddingLeft, int paddingRight) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置左缩进 + * + * @param paddingLeft 左缩进 + * @return 样式 + */ + public NewFormStyle derivePaddingLeft(int paddingLeft) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置右缩进 + * + * @param paddingRight 右缩进 + * @return 样式 + */ + public NewFormStyle derivePaddingRight(int paddingRight) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置段前间距 + * + * @param spacingBefore 段前间距d + * @return 样式 y + */ + public NewFormStyle deriveSpacingBefore(int spacingBefore) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置段后间距 + * + * @param spacingAfter 段后间距d + * @return 样式y + */ + public NewFormStyle deriveSpacingAfter(int spacingAfter) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 设置行间距 + * + * @param lineSpacing 行间距h + * @return 样式y + */ + public NewFormStyle deriveLineSpacing(int lineSpacing) { + return getInstance(background, format, frFont, + border_top, border_top_color, border_bottom, border_bottom_color, + border_left, border_left_color, border_right, border_right_color, + horizontal_alignment, vertical_alignment, textStyle, + verticalText, textDirection, rotation, imageLayout, + paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); + } + + /** + * 对象转为json格式 + * + * @param repo 浏览器上下文 + * @param size 单元格大小 + * @return json格式数据 + */ + public JSONObject toJSONObject(Repository repo, Dimension size) throws JSONException { + JSONObject jo = new JSONObject(); + if (background != null) { + jo.put("background", background.toJSONObject(repo, size)); + } + // 不是默认值才输出,节省流量 + if (frFont != null && !ComparatorUtils.equals(frFont, FRContext.getDefaultValues().getFRFont())) { + jo.put("font", frFont.toJSONObject(repo)); + } + + if (!checkLeftRightTopBottom4b0()) { + jo.put("border", border2JSONObject()); + jo.put("borderCss", borderClsCss); + } + + createAlignAndTextStyleConfig(jo); + if (rotation != 0) { + jo.put("ro", rotation); + } + if (imageLayout != Constants.IMAGE_CENTER) { + jo.put("il", imageLayout); + } + createSpacingAndPaddingConfig(jo); + + return jo; + } + + private void createAlignAndTextStyleConfig(JSONObject jo) throws JSONException { + if (horizontal_alignment != Constants.NULL) { + jo.put("ha", horizontal_alignment); + } + if (vertical_alignment != Constants.CENTER) { + jo.put("va", vertical_alignment); + } + if (textStyle != TEXTSTYLE_WRAPTEXT) { + jo.put("ts", textStyle); + } + if (verticalText != NewFormStyle.HORIZONTALTEXT) { + jo.put("vt", verticalText); + } + if (textDirection != RIGHT_TO_LEFT) { + jo.put("td", textDirection); + } + jo.put("contentCss", contentClsCss); + } + + private void createSpacingAndPaddingConfig(JSONObject jo) throws JSONException { + if (paddingLeft != DEFAULT_PADDING) { + jo.put("pl", paddingLeft); + } + if (paddingRight != DEFAULT_PADDING) { + jo.put("pr", paddingRight); + } + if (spacingBefore != 0) { + jo.put("sb", spacingBefore); + } + if (spacingAfter != 0) { + jo.put("sa", spacingAfter); + } + if (lineSpacing != 0) { + jo.put("ls", lineSpacing); + } + } + + /** + * 获取字体 + */ + public FRFont getFRFont() { + if (this.frFont == null) { + this.frFont = FRContext.getDefaultValues().getFRFont(); + } + return this.frFont; + } + + /** + * Gets cell format. + */ + public Format getFormat() { + return this.format; + } + + /** + * Gets background. + */ + public Background getBackground() { + return this.background; + } + + /** + * Gets the type of border to use for the top border of the cell. + * + * @see Constants#LINE_NONE + * @see Constants#LINE_THIN + * @see Constants#LINE_MEDIUM + * @see Constants#LINE_DASH + * @see Constants#LINE_HAIR + * @see Constants#LINE_HAIR2 + * @see Constants#LINE_THICK + * @see Constants#LINE_DOUBLE + * @see Constants#LINE_DOT + * @see Constants#LINE_MEDIUM_DASH + * @see Constants#LINE_DASH_DOT + * @see Constants#LINE_MEDIUM_DASH_DOT + * @see Constants#LINE_DASH_DOT_DOT + * @see Constants#LINE_MEDIUM_DASH_DOT_DOT + * @see Constants#LINE_SLANTED_DASH_DOT + */ + public int getBorderTop() { + return this.border_top; + } + + /** + * 获取上边框线的宽度 + */ + public int getBorderTopWidth() { + return GraphHelper.getLineStyleSize(this.getBorderTop()); + } + + /** + * Gets the type of border to use for the left border of the cell. + * + * @see Constants#LINE_NONE + * @see Constants#LINE_THIN + * @see Constants#LINE_MEDIUM + * @see Constants#LINE_DASH + * @see Constants#LINE_HAIR + * @see Constants#LINE_HAIR2 + * @see Constants#LINE_THICK + * @see Constants#LINE_DOUBLE + * @see Constants#LINE_DOT + * @see Constants#LINE_MEDIUM_DASH + * @see Constants#LINE_DASH_DOT + * @see Constants#LINE_MEDIUM_DASH_DOT + * @see Constants#LINE_DASH_DOT_DOT + * @see Constants#LINE_MEDIUM_DASH_DOT_DOT + * @see Constants#LINE_SLANTED_DASH_DOT + */ + public int getBorderLeft() { + return this.border_left; + } + + public int getBorderLeftWidth() { + return GraphHelper.getLineStyleSize(this.getBorderLeft()); + } + + public int getBorderRightWidth() { + return GraphHelper.getLineStyleSize(this.getBorderRight()); + } + + public int getBorderBottomWidth() { + return GraphHelper.getLineStyleSize(this.getBorderBottom()); + } + + /** + * Gets the type of border to use for the bottom border of the cell. + * + * @see Constants#LINE_NONE + * @see Constants#LINE_THIN + * @see Constants#LINE_MEDIUM + * @see Constants#LINE_DASH + * @see Constants#LINE_HAIR + * @see Constants#LINE_HAIR2 + * @see Constants#LINE_THICK + * @see Constants#LINE_DOUBLE + * @see Constants#LINE_DOT + * @see Constants#LINE_MEDIUM_DASH + * @see Constants#LINE_DASH_DOT + * @see Constants#LINE_MEDIUM_DASH_DOT + * @see Constants#LINE_DASH_DOT_DOT + * @see Constants#LINE_MEDIUM_DASH_DOT_DOT + * @see Constants#LINE_SLANTED_DASH_DOT + */ + public int getBorderBottom() { + return this.border_bottom; + } + + /** + * Gets the type of border to use for the right border of the cell. + * + * @see Constants#LINE_NONE + * @see Constants#LINE_THIN + * @see Constants#LINE_MEDIUM + * @see Constants#LINE_DASH + * @see Constants#LINE_HAIR + * @see Constants#LINE_HAIR2 + * @see Constants#LINE_THICK + * @see Constants#LINE_DOUBLE + * @see Constants#LINE_DOT + * @see Constants#LINE_MEDIUM_DASH + * @see Constants#LINE_DASH_DOT + * @see Constants#LINE_MEDIUM_DASH_DOT + * @see Constants#LINE_DASH_DOT_DOT + * @see Constants#LINE_MEDIUM_DASH_DOT_DOT + * @see Constants#LINE_SLANTED_DASH_DOT + */ + public int getBorderRight() { + return this.border_right; + } + + /** + * Gets the color of border to use for the top border of the cell. + */ + public Color getBorderTopColor() { + return this.border_top_color; + } + + /** + * Gets the color of border to use for the left border of the cell. + */ + public Color getBorderLeftColor() { + return this.border_left_color; + } + + /** + * Gets the color of border to use for the bottom border of the cell. + */ + public Color getBorderBottomColor() { + return this.border_bottom_color; + } + + /** + * Gets the color of border to use for the right border of the cell. + */ + public Color getBorderRightColor() { + return this.border_right_color; + } + + /** + * Gets the type of horizontal alignment for the cell + * + * @see BaseUtils#getAlignment4Horizontal(NewFormStyle style, Object value) + * @see BaseUtils#getAlignment4Horizontal(NewFormStyle style) + * @see Constants#LEFT + * @see Constants#CENTER + * @see Constants#RIGHT + * @deprecated suggest not directly use; + */ + public int getHorizontalAlignment() { + return this.horizontal_alignment; + } + + /** + * Gets the type of vertical alignment for the cell + * + * @see Constants#TOP + * @see Constants#CENTER + * @see Constants#BOTTOM + */ + public int getVerticalAlignment() { + return this.vertical_alignment; + } + + /** + * Gets the text style. + * + * @see NewFormStyle#TEXTSTYLE_WRAPTEXT + * @see NewFormStyle#TEXTSTYLE_SINGLELINE + * @see NewFormStyle#TEXTSTYLE_SINGLELINEADJUSTFONT + * @see NewFormStyle#TEXTSTYLE_MULTILINEADJUSTFONT + */ + public int getTextStyle() { + return textStyle; + } + + /** + * Gets the value of verticalText + */ + public int getVerticalText() { + return this.verticalText; + } + + /** + * Gets the value of textDirection + */ + public int getTextDirection() { + return this.textDirection; + } + + /** + * Gets the degree of rotation for the text in the cell + * (between -90 and 90 degrees). + */ + public int getRotation() { + return this.rotation; + } + + /** + * Gets the image layout + * + * @return the image layout + * @see Constants#IMAGE_TILED + * @see Constants#IMAGE_CENTER + * @see Constants#IMAGE_EXTEND + */ + public int getImageLayout() { + return imageLayout; + } + + /** + * get indentation value + */ + public int getPaddingLeft() { + return this.paddingLeft; + } + + /** + * get indentation value + */ + public int getPaddingRight() { + return this.paddingRight; + } + + /** + * @return the spacingBefore + */ + public byte getSpacingBefore() { + return spacingBefore; + } + + /** + * @return the spacingAfter + */ + public byte getSpacingAfter() { + return spacingAfter; + } + + /** + * @return the lineSpacing + */ + public byte getLineSpacing() { + return lineSpacing; + } + + + /** + * 如果单元格内容不为数字或者字符串的时候使用静态数据 + * + * @return + */ + public String getContentClsCss() { + return contentClsCss; + } + + /** + * 若value为数字或字符串需要判断一下是否可以转换为数字显示 + * + * @param value + * @return + */ + public String getContentClsCss(Object value) { + return this.contentStyle2class(this.contentStyleCssMap, value); + } + + /** + * getContentStyleCssMap + */ + public Map getContentStyleCssMap() { + return contentStyleCssMap; + } + + /** + * getBorderClsCss + */ + public String getBorderClsCss() { + return borderClsCss; + } + + /** + * getBorderStyleCssMap + */ + public Map getBorderStyleCssMap() { + return borderStyleCssMap; + } + + /** + * contentStyle2class + */ + private String contentStyle2class(Map contentCssMap) { + return contentStyle2class(contentCssMap, null); + } + + protected String contentStyle2class(Map contentCssMap, Object value) { + StringBuilder sb = new StringBuilder(); + sb.append("fh"); + int horizontal_alignment = BaseUtils.getAlignment4Horizontal(this, value); + switch (horizontal_alignment) { + case Constants.CENTER: + sb.append(" tac"); + break; + case Constants.RIGHT: + sb.append(" tar"); + break; + } + switch (this.vertical_alignment) { + case Constants.BOTTOM: + sb.append(" vab"); + break; + case Constants.TOP: + sb.append(" vat"); + break; + } + + if (this.textStyle != NewFormStyle.TEXTSTYLE_WRAPTEXT + && this.textStyle != NewFormStyle.TEXTSTYLE_MULTILINEADJUSTFONT) { + sb.append(" nw"); + } else { + sb.append(" bw"); // alex:只可以用于ie,英文的长单词会被换行分开 + } + + FRFont font = this.getFRFont(); + if (font != null) { + sb.append(font2Class(font, contentCssMap, lineSpacing)); + } + + int lit = this.paddingLeft; + int rit = this.paddingRight; + int tit = this.spacingBefore; + int bit = this.spacingAfter; + //这边的<= 包括下面<>修改的话, 都要做好兼容的 + if (lit <= DEFAULT_PADDING) { + sb.append(" pl" + lit); + } else { + contentCssMap.put("padding-left", lit + "pt"); + } + + if (rit < DEFAULT_PADDING) { + sb.append(" pr" + rit); + } else if (rit > DEFAULT_PADDING) { + contentCssMap.put("padding-right", rit + "pt"); + } + + if (0 < tit && tit <= DEFAULT_PADDING) { + sb.append(" pt" + tit); + } else if (tit > DEFAULT_PADDING) { + contentCssMap.put("padding-top", tit + "pt"); + } + + if (0 < bit && bit <= DEFAULT_PADDING) { + sb.append(" pb" + bit); + } else if (bit > DEFAULT_PADDING) { + contentCssMap.put("padding-bottom", bit + "pt"); + } + + return sb.toString().trim(); + } + + public JSONObject border2JSONObject() throws JSONException { + JSONObject borderJSON = new JSONObject(); + if (checkLeftRightTopBottom4b1()) { + borderJSON.put("b1", true); + } else { + border2JSONObject(borderJSON, border_top, border_top_color, "t"); + border2JSONObject(borderJSON, border_left, border_left_color, "l"); + border2JSONObject(borderJSON, border_bottom, border_bottom_color, "b"); + border2JSONObject(borderJSON, border_right, border_right_color, "r"); + } + return borderJSON; + } + + private void border2JSONObject(JSONObject jo, byte borderStyle, Color borderColor, String position) throws JSONException { + if (borderStyle == Constants.LINE_THIN + && ComparatorUtils.equals(borderColor, Color.black)) { + jo.put(position, new JSONObject().put("w", 1)); + } else { + int bw = BaseUtils.getBorderWidth(borderStyle); + if (bw > 0) { + JSONObject extra = new JSONObject(); + extra.put("w", bw); + if (!ComparatorUtils.equals(borderColor, Color.black)) { + extra.put("c", StableUtils.javaColorToCSSColor(borderColor)); + } + // 留着保持兼容老的app + extra.put("s", borderLine2String(borderStyle)); + // MOBILE-21527 报表设计器设置不同的border后台返回具体的border类型 + extra.put("type", borderStyle); + jo.put(position, extra); + } + } + } + + private String borderLine2String(int borderStyle) { + switch (borderStyle) { + case Constants.LINE_THIN: + case Constants.LINE_SLIM: + return "t"; + case Constants.LINE_MEDIUM: + return "m"; + case Constants.LINE_THICK: + return "tk"; + case Constants.LINE_DOUBLE: + return "de"; + case Constants.LINE_DOT: + return "dt"; + case Constants.LINE_DASH_DOT: + return "dadt"; + case Constants.LINE_DASH_DOT_DOT: + return "ddd"; + default: + return "dash"; + } + } + + /* + * 返回classBuf与styleBuf + */ + private String border2Class(Map borderCssMap) { + StringBuilder sb = new StringBuilder(); + // 简化class + if (checkLeftRightTopBottom4b0()) { + sb.append(" b0"); + return sb.toString().trim(); + } else if (checkLeftRightTopBottom4b1()) { + sb.append(" b1"); + return sb.toString().trim(); + } + + // right + visible_border_css(this.border_right, this.border_right_color, sb, borderCssMap, "r"); + // bottom + visible_border_css(this.border_bottom, this.border_bottom_color, sb, borderCssMap, "b"); + // left + visible_border_css(this.border_left, this.border_left_color, sb, borderCssMap, "l"); + // top + visible_border_css(this.border_top, this.border_top_color, sb, borderCssMap, "t"); + + return sb.toString().trim(); + } + + private boolean checkLeftRightTopBottom4b0() { + return this.border_left == Constants.LINE_NONE && this.border_right == Constants.LINE_NONE + && this.border_top == Constants.LINE_NONE && this.border_bottom == Constants.LINE_NONE; + } + + private boolean checkLeftRightTopBottom4b1() { + return this.border_left == Constants.LINE_THIN && this.border_right == Constants.LINE_THIN + && this.border_top == Constants.LINE_THIN && this.border_bottom == Constants.LINE_THIN + && ComparatorUtils.equals(this.border_left_color, Color.black) + && ComparatorUtils.equals(this.border_right_color, Color.black) + && ComparatorUtils.equals(this.border_top_color, Color.black) + && ComparatorUtils.equals(this.border_bottom_color, Color.black); + } + + private static void visible_border_css( + byte border_style, Color border_color, StringBuilder classBuf, Map borderCssMap, String border_position + ) {// right + if (border_style == Constants.LINE_THIN + && ComparatorUtils.equals(border_color, Color.black)) { + classBuf.append(" b" + border_position + "1"); + } + + int bw = BaseUtils.getBorderWidth(border_style); + if (bw > 0) { + // width + classBuf.append(" b" + border_position + "w" + bw); + + // style + classBuf.append(" " + __border2Class(border_style, border_position)); + + // color + // 细线需要另外处理为 rgba,rgba的边框在chrome上会出现渲染问题 + // 转为 rgb 显示 + if (border_style == Constants.LINE_SLIM) { + borderCssMap.put(_position2Colorcss(border_position), + StableUtils.javaColorToCSSColor(brighter(border_color))); + } else if (ComparatorUtils.equals(border_color, Color.black)) { + classBuf.append(" b" + border_position + "cb"); + } else { + borderCssMap.put(_position2Colorcss(border_position), StableUtils.javaColorToCSSColor(border_color)); + } + } else { + classBuf.append(" b" + border_position + "0"); + } + } + + private static Color brighter(Color ori) { + return new Color(Math.min((int) ((1 - FACTORY_ALPHA) * 255 + FACTORY_ALPHA * ori.getRed()), 255), + Math.min((int) ((1 - FACTORY_ALPHA) * 255 + FACTORY_ALPHA * ori.getGreen()), 255), + Math.min((int) ((1 - FACTORY_ALPHA) * 255 + FACTORY_ALPHA * ori.getBlue()), 255), + 255); + } + + private static String _position2Colorcss(String border_position) { + if (ComparatorUtils.equals(border_position, "r")) { + return "border-right-color"; + } else if (ComparatorUtils.equals(border_position, "b")) { + return "border-bottom-color"; + } else if (ComparatorUtils.equals(border_position, "l")) { + return "border-left-color"; + } else if (ComparatorUtils.equals(border_position, "t")) { + return "border-top-color"; + } else { + return "border-color"; + } + } + + private static String __border2Class(int borderStyle, String d) { + switch (borderStyle) { + case Constants.LINE_SLIM: + return "b" + d + "ss"; + case Constants.LINE_THIN: + return "b" + d + "ss"; + case Constants.LINE_MEDIUM: + return "b" + d + "ss"; + case Constants.LINE_THICK: + return "b" + d + "ss"; + case Constants.LINE_DOUBLE: + return "b" + d + "sd"; + case Constants.LINE_DOT: + return "b" + d + "sdo"; + case Constants.LINE_DASH_DOT: + return "b" + d + "sdo"; + case Constants.LINE_DASH_DOT_DOT: + return "b" + d + "sdo"; + default: + return "b" + d + "sda"; + } + } + + private static String font2Class(Font font, Map cssMap, byte lineSpacing) { + StringBuilder sb = new StringBuilder(); + if (font.isBold()) { + sb.append(" fwb"); + } + if (font.isItalic()) { + sb.append(" fsi"); + } + String fontName = font.getName(); + String cls = (String) getclsFontFamily().get(fontName); + if (cls == null) { + // REPORT-25741 部分字体需要加引号才能识别 + cssMap.put("font-family", "'" + fontName + "'"); + } else if (!ComparatorUtils.equals(cls, "fnss")) { // alex:font-family:SimSun写在fh里面了 + sb.append(" " + cls); + } + float size = font.getSize2D(); + if (AssistUtils.equals(size, N_SIZE)) { // alex:font-size:9pt写在fh里面 + } else if (size >= MIN_SIZE && size <= MAX_SIZE) { + size = Utils.round5(size); + sb.append(" f" + String.valueOf(size).replace('.', '-')); + } else { + cssMap.put("font-size", font.getSize2D() + "pt"); + } + + if (lineSpacing != 0) { + // carl:直接在这里添上line-height + //cellFM.getHeight() 不能简单的 *(4/3)进行转换,数值不对 + FontMetrics cellFM = GraphHelper.getFontMetrics(FRFont.getInstance(font).applyResolutionNP(Constants.FR_PAINT_RESOLUTION)); + cssMap.put("line-height", (int) (cellFM.getHeight() + lineSpacing * LINE_HEIGHT_FIX / LINE_HEIGHT_FIX2) + "px"); + } + + font2ClassOnFRFont(font, cssMap, sb); + + return sb.toString(); + } + + private static void font2ClassOnFRFont(Font font, Map cssMap, StringBuilder sb) { + if (font instanceof FRFont) { + if (((FRFont) font).isStrikethrough()) { + if (((FRFont) font).getUnderline() != Constants.LINE_NONE) { + sb.append(" tdstu"); + } else { + sb.append(" tdst"); + } + } else { + if (((FRFont) font).getUnderline() != Constants.LINE_NONE) { + sb.append(" tdu"); + } + } + if (((FRFont) font).isSubscript()) { + sb.append(" suber"); + } else if (((FRFont) font).isSuperscript()) { + sb.append(" super"); + } + if (((FRFont) font).isShadow()) { + sb.append(" shadow"); + } + Color color = ((FRFont) font).getForeground(); + if (!ComparatorUtils.equals(color, Color.black) && color != null) { + cssMap.put("color", StableUtils.javaColorToCSSColor(color)); + } + } + } + + + private transient int hashCode = -1; + + /** + * 哈希码 + * + * @return 哈希值h + */ + public int hashCode() { + + if (hashCode == -1) { + //因为format和非ColorBackground的Background并不是唯一的(也就是说即使equals但hashCode也会不一样),所以不放在hashCode的计算里面 + int code = this.border_top ^ this.border_bottom ^ this.border_left ^ this.border_right ^ + this.border_top_color.hashCode() ^ this.border_bottom_color.hashCode() ^ + this.border_left_color.hashCode() ^ this.border_right_color.hashCode() ^ + this.horizontal_alignment ^ this.imageLayout ^ this.verticalText ^ + this.paddingLeft ^ this.paddingRight ^ this.rotation ^ this.textDirection ^ this.textStyle ^ this.vertical_alignment; + + if (frFont != null) { + code ^= frFont.hashCode(); + } + if (background != null) { + code = background.fixHashCode(code); + } + hashCode = code; + } + return hashCode; + } + + /** + * Equals. + */ + public boolean equals(Object object) { + if (object == this) { + return true; + } + if (!(object instanceof NewFormStyle)) { + return false; + } + + NewFormStyle newStyle = (NewFormStyle) object; + + //由于java中所有的Format都实现了equals()方法,这里可以直接来比较. + return ComparatorUtils.equals(newStyle.getFormat(), this.getFormat()) && + ComparatorUtils.equals(newStyle.getFRFont(), this.getFRFont()) && + ComparatorUtils.equals(newStyle.getBackground(), this.getBackground()) && + + newStyle.getBorderTop() == this.getBorderTop() && + newStyle.getBorderLeft() == this.getBorderLeft() && + newStyle.getBorderBottom() == this.getBorderBottom() && + newStyle.getBorderRight() == this.getBorderRight() && + + ComparatorUtils.equals(newStyle.getBorderTopColor(), this.getBorderTopColor()) && + ComparatorUtils.equals(newStyle.getBorderLeftColor(), this.getBorderLeftColor()) && + ComparatorUtils.equals(newStyle.getBorderBottomColor(), this.getBorderBottomColor()) && + ComparatorUtils.equals(newStyle.getBorderRightColor(), this.getBorderRightColor()) && + + BaseUtils.getAlignment4Horizontal(newStyle) == BaseUtils.getAlignment4Horizontal(this) && + newStyle.getVerticalAlignment() == this.getVerticalAlignment() && + newStyle.getTextStyle() == this.getTextStyle() && + + //james verticalText + newStyle.getVerticalText() == this.getVerticalText() && + newStyle.getTextDirection() == this.getTextDirection() && + newStyle.getRotation() == this.getRotation() && + newStyle.getImageLayout() == this.getImageLayout() && + + // alex padding + newStyle.getPaddingLeft() == this.getPaddingLeft() && + newStyle.getPaddingRight() == this.getPaddingRight() && + + //间距 + newStyle.getSpacingBefore() == this.getSpacingBefore() && + newStyle.getSpacingAfter() == this.getSpacingAfter() && + newStyle.getLineSpacing() == this.getLineSpacing(); + } + + /** + * Clone. + */ + public Object clone() throws CloneNotSupportedException { + return this; + } + + protected Object readResolve() throws InvalidObjectException { + if (this.getClass() != NewFormStyle.class) { + throw new InvalidObjectException("subclass didn't correctly implement readResolve"); + } + + Object res = initializeStyle.get(this); + //alex:从ObjectInputStream生成的Object可能不存在于全局的map中,可能为null + if (res == null) { + res = this; + initializeStyle.put(this, res); + } + + return res; + } + + /** + * 画单元格的Value + *

+ * 通过width, height方式画 + */ + public static void paintContent(Graphics2D g2d, Object value, NewFormStyle style, int width, int height, int resolution) { + // kunsnat: 添加判断width和height. 是否有必要继续paint, @bug0006854, 增加了混乱的字符. + if (value == null || width == 0 || height == 0) { + return; + } + + if (style == null) { + //peter:获取默认的Style. + style = NewFormStyle.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER); + } + + if (value instanceof BaseFormula) { + value = ((BaseFormula) value).getResult(); + } + + if (value instanceof Painter) { + // TODO 弹出界面然后 esc bug.. + ((Painter) value).paint(g2d, width, height, resolution, style); + } else if (value instanceof ImageProvider) { + paintImageContent(g2d, ((ImageProvider) value).getImage(), style, width, height, resolution); + } else if (value instanceof Image) { + paintImageContent(g2d, (Image) value, style, width, height, resolution); + } else { + //默认Paint String + String text = valueToText(value, style.getFormat()); + paintCellStyleString(g2d, width, height, text, style, resolution); + } + } + + public static void paintImageContent(Graphics2D g2d, Image value, NewFormStyle style, int width, int height, int resolution) { + int imageLayout = CoreGraphHelper.changeImageLayout4Draw(value, style.getImageLayout(), width, height); + + //这边做scale的目的是为了在导出图片以及以图片方式打印时,根据不同的resolution调整对应的dpi + int defaultResolution = Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION; + double scale = resolution * 1d / defaultResolution; + width = (int) (width / scale); + height = (int) (height / scale); + g2d.scale(scale, scale); + + GraphHelper.paintImage(g2d, width, height, value, imageLayout, + style.getHorizontalAlignment(), style.getVerticalAlignment(), -1, -1); + //最后把画板改回来 + g2d.scale(defaultResolution * 1d / resolution, defaultResolution * 1d / resolution); + } + + /** + * 画单元格的Value + *

+ * 通过PaintRectangle + ClipRectangle画 + */ + public static void paintContent(Graphics2D g2d, Object value, int resolution, NewFormStyle style, Rectangle paintRectangle, Rectangle clipRectangle) { + Shape oldClip = g2d.getClip(); + g2d.translate(paintRectangle.getX(), paintRectangle.getY()); + g2d.clip(clipRectangle); // kunsnat: 这些clip 都没有考虑边框啊!!! 所有图表的边框压缩到里面去了. + + paintContent(g2d, value, style, paintRectangle.width, paintRectangle.height, resolution); + + g2d.translate(-paintRectangle.getX(), -paintRectangle.getY()); + g2d.setClip(oldClip); + } + + /** + * 画背景 + *

+ * 通过width, height方式画 + */ + public static void paintBackground(Graphics2D g2d, NewFormStyle style, double width, double height) { + if (style == null) {// 还是需要检查一下的,假如DefaultCellStyle拥有Border就需要Paint了. + return; + } + + // paint background. + Background background = style.getBackground(); + if (background == null) { + return; + } + + background.layoutDidChange((int) width, (int) height); + synchronized (tempRectangle2D) { + tempRectangle2D.setRect(0, 0, width, height); + background.paint(g2d, tempRectangle2D); + } + } + + /** + * 画单元格的背景 + *

+ * 通过PaintRectangle + ClipRectangle画 + */ + public static void paintBackground(Graphics2D g2d, NewFormStyle style, Rectangle paintRectangle, Rectangle clipRectangle) { + if (style == null) { + //peter:获取默认的Style. + style = NewFormStyle.DEFAULT_STYLE; + } + Shape oldClip = g2d.getClip(); + g2d.translate(paintRectangle.getX(), paintRectangle.getY()); + g2d.clip(clipRectangle); + Background background = style.getBackground(); + + if (background != null) { + // alex:根据paintRectangle和clipRectangle共同决定Background的PaintRectangle + background.paint(g2d, new Rectangle( + clipRectangle.x, clipRectangle.y, + clipRectangle.width, clipRectangle.height)); + } + g2d.translate(-paintRectangle.getX(), -paintRectangle.getY()); + g2d.setClip(oldClip); + } + + /** + * 画边框 + *

+ * 通过width, height方式画 + */ + public static void paintBorder(Graphics2D g2d, NewFormStyle style, double width, double height) { + if (style == null) {// 还是需要检查一下的,假如DefaultCellStyle拥有Border就需要Paint了. + return; + } + + //peter:当是粗线的时候,需要计算尺寸 + double left = 0; + double right = 0; + if (style.getBorderLeft() != Constants.LINE_NONE) { + int borderLeftSize = GraphHelper.getLineStyleSize(style.getBorderLeft()); + left = borderLeftSize / 2; + } + if (style.getBorderRight() != Constants.LINE_NONE) { + int borderRightSize = GraphHelper.getLineStyleSize(style.getBorderRight()); + right = borderRightSize / 2; + } + + double top = 0; + double bottom = 0; + if (style.getBorderTop() != Constants.LINE_NONE) { + int bSize = GraphHelper.getLineStyleSize(style.getBorderTop()); + top = bSize / 2; + } + if (style.getBorderBottom() != Constants.LINE_NONE) { + int bSize = GraphHelper.getLineStyleSize(style.getBorderBottom()); + bottom = bSize / 2; + } + + // paint border + if (style.getBorderTop() != Constants.LINE_NONE) { + g2d.setPaint(style.getBorderTopColor()); + GraphHelper.drawLine(g2d, 0 - left, 0, width + right, 0, style.getBorderTop()); + } + if (style.getBorderLeft() != Constants.LINE_NONE) { + g2d.setPaint(style.getBorderLeftColor()); + GraphHelper.drawLine(g2d, 0, 0 - top, 0, height + bottom, style.getBorderLeft()); + } + if (style.getBorderBottom() != Constants.LINE_NONE) { + g2d.setPaint(style.getBorderBottomColor()); + GraphHelper.drawLine(g2d, 0 - left, height, width + right, height, style.getBorderBottom()); + } + if (style.getBorderRight() != Constants.LINE_NONE) { + g2d.setPaint(style.getBorderRightColor()); + GraphHelper.drawLine(g2d, width, 0 - top, width, height + bottom, style.getBorderRight()); + } + } + + /** + * 画单元格的边框 + *

+ * 通过PaintRectangle + ClipRectangle画边框 + */ + public static void paintBorder(Graphics2D g2d, NewFormStyle style, Rectangle paintRectangle, Rectangle clipRectangle) { + //单元格行高列宽=0时, 不需要绘制边框 + if (paintRectangle.width == 0 || paintRectangle.height == 0) { + return; + } + g2d.translate(paintRectangle.getX(), paintRectangle.getY()); + + Rectangle realPaintRect = new Rectangle(0, 0, + paintRectangle.width, paintRectangle.height); + //peter:需要判断的因为clipRectangle极可能不是null. + if (clipRectangle != null) { + realPaintRect = realPaintRect.intersection(clipRectangle); + } + g2d.translate(realPaintRect.getX(), realPaintRect.getY()); + + if (style == null) {// 还是需要检查一下的,假如DefaultCellStyle拥有Border就需要Paint了. + //peter:获取默认的Style. + style = NewFormStyle.DEFAULT_STYLE; + } + + paintBorder(g2d, style, realPaintRect.getWidth(), realPaintRect.getHeight()); + + // 返回Translate + g2d.translate(-realPaintRect.getX(), -realPaintRect.getY()); + g2d.translate(-paintRectangle.getX(), -paintRectangle.getY()); + } + + /** + * 转化成文本 + * + * @param value 带转化的对象 + * @param format 格式g + * @return 字符串z + */ + public static String valueToText(Object value, Format format) { + //需要画的值,主要是把公式里面的值拿出来 + Object valueToPaint = value; + String text = null; + + String checkInfinity = StableUtils.checkInfinity(value); + if (StringUtils.isNotEmpty(checkInfinity)) { + return checkInfinity; + } + + if (value != null) { + if (value instanceof BaseFormula) { + BaseFormula formula = (BaseFormula) value; + if (StableUtils.isNull(formula.getResult())) { + return StringUtils.EMPTY;// BUG4788,应该显示空字符串 + } else { + valueToPaint = formula.getResult(); + } + } else if (value instanceof Clob) { + valueToPaint = DataBaseUtils.clob2String((Clob) value); + } + + if (format != null) { + format = FormatRepository.getInstance().getLocalFormat(format); + if (format instanceof DateFormat) {// Date. + text = valueInDateFormat((DateFormat) format, valueToPaint); + } else if (format instanceof NumberFormat) {// Number. + text = valueInNumberFormat(format, valueToPaint); + } else { + try { + text = format.format(valueToPaint); + } catch (Exception exp) { + text = Utils.objectToString(valueToPaint); + } + } + } else + text = Utils.objectToString(valueToPaint); + } else { + text = StringUtils.EMPTY; + } + + return text; + } + + protected static String valueInNumberFormat(Format format, Object valueToPaint) { + Number number = GeneralUtils.objectToNumberReturnNull(valueToPaint); + if (number != null) { + try { + if (format instanceof CoreDecimalFormat) { + //数字类型的要roundup一下, 默认会逢5奇进偶不进, 62.325->62.33 + return ((CoreDecimalFormat) format).formatRoundingModeUp(number); + } + //62.325->62.32 + return format.format(number); + } catch (Exception ignore) { + } + } + return Utils.objectToString(valueToPaint); + } + + private static String valueInDateFormat(DateFormat format, Object valueToPaint) { + + String result; + Date date2Format = tryGet(format, valueToPaint); + if (date2Format == null) { + date2Format = DateUtils.object2Date(valueToPaint, true); + } + if (date2Format != null) { + result = format.format(date2Format); + } + /* + * alex:如果date2Format为null,就是说valueToPaint不能转换成日期型,那么就直接画valueToPaint的字符串 + * 为什么必须要画valueToPaint的字符串呢?见bug0004566 + * 因为在Grid里面直接写=today(),并设置format为日期,如果不画,就一片空白,什么都看不到了 + */ + else { + result = Utils.objectToString(valueToPaint); + } + + return result; + } + + @Nullable + private static Date tryGet(DateFormat format, Object valueToPaint) { + + Date date2Format = null; + // 先用format来生成日期啊 + if (valueToPaint instanceof Date) { + date2Format = (Date) valueToPaint; + } else { + try { + date2Format = format.parse(GeneralUtils.objectToString(valueToPaint)); + } catch (Exception e) { + // nothing + } + } + return date2Format; + } + + /** + * Paint string according to Style. + */ + public static void paintCellStyleString2(Graphics2D g2d, int width, int height, String text, Style style, int resolution) { + if (StringUtils.isBlank(text)) { + return; + } + Paint oldPaint = g2d.getPaint(); + if (style == null) { + style = NewFormStyle.DEFAULT_STYLE; + } + Font rfont = BaseUtils.getStyleFont(g2d, style, resolution); + if (style.getRotation() != 0 && style.getVerticalText() == NewFormStyle.HORIZONTALTEXT) { + BaseUtils.drawStringStyleInRotation(g2d, width, height, text, style, resolution); + } else { + if (style.getTextStyle() == NewFormStyle.TEXTSTYLE_SINGLELINEADJUSTFONT + || style.getTextStyle() == NewFormStyle.TEXTSTYLE_MULTILINEADJUSTFONT) { + List lineTextList = BaseUtils.getLineTextList(text, style, rfont, height, width, resolution); + if (width <= 0 || lineTextList.isEmpty()) { + return; + } + int textAscent = g2d.getFontMetrics().getAscent(); + int textHeight = g2d.getFontMetrics().getHeight(); + + int textY = 0; + int textAllHeight = textHeight * lineTextList.size(); + double spacingBefore = PT.pt2pix(style.getSpacingBefore(), resolution); + double spacingAfter = PT.pt2pix(style.getSpacingAfter(), resolution); + double lineSpacing = PT.pt2pix(style.getLineSpacing(), resolution); + //james:加上间距,WORD中的行间距是从第一行文本的上面一行就算的,所以行间距形成的空隙与文本行数相同 + textAllHeight += spacingBefore + spacingAfter + lineSpacing * lineTextList.size(); + if (style.getVerticalAlignment() == Constants.CENTER) { + if (height > textAllHeight) {// 如果所有文本的高度小于当前可以绘区域的高度,就从0开始画字符. + textY = (height - textAllHeight) / 2; + } + } else if (style.getVerticalAlignment() == Constants.BOTTOM) { + textY = height - textAllHeight; + } + textY += textAscent;// 在绘画的时候,必须添加Ascent的高度. + textY += spacingBefore + lineSpacing;//james:加上"段前间距"+“行间距” + if (style.getTextStyle() == NewFormStyle.TEXTSTYLE_SINGLELINEADJUSTFONT) {// 通过自动调整字体显示所有的信息调整Font来显示所有的字符 + ContentLineGroup contentLineGroup = singleLineAdjustFont(style, lineTextList, width, height, g2d, resolution, true); + _drawContentLineGroup(contentLineGroup, g2d, textY, height, width, BaseUtils.getAlignment4Horizontal(style, text)); + } else if (style.getTextStyle() == NewFormStyle.TEXTSTYLE_MULTILINEADJUSTFONT) { + ContentLineGroup contentLineGroup = mulitiLineAdjustFont(style, lineTextList, width, height, g2d, resolution, true); + _drawContentLineGroup(contentLineGroup, g2d, textY, height, width, BaseUtils.getAlignment4Horizontal(style, text)); + } + } else { + BaseUtils.drawStringStyleInRotation(g2d, width, height, text, style, resolution); + } + } + g2d.setPaint(oldPaint); + } + + + + private static void _drawContentLineGroup( + ContentLineGroup contentLineGroup, Graphics2D g2d, + int textY, int height, int width, int horizontalAlignment + ) { + Style style = contentLineGroup.style; + + Font oldFRFont = g2d.getFont(); + g2d.setFont(style.getFRFont()); + if (style.getVerticalAlignment() == Constants.TOP) { + textY = 0; + } else if (style.getVerticalAlignment() == Constants.CENTER) { + if (height > contentLineGroup.totalHeight()) {// 如果所有文本的高度小于当前可以绘区域的高度,就从0开始画字符. + textY = (height - contentLineGroup.totalHeight()) / 2; + } else { + textY = 0; + } + } else if (style.getVerticalAlignment() == Constants.BOTTOM) { + textY = height - contentLineGroup.totalHeight(); + } + textY += g2d.getFontMetrics().getAscent();// 在绘画的时候,必须添加Ascent的高度. + + for (int i = 0; i < contentLineGroup.newLineTextList.size(); i++) { + double textX = style.getPaddingLeft(); + int textWidth = GraphHelper.getFontMetrics(style.getFRFont()).stringWidth((String) contentLineGroup.newLineTextList.get(i)); + if (horizontalAlignment == Constants.CENTER) { + textX = (width - textWidth - style.getPaddingRight()) / 2.0; + } else if (horizontalAlignment == Constants.RIGHT) { + textX = width - style.getPaddingRight() - textWidth; + } else if (horizontalAlignment == Constants.DISTRIBUTED) {// added by KevinWang + } + + if (horizontalAlignment == Constants.DISTRIBUTED) { + String lineText = (String) contentLineGroup.newLineTextList.get(i);// 分行显示时第i行的内容,但是也可能单行 + double charSpace = (width - style.getPaddingLeft() - style.getPaddingRight() + - g2d.getFontMetrics().charWidth(lineText.charAt(lineText.length() - 1))) + / (lineText.length() - 1); + for (int charIndex = 0; charIndex < lineText.length(); charIndex++) { + char tmpChar = lineText.charAt(charIndex);//取出一个字符待显示 + String tmpString = new String((new StringBuffer()).append(tmpChar));// 将其包装成string形式 + double charX = style.getPaddingLeft() + charIndex * charSpace; + GraphHelper.drawString(g2d, tmpString, charX, textY);//显示 + } + } else { + GraphHelper.drawString(g2d, (String) contentLineGroup.newLineTextList.get(i), textX, textY); + } + textY += contentLineGroup.newTextHeight; + } + g2d.setFont(oldFRFont); + } + + /* + * 通过自动调整字体显示所有的信息调整Font来显示所有的字符 + */ + private static ContentLineGroup singleLineAdjustFont(Style style, List lineTextList, int width, int height, Graphics2D g2d, int resolution, boolean fontScale) { + FRFont newFRFont = (FRFont) style.getFRFont().applyResolutionNP(resolution); + + int maxTextWidth = 0; + FontMetrics oriFontMetrics = GraphHelper.getFontMetrics(newFRFont); + int maxTextHeight = oriFontMetrics.getHeight() * lineTextList.size(); + String examle_text = ""; + for (int i = 0; i < lineTextList.size(); i++) { + if (oriFontMetrics.stringWidth((String) lineTextList.get(i)) > maxTextWidth) { + examle_text = (String) lineTextList.get(i); + maxTextWidth = oriFontMetrics.stringWidth((String) lineTextList.get(i)); + } + } + + if (maxTextWidth > 0 || maxTextHeight > 0) { // 只有当大于0时才改变字体大小 + // 调整宽度和高度 + if (maxTextWidth > (width - style.getPaddingLeft() - style.getPaddingRight()) || maxTextHeight > height) { + while (newFRFont.getSize() > 1) { + newFRFont = newFRFont.applySize((float) newFRFont.getSize() - 1); + maxTextWidth = GraphHelper.getFontMetrics(newFRFont).stringWidth(examle_text); + maxTextHeight = GraphHelper.getFontMetrics(newFRFont).getHeight() * lineTextList.size(); + + // 由于Font的变化单位是1, 所以必须这么找最适合的 Font + if (maxTextWidth <= (width - style.getPaddingLeft() - style.getPaddingRight()) && maxTextHeight <= height) { + break; + } + } + } + } + + FRFont returnFont = style.getFRFont().applySize(fontScale ? newFRFont.getSize2D() : FRFont.convResolution(newFRFont.getSize2D(), resolution)); + return new ContentLineGroup(style.deriveFRFont(returnFont), lineTextList, GraphHelper.getFontMetrics(newFRFont, g2d).getHeight()); + } + + /* + * 多行显示(调整字体大小),即固定单元格高和框,改变字体大小使适应。 + */ + private static ContentLineGroup mulitiLineAdjustFont(Style style, List lineTextList, int width, int height, Graphics2D g2d, int resolution, boolean fontScale) { + FRFont newFRFont = (FRFont) style.getFRFont().applyResolutionNP(resolution); + List newLineTextList; + NewFormStyle tmpStyle = NewFormStyle.DEFAULT_STYLE; + tmpStyle = tmpStyle.deriveTextStyle(NewFormStyle.TEXTSTYLE_WRAPTEXT); + int newTextHeight = GraphHelper.getFontMetrics(newFRFont, g2d).getHeight(); + + newLineTextList = resovleLineTextListByStyle(newFRFont, lineTextList, tmpStyle, width, resolution); + + if (newLineTextList.size() * newTextHeight > height) { + while (newFRFont.getSize() > 1) { + newFRFont = newFRFont.applySize((float) newFRFont.getSize() - 1); + newLineTextList = resovleLineTextListByStyle(newFRFont, lineTextList, tmpStyle, width, resolution); + + newTextHeight = GraphHelper.getFontMetrics(newFRFont, g2d).getHeight(); + if (newLineTextList.size() * newTextHeight <= height) { + break; + } + } + } else if (newLineTextList.size() * newTextHeight < height) { + while (newFRFont.getSize() < MAX_FONT_SIZE) { // _denny: 设定字体最大为100 + newFRFont = newFRFont.applySize((float) newFRFont.getSize() + 1); + + newLineTextList = resovleLineTextListByStyle(newFRFont, lineTextList, tmpStyle, width, resolution); + + newTextHeight = GraphHelper.getFontMetrics(newFRFont, g2d).getHeight(); + if (newLineTextList.size() * newTextHeight > height) { + newFRFont = newFRFont.applySize(newFRFont.getSize() - 1); + + newLineTextList = resovleLineTextListByStyle(newFRFont, lineTextList, tmpStyle, width, resolution); + + newTextHeight = GraphHelper.getFontMetrics(newFRFont, g2d).getHeight(); + break; + } + } + } + + FRFont returnFont = tmpStyle.getFRFont().applySize(fontScale ? newFRFont.getSize2D() : FRFont.convResolution(newFRFont.getSize2D(), resolution)); + tmpStyle.deriveFRFont(returnFont); + + return new ContentLineGroup(tmpStyle, newLineTextList, newTextHeight); + } + + private static List resovleLineTextListByStyle(Font font, List lineTextList, NewFormStyle tmpStyle, int width, int resolution) { + List newLineTextList = new ArrayList(); + + List tmpLineTextList; + for (int i = 0; i < lineTextList.size(); i++) { + tmpLineTextList = BaseUtils.getLineTextList((String) lineTextList.get(i), tmpStyle, font, width, resolution); + for (int j = 0; j < tmpLineTextList.size(); j++) { + newLineTextList.add((String) tmpLineTextList.get(j)); + } + } + + return newLineTextList; + } + + /** + * 修改格子样式 + * + * @param width 宽 k + * @param height 高g + * @param text 文本w + * @param style 样式y + * @param resolution 转化率z + * @return 样式 y + */ + public static Style modCellStyleString(int width, int height, String text, Style style, int resolution) { + List lineTextList = BaseUtils.getLineTextList(text, style, null, height, width, resolution); + if (style.getTextStyle() == NewFormStyle.TEXTSTYLE_SINGLELINEADJUSTFONT) { + style = singleLineAdjustFont(style, lineTextList, width, height, null, resolution, false).style; + } else if (style.getTextStyle() == NewFormStyle.TEXTSTYLE_MULTILINEADJUSTFONT) { + style = mulitiLineAdjustFont(style, lineTextList, width, height, null, resolution, false).style; + } + + return style; + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/common/PaintUtils.java b/designer-form/src/main/java/com/fr/design/fit/common/PaintUtils.java new file mode 100644 index 000000000..8f913a7aa --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/common/PaintUtils.java @@ -0,0 +1,835 @@ +/* + * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. + */ +package com.fr.design.fit.common; + +import com.fr.base.AutoChangeLineAndDrawManager; +import com.fr.base.BaseFormula; +import com.fr.base.BaseUtils; +import com.fr.base.GraphHelper; +import com.fr.base.ImageProvider; +import com.fr.base.Painter; +import com.fr.base.Style; +import com.fr.base.Utils; +import com.fr.base.background.ColorBackground; +import com.fr.base.chart.BaseChartCollection; +import com.fr.base.chart.result.WebChartIDInfo; +import com.fr.code.BarcodeImpl; +import com.fr.code.bar.BarcodeException; +import com.fr.code.bar.core.BarCodeUtils; +import com.fr.code.bar.core.BarcodeAttr; +import com.fr.data.DataUtils; +import com.fr.data.PresentationType; +import com.fr.data.condition.ListCondition; +import com.fr.file.ResultChangeWhenExport; +import com.fr.form.ui.Widget; +import com.fr.general.Background; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRFont; +import com.fr.general.ImageWithSuffix; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.ExtraClassManager; +import com.fr.report.cell.CellElement; +import com.fr.report.cell.FloatElement; +import com.fr.report.cell.TemplateCellElement; +import com.fr.report.cell.cellattr.CellExpandAttr; +import com.fr.report.cell.cellattr.CellGUIAttr; +import com.fr.report.cell.cellattr.core.CellUtils; +import com.fr.report.cell.cellattr.core.ResultSubReport; +import com.fr.report.cell.cellattr.core.group.DSColumn; +import com.fr.report.core.Html2ImageUtils; +import com.fr.report.core.ReportUtils; +import com.fr.script.Calculator; +import com.fr.stable.Constants; +import com.fr.stable.CoreConstants; +import com.fr.stable.StringUtils; +import com.fr.stable.bridge.ObjectHolder; +import com.fr.stable.fun.AutoChangeLineAndDrawProcess; +import com.fr.stable.fun.FontProcessor; +import com.fr.stable.html.Tag; +import com.fr.stable.unit.FU; +import com.fr.stable.unit.PT; +import com.fr.stable.unit.UNIT; +import com.fr.stable.web.Repository; + +import javax.swing.ImageIcon; +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Paint; +import java.awt.Rectangle; +import java.awt.font.TextAttribute; +import java.awt.geom.GeneralPath; +import java.awt.image.BufferedImage; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; + +/** + * The util for paint. + */ +public class PaintUtils { + // Add by Denny + public static final int CELL_MARK_SIZE = 6; + public static final Color CELL_HIGHT_LIGHT_MARK_COLOR = new Color(255, 0, 55); + public static final Color CELL_PRESENT_MARK_COLOR = new Color(0, 255, 200); + public static final Color CELL_PAGINATION_MARK_COLOR = new Color(55, 255, 0); + public static final Color CELL_RESULT_MARK_COLOR = new Color(200, 0, 255); + public static final Color CELL_CONDITION_FILTER_MARK_COLOR = new Color(255, 200, 0); + public static final Color CELL_PARAMETER_FILTER_MARK_CONLR = new Color(0, 55, 255); + + public static final Color CELL_DIRECTION_MARK_COLOR = Color.gray; + private static final int UNIT_SIZE = 4; + + //原值是15,矩形线条会缺失,加1px绘制没问题。这地方有水印,但是貌似不是水印影响,未找到线条被挡住的原因 + private static final int WIDGET_WIDTH = 16; + private static final int WIDGET_HEIGHT = 16; + + // Suppresses default constructor, ensuring non-instantiability. + private PaintUtils() { + } + + // font attributes map cache + private static Hashtable fontAttributeMapCache = new Hashtable(); + + /* + * 用于在Grid里面画CellElement的Content + Background + * + * 不画Border,是因为在Grid里面先画所有单元格的Content + Background,再画所有单元格的Border(peter认为这可以提高速度) + */ + public static void paintGridCellContent(Graphics2D g2d, TemplateCellElement cell, int width, int height, int resolution) { + int cell_mark_size = CELL_MARK_SIZE; + // denny_Grid + // 左上角: 条件高亮, 形态 + int leftUpCount = 0; + int rightUpCount = 0; + int leftDownCount = 0; + GraphHelper.applyRenderingHints(g2d); + if (paintHighlightGroupMarkWhenExsit(g2d, cell, leftUpCount)) { + leftUpCount++; + } + if (paintPresentMarkWhenExsit(g2d, cell, leftUpCount)) { + leftUpCount++; + } + if (paintPaginationMarkWhenExsit(g2d, cell, width, rightUpCount)) { + rightUpCount++; + } + paintWidgetMarkWhenExsit(g2d, cell, width, height); + paintExpandMarkWhenExsit(g2d, cell); + Object value = cell.getValue(); + if (value == null) {// 先判断是否是空. + return; + } + if (paintResultMarkWhenExsit(g2d, value, width, rightUpCount)) { + rightUpCount++; + } + + if (paintDSColumnParametermarkWhenExsit(g2d, value, height, leftDownCount)) { + leftDownCount++; + } + + if (paintDSColumnConditionmarkWhenExsit(g2d, value, height, leftDownCount)) { + leftDownCount++; + } + // 画value,但因为是在Grid里面画,所以画Formula.content + if (value instanceof BaseFormula) { + value = ((BaseFormula) value).getContent(); + } + if (value instanceof ImageWithSuffix) { + value = ((ImageWithSuffix) value).getFineImage(); + } + if (value instanceof BaseChartCollection) { + value = ((BaseChartCollection) value).createResultChartPainterWithOutDealFormula(Calculator.createCalculator(), WebChartIDInfo.createEmptyDesignerInfo(), width, height); + } + // Carl:当是子报表时,在格子里画一个子报表的图 + /* + * alex:TODO 此处在Grid里面画ChartCollection和SubReport都只画一个图表,这种做法,很不雅 + */ + if (value instanceof ResultSubReport) { + value = BaseUtils.readImage("/com/fr/base/images/report/painter/subReport.png"); + GraphHelper.paintImage(g2d, width, height, (Image) value, Constants.IMAGE_CENTER, + BaseUtils.getAlignment4Horizontal(cell.getStyle(), value), cell.getStyle().getVerticalAlignment(), + width > 16 ? 16 : width, height > 16 ? 16 : height); + } else { + renderContent(g2d, value, cell.getStyle(), width, height, resolution); + } + } + + + private static void renderContent(Graphics2D g2d, Object value, Style style, int width, int height, int resolution) { + if (value != null && width != 0 && height != 0) { + if (style == null) { + style = Style.DEFAULT_STYLE.deriveImageLayout(1); + } + + if (value instanceof BaseFormula) { + value = ((BaseFormula) value).getResult(); + } + + if (value instanceof Painter) { + ((Painter)value).paint(g2d, width, height, resolution, style); + } else if (value instanceof ImageProvider) { + Style.paintImageContent(g2d, ((ImageProvider) value).getImage(), style, width, height, resolution); + } else if (value instanceof Image) { + Style.paintImageContent(g2d, (Image) value, style, width, height, resolution); + } else { + String var6 = Style.valueToText(value, style.getFormat()); + NewFormStyle.paintCellStyleString2(g2d, width, height, var6, style, resolution); + } + + } + } + + + private static boolean paintHighlightGroupMarkWhenExsit(Graphics2D g2d, TemplateCellElement cell, int left_up_count) { + if (cell.getHighlightGroup() != null && cell.getHighlightGroup().size() > 0) { + Paint oldPaint = g2d.getPaint(); + + g2d.setPaint(CELL_HIGHT_LIGHT_MARK_COLOR); + GeneralPath polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); + polyline.moveTo(0, 0); + polyline.lineTo(0, CELL_MARK_SIZE); + polyline.lineTo(CELL_MARK_SIZE, 0); + GraphHelper.fill(g2d, polyline); + + g2d.setPaint(oldPaint); + return true; + } + return false; + } + + private static boolean paintPresentMarkWhenExsit(Graphics2D g2d, TemplateCellElement cell, int left_up_count) { + if (cell.getPresent() != null) { + Paint oldPaint = g2d.getPaint(); + + g2d.setPaint(CELL_PRESENT_MARK_COLOR); + GeneralPath polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); + polyline.moveTo(0 + left_up_count * CELL_MARK_SIZE, 0); + polyline.lineTo(0 + left_up_count * CELL_MARK_SIZE, 6); + polyline.lineTo(CELL_MARK_SIZE + left_up_count * CELL_MARK_SIZE, 0); + GraphHelper.fill(g2d, polyline); + + g2d.setPaint(oldPaint); + return true; + } + return false; + } + + private static boolean paintPaginationMarkWhenExsit(Graphics2D g2d, TemplateCellElement cell, int width, int ringt_up_count) { + // 右上角: 标记是否有分页 + if (isRightTopMarker(cell)) { + Paint oldPaint = g2d.getPaint(); + + g2d.setPaint(CELL_PAGINATION_MARK_COLOR); + GeneralPath polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); + polyline.moveTo(width - 1 - ringt_up_count * CELL_MARK_SIZE, 0); + polyline.lineTo(width - 1 - ringt_up_count * CELL_MARK_SIZE, CELL_MARK_SIZE); + polyline.lineTo(width - 1 - (ringt_up_count + 1) * CELL_MARK_SIZE, 0); + GraphHelper.fill(g2d, polyline); + + g2d.setPaint(oldPaint); + return true; + } + return false; + } + + private static boolean isRightTopMarker(TemplateCellElement cell) { + return cell.getCellPageAttr() != null && (cell.getCellPageAttr().isPageAfterColumn() + || cell.getCellPageAttr().isPageBeforeColumn() + || cell.getCellPageAttr().isPageAfterRow() + || cell.getCellPageAttr().isPageBeforeRow()); + } + + private static boolean paintResultMarkWhenExsit(Graphics2D g2d, Object value, int width, int ringt_up_count) { + //右上角标记是否自定义显示 + if (value instanceof DSColumn && ((DSColumn) value).getResult() != null) { + if (!ComparatorUtils.equals(((DSColumn) value).getResult(), "$$$")) { + Paint oldPaint = g2d.getPaint(); + + g2d.setPaint(CELL_RESULT_MARK_COLOR); + GeneralPath polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); + polyline.moveTo(width - ringt_up_count * CELL_MARK_SIZE - 1, 0); + polyline.lineTo(width - ringt_up_count * CELL_MARK_SIZE - 1, CELL_MARK_SIZE); + polyline.lineTo(width - (ringt_up_count + 1) * CELL_MARK_SIZE - 1, 0); + GraphHelper.fill(g2d, polyline); + + g2d.setPaint(oldPaint); + return true; + } + } + + return false; + } + + private static void paintWidgetMarkWhenExsit(Graphics2D g2d, TemplateCellElement cell, int width, int height) { + // 右下角:是否填报, 设置为4时,三角太小了,不知何故,设置为6 + if (cell.getWidget() != null) { + Widget widget = cell.getWidget(); + Image img = ((ImageIcon) ReportUtils.createWidgetIcon(widget.getClass())).getImage(); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.67f)); + g2d.drawImage(img, width - 15, height - 15, WIDGET_WIDTH, WIDGET_HEIGHT, null); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); + } + } + + private static void paintExpandMarkWhenExsit(Graphics2D g2d, TemplateCellElement cell) { + CellExpandAttr cellExpandAttr = cell.getCellExpandAttr(); + if (cellExpandAttr != null) { + if (cellExpandAttr.getDirection() == Constants.TOP_TO_BOTTOM) { + Paint oldPaint = g2d.getPaint(); + g2d.setPaint(CELL_DIRECTION_MARK_COLOR); + GraphHelper.drawLine(g2d, 2, 0, 2, 5); + GraphHelper.drawLine(g2d, 2, 5, 0, 2); + GraphHelper.drawLine(g2d, 2, 5, 4, 2); + g2d.setPaint(oldPaint); + } else if (cellExpandAttr.getDirection() == Constants.LEFT_TO_RIGHT) { + Paint oldPaint = g2d.getPaint(); + g2d.setPaint(CELL_DIRECTION_MARK_COLOR); + GraphHelper.drawLine(g2d, 0, 2, 5, 2); + GraphHelper.drawLine(g2d, 5, 2, 2, 0); + GraphHelper.drawLine(g2d, 5, 2, 2, 4); + g2d.setPaint(oldPaint); + } + } + } + + private static boolean paintDSColumnConditionmarkWhenExsit(Graphics2D g2d, Object value, int height, int left_dowm_count) { + // 左下角:数据列(DSColumn)相关:比如条件过滤 + if (value instanceof DSColumn && ((DSColumn) value).getCondition() != null) { + if (((DSColumn) value).getCondition() instanceof ListCondition && + ((ListCondition) ((DSColumn) value).getCondition()).getJoinConditionCount() == 0) { + // do nothing + } else { + Paint oldPaint = g2d.getPaint(); + + g2d.setPaint(CELL_CONDITION_FILTER_MARK_COLOR); + GeneralPath polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); + polyline.moveTo(0 + left_dowm_count * CELL_MARK_SIZE, height - 1); + polyline.lineTo((left_dowm_count + 1) * CELL_MARK_SIZE + 1, height - 1); + polyline.lineTo(0 + left_dowm_count * CELL_MARK_SIZE, height - 2 - CELL_MARK_SIZE); + GraphHelper.fill(g2d, polyline); + + g2d.setPaint(oldPaint); + return true; + } + } + return false; + } + + private static boolean paintDSColumnParametermarkWhenExsit(Graphics2D g2d, Object value, int height, int left_dowm_count) { + // 左下角:动态注入参数 + if (value instanceof DSColumn && ((DSColumn) value).getParameters() != null) { + if (((DSColumn) value).getParameters().length > 0) { + Paint oldPaint = g2d.getPaint(); + + g2d.setPaint(CELL_PARAMETER_FILTER_MARK_CONLR); + GeneralPath polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); + polyline.moveTo(0 + left_dowm_count * CELL_MARK_SIZE, height - 1); + polyline.lineTo((left_dowm_count + 1) * CELL_MARK_SIZE + 1, height - 1); + polyline.lineTo(0 + left_dowm_count * CELL_MARK_SIZE, height - 2 - CELL_MARK_SIZE); + GraphHelper.fill(g2d, polyline); + + g2d.setPaint(oldPaint); + return true; + } + } + return false; + } + + /* + * 画悬浮元素 + * + * 仅根据宽度 + 高度画 + */ + //b:此方法在grid和tohtml的时候都被调用,所以对formula会有冲突,暂时这么改,应该考虑分开的,也可以根据result来判断,但是那么写好像不妥 + public static void paintFloatElement(Graphics2D g2d, FloatElement flotEl, int width, int height, int resolution) { + Style.paintBackground(g2d, flotEl.getStyle(), width, height); + + Object value = flotEl.getValue(); + if (value instanceof BaseFormula) { + value = ((BaseFormula) value).getContent(); + } + if (value instanceof BaseChartCollection) { + value = ((BaseChartCollection) value).createResultChartPainterWithOutDealFormula(Calculator.createCalculator(), WebChartIDInfo.createEmptyDesignerInfo(), width, height); + } + //图片需要切割一下 + if (value instanceof Image) { + value = CellUtils.value2ImageWithBackground(value, resolution, flotEl.getStyle(), width, height); + } + Style.paintContent(g2d, value, flotEl.getStyle(), width, height, resolution); + + Style.paintBorder(g2d, flotEl.getStyle(), width, height); + } + + /* + * 画悬浮元素flotEl + * + * 也就是画三个东西:背景 + 内容 + 边框 + */ + public static void paintFloatElement(Graphics2D g2d, FloatElement flotEl, Rectangle paintRectangle, Rectangle clipRectangle, int resolution) { + // 画悬浮元素的背景 + Style.paintBackground(g2d, flotEl.getStyle(), paintRectangle, clipRectangle); + + Object value = flotEl.getValue(); + if (value instanceof ResultChangeWhenExport) { + value = ((ResultChangeWhenExport) value).changeThis(); + } + // 画悬浮元素的内容 + Style.paintContent(g2d, value, resolution, flotEl.getStyle(), paintRectangle, clipRectangle); + // 画悬浮元素的边框 + Style.paintBorder(g2d, flotEl.getStyle(), paintRectangle, clipRectangle); + } + + public static void paintHTMLContent(Graphics2D g2d, String value, int resolution, Style style, Rectangle paintRectangle, Rectangle clipRectangle) { + Style.paintContent(g2d, createHTMLContentBufferedImage(value, paintRectangle, 0, 0, style), resolution, style, paintRectangle, clipRectangle); + } + + public static void paintTag(Painter painter, Repository repo, int width, int height, Style style, Tag tag) { + painter.paintTag(repo, width, height, style, tag); + } + + /** + * 如果用户希望以HTML方式展示String,这个时候先value变成图片 + * + * @param value 值 + * @param paintRectangle 绘制范围 + * @param x x坐标 + * @param y y坐标 + * @param style 当前格子样式 + * @return BufferedImage 返回图片. + */ + public static BufferedImage createHTMLContentBufferedImage(String value, Rectangle paintRectangle, int x, int y, Style style) { + return Html2ImageUtils.createHTMLContentBufferedImage(value, paintRectangle, x, y, style); + } + + /** + * see BaseUtils.getLineTextList, 等于BaseUtils.getLineTextList().size() + * Denny: 为了提高速度和性能,才单独拿出来的 + * TODO: 重构 + * + * @param text 文本 + * @param style 样式 + * @param paintWidth 单元格宽度 + * @return paintWidth 单位为PT + */ + public static int getLineTextCount(String text, Style style, UNIT paintWidth) { + if (style.getRotation() != 0) { + return 1; + } + + + if (style.getTextStyle() != Style.TEXTSTYLE_WRAPTEXT) { + return dealNotWrapTextCount(text.toCharArray()); + } else {// 自动换行 + return dealWrapTextCount(text, style, paintWidth); + } + } + + private static int dealNotWrapTextCount(char[] text_chars) { + boolean remain_chars = false; + int count = 0; + for (int t = 0; t < text_chars.length; t++) { + if (text_chars[t] == '\\') {// 判断是否是 "\n" + if (t + 1 < text_chars.length && text_chars[t + 1] == 'n') { + // 是"\n"字符串,但不是换行符. + t++; + count++; + if (remain_chars) { + remain_chars = false; + } + } else { + if (!remain_chars) { + remain_chars = true; + } + } + } else if (text_chars[t] == '\n' || (text_chars[t] == '\r' && t + 1 < text_chars.length - 1 && text_chars[t + 1] != '\n')) { + count++; + if (remain_chars) { + remain_chars = false; + } + } else { + if (!remain_chars) { + remain_chars = true; + } + } + } + + // 最后一个 + if (remain_chars) { + count++; + } + + return count; + } + + // 自动换行 + //neil:style里面, 默认值padding right = 2时, 默认不生效, 这边算行高时也不要计算入内 + //临时处理, 去掉左边框线, 因为浏览器计算时需要考虑左边框线宽度, 但这边还是存在问题的 + //同样需要考虑的是导出和web端展示, padding计算方式也不一致. + private static int dealWrapTextCount(String text, Style style, UNIT unitWidth) { + AutoChangeLineAndDrawProcess process = AutoChangeLineAndDrawManager.getProcess(); + if (process != null) { + return process.getAutoChangeLineCount(text, new ObjectHolder(style), unitWidth); + } + int count = 0; + char[] text_chars = text.toCharArray(); + FontMetrics fontMetrics = getFontMetrics(style); + double paintWidth = unitWidth.toPixD(Constants.FR_PAINT_RESOLUTION); + double width = paintWidth - style.getPaddingLeft() - (style.getPaddingRight() == Style.DEFAULT_PADDING ? 0 : style.getPaddingRight()) - style.getBorderLeftWidth(); + boolean remain_lineText = false; + int lineTextWidth = 0; + int wordWidth = 0; + for (int t = 0, len = text_chars.length; t < len; t++) { + if (t != 0 && BaseUtils.isNumOrLetter(text_chars[t]) && BaseUtils.isNumOrLetter(text_chars[t - 1])) { + if (wordWidth + fontMetrics.charWidth(text_chars[t]) > width) { + if (lineTextWidth > 0) { + count++; + remain_lineText = false; + lineTextWidth = 0; + } + count++; + wordWidth = 0; + } + wordWidth += fontMetrics.charWidth(text_chars[t]); + } else if (isSwitchLine(text_chars, t) || isLN(text_chars, t)) {// 判断是否是 "\n" + if (isLN(text_chars, t)) { + t++;// 忽略'n'字符.// 是"\n"字符串,但不是换行符,依然需要换行. + } + if (lineTextWidth + wordWidth > width && remain_lineText) { + count += 2; + } else { + count++; + } + remain_lineText = false; + lineTextWidth = 0; + wordWidth = 0; + } else { + if (text_chars[t] == '\\' && t + 1 < text_chars.length && text_chars[t + 1] == '\\') {// 判断是否是转义字符'\' + t++;// _denny: 增加了转义字符'\\'用来表示\,使"\n"可以输入 + } + if (lineTextWidth + wordWidth > width && remain_lineText) { + count++; + lineTextWidth = isPunctuationAtLineHead(t, text_chars) ? dealLineWidthWithPunctuation(t, text_chars, fontMetrics) : 0; + } + remain_lineText = true; + lineTextWidth += wordWidth; + wordWidth = fontMetrics.charWidth(text_chars[t]); + } + } + if (lineTextWidth + wordWidth > width && remain_lineText) { + count += 2; + } else { + count++; + } + return count; + } + + /** + * 标点符号是否在换行后的行首 + */ + private static boolean isPunctuationAtLineHead(int t, char[] text_chars) { + if (t > 1 && BaseUtils.isPunctuation(text_chars[t - 1])) { + return true; + } + return false; + } + + /** + * 防止有连续多个标点符号,要找一个非标点符号字符 + * + * @date 2014-4-17 + */ + private static int dealLineWidthWithPunctuation(int t, char[] text_chars, FontMetrics fontMetrics) { + if (t < 2) { + return 0; + } + int lineWidth = 0; + for (int index = t - 2; index >= 0; index--) { + lineWidth += fontMetrics.charWidth(text_chars[index]); + if (!BaseUtils.isPunctuation(text_chars[index])) { + break; + } + } + return lineWidth; + } + + private static boolean isSwitchLine(char[] text_chars, int t) { + return text_chars[t] == '\n' || (text_chars[t] == '\r' && t + 1 < text_chars.length - 1 && text_chars[t + 1] != '\n'); + } + + private static boolean isLN(char[] text_chars, int t) { + return text_chars[t] == '\\' && t + 1 < text_chars.length && text_chars[t + 1] == 'n'; + } + + /** + * Gets the preferred width. + */ + public static UNIT getPreferredWidth(CellElement cell, UNIT height) { + if (cell == null) { + return UNIT.ZERO; + } + + Object value = cell.getShowValue(); + // 只接受Text,Number,和SeparatorPainter + // got the text + if (value instanceof BaseFormula) { + if (((BaseFormula) value).getResult() != null) { + value = ((BaseFormula) value).getResult(); + } else { + value = StringUtils.EMPTY; + } + } + Style style = cell.getStyle(); + if (style == null) { + style = Style.DEFAULT_STYLE; + } + CellGUIAttr cg = cell.getCellGUIAttr() == null ? new CellGUIAttr() : cell.getCellGUIAttr(); + value = Utils.resolveOtherValue(value, cg.isShowAsImage(), PresentationType.EXPORT); + String text = Style.valueToText(value, style.getFormat()); + + FontMetrics cellFM = getFontMetrics(style); + //bug 12151 有边框线的单元格 自动调整列宽 会多一行 + UNIT padding = new PT(style.getPaddingLeft() + style.getPaddingRight()); + + if (cg.isShowAsHTML()) { + return Html2ImageUtils.getHtmlWidth(text, height, style); + } + + return FU.valueOfPix(cellFM.stringWidth(text) + UNIT_SIZE, Constants.FR_PAINT_RESOLUTION).add(padding); + } + + private static FontMetrics getFontMetrics(Style style) { + Font font = style.getFRFont().applyResolutionNP(Constants.FR_PAINT_RESOLUTION); + FontProcessor processor = ExtraClassManager.getInstance().getSingle(FontProcessor.MARK_STRING); + if (processor != null) { + font = processor.readExtraFont(font); + } + return GraphHelper.getFontMetrics(font); + } + + /** + * Preferred height. (Got the shrink preferred height of CellElement). + * 单位格的预计算高度 + * + * @param cellElement 单元格内容 + * @param paintWidth 画的宽度 + * @return UNIT 单位 + */ + public static UNIT analyzeCellElementPreferredHeight(CellElement cellElement, UNIT paintWidth) { + // 计算高度用显示值 + Object value = cellElement.getShowValue(); + // 只接受Text,Number,和SeparatorPainter + Style style = cellElement.getStyle(); + // got the text + if (value instanceof BaseFormula) { + if (((BaseFormula) value).getResult() != null) { + value = ((BaseFormula) value).getResult(); + } else { + value = StringUtils.EMPTY; + } + } + CellGUIAttr cg = cellElement.getCellGUIAttr() == null ? new CellGUIAttr() : cellElement.getCellGUIAttr(); + if (!(value instanceof String) && !(value instanceof Integer)) { + value = DataUtils.resolveOtherValue(value, cg.isShowAsImage(), cg.isShowAsDownload(), null, true); + } + String text = Style.valueToText(value, style.getFormat()); + + if (cg.isShowAsHTML()) { + return Html2ImageUtils.getHtmlHeight(text, paintWidth, style); + } + + return PaintUtils.analyzeCellElementPreferredHeight(text, style, paintWidth, cg.isShowAsHTML()); + } + + /** + * 单位格的预计算高度 + * 单位PT + * + * @param text 文本 + * @param style 格式 + * @param paintWidth 画的宽度 + * @param isShowAsHtml 是否以html展示 + * @return 返回 单位 + */ + private static UNIT analyzeCellElementPreferredHeight(String text, Style style, UNIT paintWidth, boolean isShowAsHtml) { + if (style == null) { + //peter:获取默认的Style. + style = Style.DEFAULT_STYLE; + } + + // got the text + if (text == null || text.length() <= 0) { + return PT.valueOf(0); + } + + // 变成Line Text List. + if (style.getRotation() != 0) { // more easy to paint. + // attribute map. + return PT.valueOf((float) GraphHelper.stringDimensionWithRotation(text, style.getFRFont(), -style.getRotation(), + CoreConstants.DEFAULT_FRC).getHeight()); + } + // 先获得FontMetics. + int lineCount = getLineTextCount(text, style, paintWidth); + AutoChangeLineAndDrawProcess process = AutoChangeLineAndDrawManager.getProcess(); + if (process != null) { + //算了这两个接口分开做 + return process.getLinedTextHeight(lineCount, new ObjectHolder(style)); + } + + // carl:和paint那边一致,添上段前段后和行间距 + PT lineSpacing = PT.valueOf(style.getSpacingAfter() + style.getSpacingBefore() + style.getLineSpacing() * lineCount); + FontMetrics fontMetrics = getFontMetrics(style); + int textHeight = fontMetrics.getHeight(); + FU allTextHeight = FU.valueOfPix(textHeight * lineCount, Constants.FR_PAINT_RESOLUTION); + return lineSpacing.add(allTextHeight);// 需要给底部添加Leading. + } + + /** + * 截取文字,只考虑了垂直方向,水平方向没意义且难度大. + * + * @param value 画的值 + * @param style 字体样式格式. + * @param blockArea 冻结的范围 + * @param resolution 分辨率 + * @return 返回的字符串 + */ + public static String clipBlockValue(Object value, Style style, Rectangle primitiveArea, Rectangle blockArea, int resolution, boolean isShowAsHTML) { + if (value == null) { + return null; + } + if (value instanceof BaseFormula) { + value = ((BaseFormula) value).getResult(); + } + if (blockArea.y >= primitiveArea.height || blockArea.y + blockArea.height <= 0) { + return null; + } + //截取位置,相对于clipArea + int startY = blockArea.y > 0 ? blockArea.y : 0; + int endY = blockArea.y + blockArea.height < primitiveArea.height ? blockArea.y + blockArea.height : primitiveArea.height; + if (blockArea.x >= primitiveArea.width || blockArea.x + blockArea.width <= 0) { + return null; + } + if (isShowAsHTML) { + return Html2ImageUtils.clipHtmlContent(value, style, primitiveArea, resolution, startY, endY); + } + List lineList = BaseUtils.getLineTextList((String) value, style, style.getFRFont().applyResolutionNP(resolution), primitiveArea.width, resolution); + if (lineList.isEmpty()) { + return null; + } + double spacingBefore = PT.pt2pix(style.getSpacingBefore(), resolution); + double spacingAfter = PT.pt2pix(style.getSpacingAfter(), resolution); + double lineSpacing = PT.pt2pix(style.getLineSpacing(), resolution); + double lineHeight = lineSpacing + GraphHelper.getFontMetrics(style.getFRFont().applyResolutionNP(resolution)).getHeight(); + int textAllHeight = (int) (lineHeight * lineList.size() + spacingBefore + spacingAfter); + //第一行文字距区域高度 + int textStartY = (int) spacingBefore; + + if (style.getVerticalAlignment() == Constants.BOTTOM) { + textStartY += (primitiveArea.height - textAllHeight); + } + if (endY <= textStartY || startY >= textStartY + lineHeight * lineList.size()) { + return null; + } + int lineStart = getLineStart(lineList, lineHeight, textStartY, startY);//截取区域起始行 + int lineEnd = getLineEnd(lineList, lineHeight, endY, textStartY);//截取区域结束行 + String text = ""; + for (; lineStart <= lineEnd; lineStart++) { + text += lineList.get(lineStart); + } + return text; + } + + private static int getLineStart(List lineList, double lineHeight, int textStartY, int startY) { + int lineStart = 0; + for (int i = 0; i < lineList.size(); i++) { + if (textStartY + lineHeight * (i) <= startY && textStartY + lineHeight * (i + 1) > startY) {//压线 + if (startY - textStartY - lineHeight * (i) > lineHeight / 2) { + lineStart = i + 1; + } else { + lineStart = i; + } + } + } + return lineStart; + } + + private static int getLineEnd(List lineList, double lineHeight, int endY, int textStartY) { + int lineEnd = lineList.size() - 1; + for (int i = 0; i < lineList.size(); i++) { + if (textStartY + lineHeight * (i) < endY && textStartY + lineHeight * (i + 1) >= endY) {//压线 + //neil:仿宋,12号字, 行间距8为例, 转为px的行间距大小为10.666, 这边算出的应该有31.98行, 因此要进位 + if (endY - textStartY - lineHeight * (i) >= lineHeight / 2) { + lineEnd = i; + } else { + lineEnd = i - 1; + } + } + } + return lineEnd; + } + + /** + * paintBarcode + */ + public static void paintBarcode(Graphics2D g2d, int width, int height, String text, Style style, BarcodeAttr barcodeAttr) { + BarcodeImpl barcodeImpl; + try { + barcodeImpl = BarCodeUtils.getBarcodeImpl(barcodeAttr, text); + } catch (BarcodeException exp) { + try { + //设置默认值. + barcodeImpl = BarCodeUtils.getBarcodeImpl(new BarcodeAttr(), null); + } catch (BarcodeException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return; + } + } + + //字体 + if (style.getFRFont() != null) { + barcodeImpl.setFont(style.getFRFont()); + barcodeImpl.setForeground(style.getFRFont().getForeground()); + } + //背景 + Background background = style.getBackground(); + if (background != null && background instanceof ColorBackground) { + barcodeImpl.setBackground(((ColorBackground) background).getColor()); + } + + //根据宽度和高度来确定起始点 + int pointX = (width - barcodeImpl.getWidth()) / 2; + int pointY = (height - barcodeImpl.getHeight()) / 2; + + barcodeImpl.draw(g2d, pointX, pointY); + } + + /** + * create font attribute map, 创建属性map + * + * @param font 字体 + * @return map 返回字体创建的Map + */ + public static Map createFontAttributeMap(Font font) { + Map returnFontAttributeMap = (Map) fontAttributeMapCache.get(font); + if (returnFontAttributeMap == null) {// create + // returnFontAttributeMap. + returnFontAttributeMap = font.getAttributes(); + fontAttributeMapCache.put(font, returnFontAttributeMap); + } + + if (font instanceof FRFont) { + FRFont frFont = (FRFont) font; + + // Strikethrough + if (frFont.isStrikethrough()) { + returnFontAttributeMap.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON); + } + } + + return returnFontAttributeMap; + } + +} diff --git a/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java b/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java new file mode 100644 index 000000000..c760d01da --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java @@ -0,0 +1,214 @@ +package com.fr.design.fit.common; + +import com.fr.design.designer.beans.events.DesignerEvent; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.file.MutilTempalteTabPane; +import com.fr.design.fit.DesignerUIModeConfig; +import com.fr.design.fit.JFormType; +import com.fr.design.fit.NewJForm; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.FormArea; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.JTemplate; +import com.fr.event.Event; +import com.fr.event.Listener; +import com.fr.file.MemFILE; +import com.fr.file.StashedFILE; +import com.fr.form.fit.common.LightTool; +import com.fr.form.fit.NewFormMarkAttr; +import com.fr.form.ui.Widget; +import com.fr.form.ui.widget.CRBoundsWidget; +import com.fr.general.ComparatorUtils; + +import java.awt.Rectangle; +import java.util.List; + +/** + * @description:模板工具类 + * @author: Henry.Wang + * @create: 2020/09/03 14:19 + */ +public class TemplateTool { + //和转换有关的所有代码都在这个监听器中 + //在判断新老模式时,统一使用FormUIModeConfig.getInstance().newUIMode()进行判断 + private static Listener switchListener = new Listener() { + @Override + public void on(Event event, JTemplate jTemplate) { + JFormType currentType = JFormType.OLD_TYPE; + if (AdaptiveSwitchUtil.isSwitchJFromIng()) { + currentType = DesignerUIModeConfig.getInstance().newUIMode() ? JFormType.NEW_TYPE : JFormType.OLD_TYPE; + } else { + if (jTemplate instanceof NewJForm) { + NewJForm newJForm = (NewJForm) jTemplate; + if (newJForm.mobileForm()) { + currentType = JFormType.OLD_TYPE; + } else if (LightTool.containNewFormFlag(newJForm.getTarget()) || newJForm.getTarget().getTemplateID() == null) { + currentType = JFormType.NEW_TYPE; + } + } + } + //UI转换 + currentType.switchUIMode(); + //标志位转换 + currentType.updateJFromTemplateType(jTemplate); + //预览方式转换 + currentType.updatePreviewType(jTemplate); + } + }; + + public static Listener getSwitchListener() { + return switchListener; + } + + /** + * @param + * @Description: 获取当前模板 + * @return: + * @Author: Henry.Wang + * @date: 2020/9/6 14:17 + */ + public static JTemplate getCurrentEditingTemplate() { + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + return jTemplate; + } + + /** + * @param + * @Description: 获取当前NewJForm类型的模板 + * @return: + * @Author: Henry.Wang + * @date: 2020/9/6 14:17 + */ + public static NewJForm getCurrentEditingNewJForm() { + JTemplate jTemplate = getCurrentEditingTemplate(); + if (jTemplate instanceof NewJForm) + return (NewJForm) jTemplate; + return null; + } + + /** + * @param newJTemplate + * @Description: 每次切换设计模式,都会生成新的JForm对象。但是TabPane关联的还是老的JForm对象,所以要重置关联的对象 + * @return: + * @Author: Henry.Wang + * @date: 2020/9/6 14:15 + */ + public static void resetTabPaneEditingTemplate(JTemplate newJTemplate) { + if (newJTemplate == null) + return; + List> jTemplateList = HistoryTemplateListCache.getInstance().getHistoryList(); + for (int i = 0; i < jTemplateList.size(); i++) { + JTemplate oldJTemplate = jTemplateList.get(i); + if (oldJTemplate != null && ComparatorUtils.equals(oldJTemplate.getEditingFILE(), newJTemplate.getEditingFILE())) { + jTemplateList.set(i, newJTemplate); + MutilTempalteTabPane.getInstance().refreshOpenedTemplate(jTemplateList); + return; + } + } + } + + + /** + * @param jTemplate + * @Description: 是否是新建的且没有操作的模板 + * @return: + * @Author: Henry.Wang + * @date: 2020/9/14 20:41 + */ + public static boolean isNewTemplateWithoutModify(JTemplate jTemplate) { + return ((jTemplate.getEditingFILE() instanceof MemFILE) && jTemplate.isSaved()) ? true : false; + } + + /** + * @param template + * @Description: 激活模板 + * @return: + * @Author: Henry.Wang + * @date: 2020/9/6 14:16 + */ + public static void activeAndResizeTemplate(JTemplate template) { + DesignerContext.getDesignerFrame().addAndActivateJTemplate(template); + DesignerContext.getDesignerFrame().setVisible(true); + DesignerContext.getDesignerFrame().resizeFrame(); + } + + /** + * @param jTemplate + * @Description:保存模板 + * @return: + * @Author: Henry.Wang + * @date: 2020/9/6 14:32 + */ + public static void saveForm(JTemplate jTemplate) { + //为空不保存 + if (jTemplate == null) + return; + //不是NewJForm的模板不保存 + if (!(jTemplate instanceof NewJForm)) + return; + //切换环境时产生的模板不保存 + if (jTemplate.getEditingFILE() instanceof StashedFILE) + return; + //新建的且没有操作的模板不保存 + if (TemplateTool.isNewTemplateWithoutModify(jTemplate)) + return; + jTemplate.stopEditing(); + jTemplate.saveTemplate(); + jTemplate.requestFocus(); + } + + /** + * @param height + * @param width + * @param newJForm + * @Description: 只改变绝对布局body的尺寸 + * @return: + * @Author: Henry.Wang + * @date: 2020/9/11 15:14 + */ + public static void onlyChangeAbsoluteBodySize(int height, int width, NewJForm newJForm) { + FormDesigner formDesigner = newJForm.getFormDesign(); + FormArea formArea = formDesigner.getArea(); + XLayoutContainer root = formDesigner.getRootComponent(); + XWAbsoluteBodyLayout xwAbsoluteBodyLayout = LayoutTool.getXWAbsoluteBodyLayout(newJForm); + if (root.acceptType(XWFitLayout.class) && xwAbsoluteBodyLayout != null) { + XWFitLayout layout = (XWFitLayout) root; + if (height == layout.toData().getContainerHeight() && width == layout.toData().getContainerWidth()) + return; + formArea.setWidthPaneValue(width); + formArea.setHeightPaneValue(height); + layout.setSize(width, height); + xwAbsoluteBodyLayout.setSize(width, height); + Widget widget = layout.toData().getWidget(0); + if (widget instanceof CRBoundsWidget) { + ((CRBoundsWidget) widget).setBounds(new Rectangle(0, 0, width, height)); + } + layout.toData().setContainerWidth(width); + layout.toData().setContainerHeight(height); + formArea.doReCalculateRoot(width, height, layout); + } + formDesigner.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); + } + + /** + * @param newJForm + * @Description: 因为新老模板切换有截断的问题,所以body的尺寸会在调用onlyChangeAbsoluteBodySize之后发生改变。为了使模板文件中的尺寸不发生,要在模板保存时调用此函数 + * @return: + * @Author: Henry.Wang + * @date: 2020/9/11 15:20 + */ + public static void resetAbsoluteBodySize(NewJForm newJForm) { + if (LayoutTool.absoluteLayoutForm(newJForm)) { + NewFormMarkAttr newFormMarkAttr = newJForm.getTarget().getAttrMark(NewFormMarkAttr.XML_TAG); + XLayoutContainer root = newJForm.getFormDesign().getRootComponent(); + if (newFormMarkAttr != null && root instanceof XWFitLayout) { + ((XWFitLayout) root).toData().setContainerWidth(newFormMarkAttr.getBodyWidth()); + ((XWFitLayout) root).toData().setContainerHeight(newFormMarkAttr.getBodyHeight()); + } + } + } + +} diff --git a/designer-form/src/main/java/com/fr/design/fit/menupane/BrowserFitAttrPane.java b/designer-form/src/main/java/com/fr/design/fit/menupane/BrowserFitAttrPane.java new file mode 100644 index 000000000..fdc2f8332 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/menupane/BrowserFitAttrPane.java @@ -0,0 +1,303 @@ +package com.fr.design.fit.menupane; + +import com.fr.config.Configuration; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fit.FitStateCompatible; +import com.fr.design.fit.JFormType; +import com.fr.form.fit.FitType; +import com.fr.form.fit.config.FormFitConfig; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIRadioButton; +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.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.report.fit.ReportFitAttr; +import com.fr.stable.StringUtils; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * Created by Administrator on 2016/5/5/0005. + */ +public class BrowserFitAttrPane extends BasicBeanPane { + + protected FontRadioGroup fontRadioGroup; + protected FitRadioGroup fitRadionGroup; + protected UICheckBox globalCheck; + protected FitPreviewPane fitPreviewPane; + protected ReportFitAttr localFitAttr; + protected UIRadioButton horizonRadio; + protected UIRadioButton doubleRadio; + protected UIRadioButton notFitRadio; + protected UIRadioButton fontFitRadio; + protected UIRadioButton fontNotFitRadio; + private UIButton editGlobalOps; + private JPanel borderPane; + private JPanel globalOpsPane; + private JPanel fitOpsPane; + private final JFormType jFormType; + + public BrowserFitAttrPane(JFormType jFormType, ReportFitAttr fitAttr) { + this.jFormType = jFormType; + if (fitAttr == null) { + initComponents(jFormType.obtainFitAttr()); + } else { + initComponents(fitAttr); + } + } + + protected void initComponents(ReportFitAttr globalFitAttr) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + globalOpsPane = initGlobalOpsPane(globalFitAttr); + this.add(globalOpsPane, BorderLayout.NORTH); + fitOpsPane = initFitOpsPane(); + } + + protected void initBorderPane(String title) { + borderPane = FRGUIPaneFactory.createTitledBorderPaneCenter(title); + borderPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 0)); + borderPane.add(fitOpsPane, BorderLayout.WEST); + fitPreviewPane = new FitPreviewPane(); + borderPane.add(fitPreviewPane, BorderLayout.SOUTH); + borderPane.add(getHintUILabel()); + this.add(borderPane, BorderLayout.CENTER); + } + + /** + * @Description: 获取提示信息 + * @param + * @return: + * @Author: Henry.Wang + * @date: 2020/9/9 16:09 + */ + private UILabel getHintUILabel() { + String hint = globalCheck.isSelected() ? getFillBlank(3) + Toolkit.i18nText("Fine-Designer_Fit_Attr_Pane_Hint") : StringUtils.EMPTY; + UILabel hintUILabel = new UILabel(hint); + hintUILabel.setForeground(new Color(143, 143, 146)); + return hintUILabel; + } + + /** + * @Description: 获取空字符串 + * @param n + * @return: + * @Author: Henry.Wang + * @date: 2020/9/9 16:09 + */ + private String getFillBlank(int n) { + String s = ""; + for (int i = 0; i < n; i++) { + s = s + " "; + } + return s; + } + + private JPanel initFitOpsPane() { + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] columnSize = {p, p, p, p, p}; + + ActionListener actionListener = getPreviewActionListener(); + + fontRadioGroup = new FontRadioGroup(); + fontFitRadio = new UIRadioButton(Toolkit.i18nText("Fine-Designer_Fit") + getFillBlank(4)); + fontFitRadio.setSelected(true); + fontNotFitRadio = new UIRadioButton(Toolkit.i18nText("Fine-Designer_Fit-No") + getFillBlank(2)); + addRadioToGroup(fontRadioGroup, fontFitRadio, fontNotFitRadio); + fontRadioGroup.addActionListener(actionListener); + + fitRadionGroup = new FitRadioGroup(); + horizonRadio = new UIRadioButton(FitType.HORIZONTAL_FIT.description()); + doubleRadio = new UIRadioButton(FitType.DOUBLE_FIT.description()); + notFitRadio = new UIRadioButton(FitType.NOT_FIT.description()); + addRadioToGroup(fitRadionGroup, doubleRadio, horizonRadio, notFitRadio); + fitRadionGroup.addActionListener(actionListener); + + + JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(initFitComponents(), rowSize, columnSize); + fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); + return fitOpsPane; + } + + protected Component[][] initFitComponents() { + UILabel fitFontLabel = new UILabel(Toolkit.i18nText("Fine-Designer_Fit-Font")); + fitFontLabel.setHorizontalAlignment(SwingConstants.RIGHT); + UILabel reportFitLabel = new UILabel(Toolkit.i18nText("Fine-Designer_Fit_Report_Scale_Method")); + reportFitLabel.setHorizontalAlignment(SwingConstants.RIGHT); + Component[][] components = new Component[][]{ + new Component[]{fitFontLabel, createFontRadioGroupPane()}, + new Component[]{reportFitLabel, createFitAttrRadioGroupPane()} + }; + return components; + } + + private JPanel createFontRadioGroupPane() { + JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + panel.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0)); + panel.add(fontFitRadio); + panel.add(fontNotFitRadio); + return panel; + } + + private JPanel createFitAttrRadioGroupPane() { + JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + panel.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0)); + panel.add(doubleRadio); + panel.add(horizonRadio); + panel.add(notFitRadio); + return panel; + } + + private void addRadioToGroup(ButtonGroup buttonGroup, UIRadioButton... radios) { + for (UIRadioButton radio : radios) { + buttonGroup.add(radio); + } + } + + private JPanel initGlobalOpsPane(final ReportFitAttr globalFitAttr) { + final JPanel globalOpsPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); + globalCheck = new UICheckBox(Toolkit.i18nText("Fine-Designer_Fit-UseGlobal")); + globalOpsPane.add(globalCheck); + globalCheck.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + boolean isLocalConfig = !globalCheck.isSelected(); + //勾选全局时,采用全局保存的自适应属性更新界面 + if (!isLocalConfig) { + ReportFitAttr attr = globalFitAttr; + populateAttrPane(attr); + remove(BrowserFitAttrPane.this.borderPane); + initBorderPane(Toolkit.i18nText("Fine-Designer_Fit-Global")); + } else { + ReportFitAttr attr = localFitAttr; + populateAttrPane(attr); + remove(BrowserFitAttrPane.this.borderPane); + initBorderPane(Toolkit.i18nText("Fine-Designer_Fit-Local")); + } + fontRadioGroup.setEnabled(isLocalConfig); + fitRadionGroup.setEnabled(isLocalConfig); + editGlobalOps.setVisible(!isLocalConfig); + String fitOptions = getCurrentFitOptions(); + fitPreviewPane.refreshPreview(fitOptions, fitRadionGroup.isEnabled()); + } + }); + + editGlobalOps = new UIButton(Toolkit.i18nText("Fine-Designer_Fit-EditGlobal")); + editGlobalOps.setVisible(false); + editGlobalOps.addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent evt) { + fontRadioGroup.setEnabled(true); + fitRadionGroup.setEnabled(true); + String fitOptions = getCurrentFitOptions(); + + fitPreviewPane.refreshPreview(fitOptions, fitRadionGroup.isEnabled()); + } + + public void mouseEntered(MouseEvent e) { + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } + + public void mouseExited(MouseEvent e) { + setCursor(Cursor.getDefaultCursor()); + } + }); + globalOpsPane.add(editGlobalOps); + return globalOpsPane; + } + + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Designer_Fit-AttrSet"); + } + + @Override + public void populateBean(ReportFitAttr attr) { + if (attr == null) { + //如果为空, 就用全局的 + attr = this.jFormType.obtainFitAttr(); + populateGlobalComponents(); + } else { + initBorderPane(Toolkit.i18nText("Fine-Designer_Fit-Local")); + } + this.localFitAttr = attr; + populateAttrPane(attr); + } + + private void populateAttrPane(ReportFitAttr attr) { + fontRadioGroup.selectFontFit((attr).isFitFont()); + int fitState = FitStateCompatible.getNewTypeFromOld(attr.fitStateInPC()); + fitRadionGroup.selectIndexButton(fitState); + fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled()); + } + + protected void populateGlobalComponents() { + globalCheck.setSelected(true); + fontRadioGroup.setEnabled(false); + fitRadionGroup.setEnabled(false); + editGlobalOps.setVisible(true); + initBorderPane(Toolkit.i18nText("Fine-Designer_Fit-Global")); + } + + //有八种组合, 不过有意义的就是6种, 以此为key去缓存里找对应的预览图片 + public String getCurrentFitOptions() { + return fitRadionGroup.getSelectRadioIndex() + "" + fontRadioGroup.getSelectRadioIndex(); + } + + private ActionListener getPreviewActionListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String fitOptions = getCurrentFitOptions(); + fitPreviewPane.refreshPreview(fitOptions, fontRadioGroup.isEnabled()); + } + }; + } + + @Override + public ReportFitAttr updateBean() { + ReportFitAttr attr = new ReportFitAttr(); + attr.setFitFont(fontRadioGroup.isFontFit()); + int fitState = FitStateCompatible.getOldTypeFromNew(fitRadionGroup.getSelectRadioIndex()); + attr.setFitStateInPC(fitState); + + // 直接用全局的 + if (globalCheck.isSelected()) { + updateGlobalConfig(attr); + return null; + } + this.localFitAttr = attr; + return attr; + } + + private void updateGlobalConfig(final ReportFitAttr attr) { + + Configurations.update(new Worker() { + @Override + public void run() { + jFormType.updateFitAttr(attr); + } + + @Override + public Class[] targets() { + return new Class[]{FormFitConfig.class}; + } + }); + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/menupane/FitPreviewPane.java b/designer-form/src/main/java/com/fr/design/fit/menupane/FitPreviewPane.java new file mode 100644 index 000000000..ed387f39d --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/menupane/FitPreviewPane.java @@ -0,0 +1,76 @@ +package com.fr.design.fit.menupane; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.IOUtils; + +import javax.swing.ImageIcon; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by Administrator on 2016/5/5/0005. + */ +public class FitPreviewPane extends BasicPane { + private static final String DEFAULT_FONT_TAG = "00"; + private static final String DEFAULT_TAG = "01"; + private static final String HORIZON_FONT_TAG = "10"; + private static final String HORIZON_TAG = "11"; + private static final String DOUBLE_FONT_TAG = "20"; + private static final String DOUBLE_TAG = "21"; + private static final String NOT_FONT_TAG = "30"; + private static final String NOT_TAG = "31"; + + private UILabel imageLabel; + private Map cachedPreviewImage = new HashMap(); + private Map globalCachedPreviewImage = new HashMap(); + + public FitPreviewPane() { + //初始化缓存图片, 有些无意义的组合. + initCacheImage(); + //初始化组件 + initComponents(); + this.setPreferredSize(new Dimension(540, 170)); + } + + //默认和不自适应时,字体自适应不起效,只有6张图 + private void initCacheImage() { + globalCachedPreviewImage.put(DEFAULT_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + DOUBLE_FONT_TAG + ".png"))); + globalCachedPreviewImage.put(DEFAULT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + DOUBLE_TAG + ".png"))); + globalCachedPreviewImage.put(HORIZON_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + HORIZON_FONT_TAG + ".png"))); + globalCachedPreviewImage.put(HORIZON_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + HORIZON_TAG + ".png"))); + globalCachedPreviewImage.put(DOUBLE_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + NOT_FONT_TAG + ".png"))); + globalCachedPreviewImage.put(DOUBLE_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + NOT_FONT_TAG + ".png"))); + + cachedPreviewImage.put(DEFAULT_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + DOUBLE_FONT_TAG + ".png"))); + cachedPreviewImage.put(DEFAULT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + DOUBLE_TAG + ".png"))); + cachedPreviewImage.put(HORIZON_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + HORIZON_FONT_TAG + ".png"))); + cachedPreviewImage.put(HORIZON_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + HORIZON_TAG + ".png"))); + cachedPreviewImage.put(DOUBLE_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + NOT_FONT_TAG + ".png"))); + cachedPreviewImage.put(DOUBLE_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + NOT_FONT_TAG + ".png"))); + + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createCenterFlowLayout()); + imageLabel = new UILabel(); + ImageIcon image = cachedPreviewImage.get(DEFAULT_TAG); + imageLabel.setIcon(image); + this.add(imageLabel, BorderLayout.CENTER); + } + + public void refreshPreview(String index, boolean isEditedable) { + ImageIcon newImageIcon = isEditedable ? cachedPreviewImage.get(index) : globalCachedPreviewImage.get(index); + imageLabel.setIcon(newImageIcon); + } + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Preview"); + } + + +} diff --git a/designer-form/src/main/java/com/fr/design/fit/menupane/FitRadioGroup.java b/designer-form/src/main/java/com/fr/design/fit/menupane/FitRadioGroup.java new file mode 100644 index 000000000..46fb32768 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/menupane/FitRadioGroup.java @@ -0,0 +1,80 @@ +package com.fr.design.fit.menupane; + +import com.fr.design.gui.ibutton.UIRadioButton; + +import javax.swing.AbstractButton; +import javax.swing.ButtonGroup; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +/** + * 自适应四个按钮选项的group + *

+ * Created by Administrator on 2016/5/5/0005. + */ +public class FitRadioGroup extends ButtonGroup { + + private List radioButtons = new ArrayList(); + + @Override + public void add(AbstractButton button) { + super.add(button); + + UIRadioButton radioButton = (UIRadioButton) button; + radioButtons.add(radioButton); + } + + /** + * 设置按钮状态 + */ + public boolean isEnabled() { + return radioButtons.get(0).isEnabled(); + } + + /** + * 设置按钮状态 + */ + public void setEnabled(boolean enabled) { + for (UIRadioButton radioButton : radioButtons) { + radioButton.setEnabled(enabled); + } + } + + /** + * 获取当前选中的按钮index + * + * @return 按钮index + */ + public int getSelectRadioIndex() { + for (int i = 0, len = radioButtons.size(); i < len; i++) { + if (radioButtons.get(i).isSelected()) { + return i; + } + } + + return 0; + } + + /** + * 选中指定index的按钮 + */ + public void selectIndexButton(int index) { + if (index < 0 || index > radioButtons.size() - 1) { + return; + } + + UIRadioButton button = radioButtons.get(index); + button.setSelected(true); + } + + /** + * 给所有的按钮加上监听 + */ + public void addActionListener(ActionListener actionListener) { + for (UIRadioButton radioButton : radioButtons) { + radioButton.addActionListener(actionListener); + } + } + +} diff --git a/designer-form/src/main/java/com/fr/design/fit/menupane/FontRadioGroup.java b/designer-form/src/main/java/com/fr/design/fit/menupane/FontRadioGroup.java new file mode 100644 index 000000000..8d26f4074 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/menupane/FontRadioGroup.java @@ -0,0 +1,17 @@ +package com.fr.design.fit.menupane; + +/** + * 字体的两个选项组成的group + *

+ * Created by Administrator on 2016/5/5/0005. + */ +public class FontRadioGroup extends FitRadioGroup { + + public void selectFontFit(boolean isFontFit) { + selectIndexButton(isFontFit ? 0 : 1); + } + + public boolean isFontFit() { + return getSelectRadioIndex() == 0; + } +} diff --git a/designer-form/src/main/java/com/fr/design/fit/menupane/FormFitAttrPane.java b/designer-form/src/main/java/com/fr/design/fit/menupane/FormFitAttrPane.java new file mode 100644 index 000000000..be1411264 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/menupane/FormFitAttrPane.java @@ -0,0 +1,58 @@ +package com.fr.design.fit.menupane; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fit.NewJForm; +import com.fr.report.fit.ReportFitAttr; + +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; + +/** + * Created by Administrator on 2015/7/6 0006. + */ +public class FormFitAttrPane extends BasicBeanPane { + + private BrowserFitAttrPane attrPane; + private NewJForm newJForm; + + public FormFitAttrPane(NewJForm newJForm) { + this.newJForm = newJForm; + initComponents(); + } + + private void initComponents() { + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 2, 10)); + attrPane = new BrowserFitAttrPane(this.newJForm.getJFormType(),this.newJForm.getTarget().getReportFitAttr()); + this.add(attrPane); + + } + + /** + * 展示界面 + * + * @param fitAttr 自适应属性 + */ + public void populateBean(ReportFitAttr fitAttr) { + attrPane.populateBean(fitAttr); + } + + /** + * 提交数据 + * + * @return 界面上的更新数据 + */ + public ReportFitAttr updateBean() { + return attrPane.updateBean(); + } + + /** + * 标题 + * + * @return 标题 + */ + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_PC_Adaptive_Attr"); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/fit/toolbar/SwitchAction.java b/designer-form/src/main/java/com/fr/design/fit/toolbar/SwitchAction.java new file mode 100644 index 000000000..e14d39a68 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fit/toolbar/SwitchAction.java @@ -0,0 +1,287 @@ +package com.fr.design.fit.toolbar; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.file.TemplateTreePane; +import com.fr.design.fit.DesignerUIModeConfig; +import com.fr.design.fit.NewJForm; +import com.fr.design.fit.common.AdaptiveSwitchUtil; +import com.fr.design.fit.common.TemplateTool; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.BaseJForm; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.menu.MenuKeySet; +import com.fr.file.FILE; +import com.fr.file.FILEChooserPane; +import com.fr.file.FileFILE; +import com.fr.file.FileNodeFILE; +import com.fr.file.MemFILE; +import com.fr.file.filetree.FileNode; +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; + +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.KeyStroke; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.nio.file.Paths; + +import static javax.swing.JOptionPane.OK_CANCEL_OPTION; +import static javax.swing.JOptionPane.WARNING_MESSAGE; +import static javax.swing.JOptionPane.YES_NO_OPTION; + +/** + * Created by kerry on 2020-06-02 + */ +public class SwitchAction extends UpdateAction { + + private UIButton switchBtn; + private static final Icon SWITCH_ICON = IOUtils.readIcon("/com/fr/design/form/images/icon_switch.png"); + private static final String LOADING_ICON_PATH = "/com/fr/design/form/images/loading.png"; + private static final MenuKeySet SWITCH_ATTR = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'C'; + } + + @Override + public String getMenuName() { + return Toolkit.i18nText("Fine-Designer_Fit_Switch_To_Old_UI"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; + + public SwitchAction() { + initMenuStyle(); + } + + private void initMenuStyle() { + this.setMenuKeySet(SWITCH_ATTR); + this.setName(getMenuKeySet().getMenuKeySetName()); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(SWITCH_ICON); + this.setAccelerator(getMenuKeySet().getKeyStroke()); + switchBtn = (UIButton) this.createToolBarComponent(); + switchBtn.set4ToolbarButton(); + switchBtn.setIcon(SWITCH_ICON); + Font oldFont = switchBtn.getFont(); + switchBtn.setFont(new Font(oldFont.getName(),oldFont.getStyle(),12)); + switchBtn.setForeground(new Color(0x33, 0x33, 0x34)); + freshSwitchButton(); + } + + @Override + public void actionPerformed(ActionEvent e) { + //如果此时模板还在切换中,则直接返回 + if (AdaptiveSwitchUtil.isSwitchJFromIng() || !saveCurrentEditingTemplate()) + return; + backToFormTab(); + if (confirmSwitchDialog() && backUpOldModeJTemplate()) { + AdaptiveSwitchUtil.setSwitchJFromIng(1); + showLoadingJPanel(); + if (DesignerUIModeConfig.getInstance().newUIMode()) { + AdaptiveSwitchUtil.switch2OldUI(); + } else { + AdaptiveSwitchUtil.switch2NewUI(); + } + } + } + + /** + * @Description: 对未存储在磁盘的模板进行界面切换 + * @return: + * @Author: Henry.Wang + * @date: 2020/10/22 17:26 + */ + public boolean saveCurrentEditingTemplate() { + JTemplate jTemplate = TemplateTool.getCurrentEditingTemplate(); + if (!(jTemplate.getEditingFILE() instanceof FileNodeFILE) || !jTemplate.getEditingFILE().exists()) { + int returnVal = FineJOptionPane.showConfirmDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), + Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + OK_CANCEL_OPTION, + WARNING_MESSAGE); + if (returnVal == JOptionPane.YES_OPTION) { + jTemplate.stopEditing(); + if ((jTemplate.getEditingFILE() instanceof MemFILE) || !jTemplate.getEditingFILE().exists()) { + return jTemplate.saveTemplate(); + } else if (jTemplate.getEditingFILE() instanceof FileFILE) { + return jTemplate.saveAsTemplate2Env(); + } + } + return false; + } + return true; + } + + /** + * @Description: 显示加载中界面 + * @param + * @return: + * @Author: Henry.Wang + * @date: 2020/9/30 15:18 + */ + public void showLoadingJPanel() { + JComponent area = TemplateTool.getCurrentEditingNewJForm().getFormDesign().getArea(); + JComponent formDesigner = TemplateTool.getCurrentEditingNewJForm().getFormDesign(); + area.remove(formDesigner); + + JPanel loadingJPanel = new JPanel(new BorderLayout()); + loadingJPanel.setBackground(Color.WHITE); + loadingJPanel.setBounds(formDesigner.getBounds()); + JLabel jLabel = new JLabel(new ImageIcon(this.getClass().getResource(LOADING_ICON_PATH)), JLabel.CENTER); + loadingJPanel.add(jLabel, BorderLayout.CENTER); + + area.setLayout(null); + area.add(loadingJPanel); + DesignerContext.getDesignerFrame().setVisible(true); + } + + + /** + * @Description: 如果是在报表块编辑状态进行切换时,会先回到表单页 + * @param + * @return: + * @Author: Henry.Wang + * @date: 2020/9/30 15:20 + */ + private void backToFormTab() { + NewJForm newJForm = TemplateTool.getCurrentEditingNewJForm(); + if (newJForm != null && newJForm.getEditingReportIndex() != BaseJForm.FORM_TAB) { + newJForm.tabChanged(BaseJForm.FORM_TAB); + } + } + + /** + * @param + * @Description: 备份老设计模式下的模板文件 + * @return: + * @Author: Henry.Wang + * @date: 2020/9/23 16:24 + */ + private boolean backUpOldModeJTemplate() { + JTemplate jTemplate = TemplateTool.getCurrentEditingTemplate(); + if (jTemplate != null && !DesignerUIModeConfig.getInstance().newUIMode()) { + FILE editingFILE = jTemplate.getEditingFILE(); + if (editingFILE != null && editingFILE.exists()) { + try { + //待备份的文件名称 + String fileName = editingFILE.getName().substring(0, editingFILE.getName().length() - jTemplate.suffix().length()) + "_bak"; + //生成要备份的文件对象 + FILE backUpFile = null; + FileNodeFILE directory = getFileParentDirectory(jTemplate.getEditingFILE()); + if (directory != null) + backUpFile = new FileNodeFILE(directory, fileName + jTemplate.suffix(), false); + //要备份的文件存在 + if (backUpFile != null && backUpFile.exists()) { + if (!confirmCoverFileDialog()) { + FILEChooserPane fileChooser = FILEChooserPane.getInstance(true, true); + fileChooser.setFileNameTextField(fileName, jTemplate.suffix()); + fileChooser.setCurrentDirectory(directory); + int chooseResult = fileChooser.showSaveDialog(DesignerContext.getDesignerFrame(), jTemplate.suffix()); + if ((chooseResult == FILEChooserPane.CANCEL_OPTION) || + (chooseResult == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION)) { + return false; + } + backUpFile = fileChooser.getSelectedFILE(); + } + } + jTemplate.getTarget().export(backUpFile.asOutputStream()); + TemplateTreePane.getInstance().refresh(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + return false; + } + return true; + } + } + return true; + } + + /** + * @param file + * @Description: 获得当前文件的父目录 + * @return: + * @Author: Henry.Wang + * @date: 2020/9/23 16:50 + */ + public static FileNodeFILE getFileParentDirectory(FILE file) { + FileNodeFILE fileParent = null; + if (file instanceof FileNodeFILE) { + FileNodeFILE fileNodeFILE = (FileNodeFILE) file; + FileNode fileNode = new FileNode(Paths.get(fileNodeFILE.getPath()).getParent().toString(), true); + fileParent = new FileNodeFILE(fileNode, fileNodeFILE.getEnvPath()); + } + return fileParent; + } + + /** + * @param + * @Description: 确认是否弹出框 + * @return: 点击确定返回true + * @Author: Henry.Wang + * @date: 2020/9/18 11:20 + */ + private boolean confirmSwitchDialog() { + Object message = DesignerUIModeConfig.getInstance().newUIMode() ? Toolkit.i18nText("Fine-Designer_Fit_Confirm_New_Old_Switch") : Toolkit.i18nText("Fine-Designer_Fit_Confirm_Old_New_Switch"); + int returnVal = FineJOptionPane.showConfirmDialog( + DesignerContext.getDesignerFrame(), + message, + Toolkit.i18nText("Fine-Design_Basic_Confirm"), + YES_NO_OPTION); + return returnVal == JOptionPane.YES_OPTION; + } + + /** + * @param + * @Description: 是否覆盖文件 + * @return: + * @Author: Henry.Wang + * @date: 2020/9/23 17:00 + */ + private boolean confirmCoverFileDialog() { + int returnVal = FineJOptionPane.showConfirmDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Designer_Fit_Cover_File_Switch"), + Toolkit.i18nText("Fine-Design_Basic_Confirm"), + YES_NO_OPTION); + return returnVal == JOptionPane.YES_OPTION; + } + + /** + * @param + * @Description:更新按钮的状态 + * @return: + * @Author: Henry.Wang + * @date: 2020/8/31 16:39 + */ + public UIButton freshSwitchButton() { + if (DesignerUIModeConfig.getInstance().newUIMode()) { + switchBtn.setToolTipText(Toolkit.i18nText("Fine-Designer_Fit_Switch_To_Old_UI")); + switchBtn.setText(Toolkit.i18nText("Fine-Designer_Fit_Switch_To_Old_Version")); + } else { + switchBtn.setToolTipText(Toolkit.i18nText("Fine-Designer_Fit_Switch_To_New_UI")); + switchBtn.setText(Toolkit.i18nText("Fine-Designer_Fit_Switch_To_New_Version")); + } + return switchBtn; + } + + public UIButton getToolBarButton() { + return freshSwitchButton(); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java b/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java index d976691c6..e475133a9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java @@ -1,10 +1,10 @@ package com.fr.design.mainframe; import com.fr.design.constants.UIConstants; +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; import com.fr.share.ShareConstants; -import com.fr.general.FRScreen; import com.fr.general.IOUtils; import com.fr.stable.StringUtils; @@ -63,7 +63,7 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{ // controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH); controlButton.setVisible(false); helpDialog = new WidgetHelpDialog(DesignerContext.getDesignerFrame(), helpMsg); - double screenValue = FRScreen.getDesignScreenByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue(); + double screenValue = DesignerUIModeConfig.getInstance().getDesignScreenByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue(); int offsetX = 0; if (screenValue < FormArea.DEFAULT_SLIDER) { offsetX = (int) ((1 - screenValue / FormArea.DEFAULT_SLIDER) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java index f127f8ea0..bc4e941fc 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java @@ -1,14 +1,13 @@ package com.fr.design.mainframe; -import com.fr.base.ScreenResolution; import com.fr.common.inputevent.InputEventBaseOnOS; -import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.fit.DesignerUIModeConfig; +import com.fr.form.fit.NewFormMarkAttr; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.layout.TableLayout; @@ -79,7 +78,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent { private boolean isValid = true; // 初始时滑块值为100,托动后的值设为START_VALUE; private double START_VALUE = DEFAULT_SLIDER; - private int resolution = ScreenResolution.getScreenResolution(); private double screenValue; @@ -253,7 +251,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { private void initCalculateSize() { Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension scrnsize = toolkit.getScreenSize(); - this.screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue(); + this.screenValue = DesignerUIModeConfig.getInstance().getDesignScreenByDimension(scrnsize).getValue(); XLayoutContainer root = FormArea.this.designer.getRootComponent(); // 7.1.1不放缩放滑块,但表单大小仍按屏幕分辨率调整 // slidePane.populateBean(screenValue); @@ -285,10 +283,19 @@ public class FormArea extends JComponent implements ScrollRulerComponent { // 失去焦点时,可以认为输入结束 int width = (int) ((UINumberField) e.getSource()).getValue(); changeWidthPaneValue(width); + changeFormMarkAttrWidth(width); } }); } + private void changeFormMarkAttrWidth(int width) { + NewFormMarkAttr newFormMarkAttr = designer.getTarget().getAttrMark(NewFormMarkAttr.XML_TAG); + if (newFormMarkAttr != null) { + newFormMarkAttr.setBodyWidth(width); + } + } + + private void changeWidthPaneValue(int width) { XWFitLayout layout = (XWFitLayout) designer.getRootComponent(); if (width != layout.toData().getContainerWidth()) { @@ -303,6 +310,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { public void actionPerformed(ActionEvent evt) { int height = (int) ((UINumberField) evt.getSource()).getValue(); changeHeightPaneValue(height); + changeFormMarkAttrHeight(height); } }); heightPane.addFocusListener( @@ -315,6 +323,14 @@ public class FormArea extends JComponent implements ScrollRulerComponent { }); } + private void changeFormMarkAttrHeight(int height){ + NewFormMarkAttr newFormMarkAttr = designer.getTarget().getAttrMark(NewFormMarkAttr.XML_TAG); + if (newFormMarkAttr != null) { + newFormMarkAttr.setBodyHeight(height); + } + } + + private void changeHeightPaneValue(int height) { XWFitLayout layout = (XWFitLayout) designer.getRootComponent(); if (height != layout.toData().getContainerHeight()) { @@ -383,7 +399,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { /** * 修改大小后,再根据屏幕分辨率调整下 */ - private void doReCalculateRoot(int width, int height, XWFitLayout layout) { + public void doReCalculateRoot(int width, int height, XWFitLayout layout) { // double value = slidePane.updateBean(); //重置滑块的值为默认值100 START_VALUE = DEFAULT_SLIDER; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index 1d4fad8e3..f167a2c72 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -43,6 +43,7 @@ import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.fun.RightSelectionHandlerProvider; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; @@ -144,7 +145,7 @@ public class FormDesigner extends TargetComponent

implements TreeSelection // 存储被选择组件和剪切板的model private transient SelectionModel selectionModel; - private int resolution = ScreenResolution.getScreenResolution(); + private int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); // 编辑状态的事件表 private CreatorEventListenerTable edit; protected List designerActions; diff --git a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java new file mode 100644 index 000000000..7db99129c --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java @@ -0,0 +1,53 @@ +package com.fr.design.preview; + +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.fun.impl.AbstractPreviewProvider; +import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.JTemplate; +import com.fr.general.web.ParameterConstants; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by kerry on 2020-04-23 + */ +public class DeveloperPreview extends AbstractPreviewProvider { + private static final int PREVIEW_TYPE = 7; + + @Override + public String nameForPopupItem() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Developer_Preview"); + } + + @Override + public String iconPathForPopupItem() { + return "com/fr/design/form/images/developer_preview.png"; + } + + @Override + public String iconPathForLarge() { + return "com/fr/design/form/images/developer_preview24.png"; + } + + @Override + public int previewTypeCode() { + return PREVIEW_TYPE; + } + + + @Override + public Map parametersForPreview() { + Map map = new HashMap(); + map.put(ParameterConstants.OP, "developer_preview"); + return map; + } + + @Override + public boolean accept(JTemplate jTemplate) { + if (jTemplate == null) { + jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + } + return jTemplate instanceof JForm; + } +} diff --git a/designer-form/src/main/java/com/fr/design/preview/FormAdaptivePreview.java b/designer-form/src/main/java/com/fr/design/preview/FormAdaptivePreview.java new file mode 100644 index 000000000..01bd0e126 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/preview/FormAdaptivePreview.java @@ -0,0 +1,54 @@ +package com.fr.design.preview; + +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.fun.impl.AbstractPreviewProvider; +import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.JTemplate; +import com.fr.general.web.ParameterConstants; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by kerry on 2020-04-23 + */ +public class FormAdaptivePreview extends AbstractPreviewProvider { + private static final int PREVIEW_TYPE = 6; + public static final String PREVIEW_OP = "form_adaptive"; + + @Override + public String nameForPopupItem() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_New_Form_Preview"); + } + + @Override + public String iconPathForPopupItem() { + return "com/fr/design/images/buttonicon/runs.png"; + } + + @Override + public String iconPathForLarge() { + return "com/fr/design/images/buttonicon/run24.png"; + } + + @Override + public int previewTypeCode() { + return PREVIEW_TYPE; + } + + + @Override + public Map parametersForPreview() { + Map map = new HashMap(); + map.put(ParameterConstants.OP, PREVIEW_OP); + return map; + } + + @Override + public boolean accept(JTemplate jTemplate) { + if (jTemplate == null) { + jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + } + return jTemplate instanceof JForm; + } +} diff --git a/designer-form/src/main/resources/com/fr/design/form/images/developer_preview.png b/designer-form/src/main/resources/com/fr/design/form/images/developer_preview.png new file mode 100755 index 0000000000000000000000000000000000000000..7d7e064d1cdf48fa3304c490e92817f0c9737633 GIT binary patch literal 542 zcmV+(0^$9MP)g-Xe$z{md1k(f(D@;MD(Z<1<{HpJp`$sf(Jo7C>X&U zM5V~GLLrD64Y7ox5=0t%NYX;%W0e$(sBM$om8`B3NRtZwmtmNhZyx`Q!0)&H=4>3( z^xFDdQqv~Fsi5niZ5RFkLNjKq;F3L;OC!t9Td82{p_2a306WRkzyd4w{{vi&0{uRb zqiT_Fvv6sr#K0S!Q{5u{Pju4xU!7L0z}+Npeuu=>M3HA%lNAkcWw*?}I|aH|3iNeJ z1RoVieKIQp?(Ua~W^_U?3@gjAEutl_4eOQ+bc*z}Iyi8zP`iSmagz(1#t03*;=@+~ z_XZDVde>C1pp>OFgL6KSvo|92wmVtf;YAQkvdI|Ah{0HcZ|)h`U*wq1v$sA$&#paX zs}YT;+@I>ga5h$M!S=5EILv8(GfP`ml>xN(6I@g?%rtwe1LVmOj&C+-TfeakFrFUe za&(G9lczcWL#IOvb0lyWNs=sxVHgaAuk*alPjTV$8UVoY<1?=OAY0wb5G9dh@-^E! z*YV(CjCXB)JU-bnzg2cjPl9P!gIk=r%?bZnVlUs4j7Ju!s`};cEzIYfO_L=#1y8;9 gJuwt-R}>}t6Ak^{5p4;(QUCw|07*qoM6N<$f=1i*UH||9 literal 0 HcmV?d00001 diff --git a/designer-form/src/main/resources/com/fr/design/form/images/developer_preview24.png b/designer-form/src/main/resources/com/fr/design/form/images/developer_preview24.png new file mode 100755 index 0000000000000000000000000000000000000000..fc3d3d34788de6d53a98a5461a896f335b1394e5 GIT binary patch literal 862 zcmV-k1EKthP)2W958P*4ISgx3N1AiM@J*P+IXQckV^10YZa+)X4gK?9c?DCg!J^hGHoSa#}rQ8Ec1 zF>qZ+VaVp{fyWLw#P21MSRG8Dy`Mo&{S3esg$VbR5|}J3)U|dzI!q#3PT(obl3z3c%US)SwWysPeJ#camhHYyje7WyAUXr0nb$u*eD>a z(vGoN1_%}cckxV*A&?$JLideEVH54#y`V`ry(*WTl`08V1hB|`(u84iH-h}cu#C~z z5gmez)Od7S2w{%lYzW6iWT$~k4HRz2S@Bu_3LCa3AS^t>>44a3!iV=-=-5OIh(cWQ zV$nIU;NOmAu(78CIp@zn;^Q-K7(>%|TJ{Vrfhs^Ob@mGeAni6FFJ+a>&gW7Ln)^{u z)q-E)`-KOH=&8fC?2~-Y0X!_N#+TqU;Q_WX&Ge9T6U2O>Z5pX7M}l zxU2@B0*?s~Anj^Ie%dC;L&FwyVZ<_oTV;A!S1N@E07D_hT!{;r86d>sc@QkiLQ`9c zcLR~IDdM~U0Du_n!?rOUj;1CfXt~@e;@G+2Z9NVhNPt$Sg~q%d){vc({em4sry4yD z|86}Z{YMb&M_|~-pu-{qP52@u^e2qQW+W+*3zlXK&6NCYb>!363je`2n=L9e oQ7}eEf4d3w4yhG+yQrzi*+G+mLDp8Y31 zA%W}ga(3T``$IX7D)e&LbsgHA?!VS;8{U7b2QXQtKv`=fj4so$Eg#oBC@(~faX dY-YY&#qh($G@r}j^ADh*44$rjF6*2UngDvpEFb^? literal 0 HcmV?d00001 diff --git a/designer-form/src/main/resources/com/fr/design/form/images/icon_switch.png b/designer-form/src/main/resources/com/fr/design/form/images/icon_switch.png new file mode 100644 index 0000000000000000000000000000000000000000..3730b3b79d0c44ede776f8bb1e3575302ea741b9 GIT binary patch literal 304 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6oZW8(2`y1f!v9fk}`jvc=IysLe>zwH?YHHqekS(BTuc0ROs z);J^JmXyOL%~xV|`2T-i>uvd|JUl!izyCe{ZpY@QR+hG4sM4=_Q@{W zS=IV_m-TTcG&Y@OTXghclkv;3_JN40_212e(-kR1bUgl)78&qol`;+05m>t A`v3p{ literal 0 HcmV?d00001 diff --git a/designer-form/src/main/resources/com/fr/design/form/images/icon_switch_disable.png b/designer-form/src/main/resources/com/fr/design/form/images/icon_switch_disable.png new file mode 100755 index 0000000000000000000000000000000000000000..daee74b513d87662cdf4eeb8bf59268b862eb51c GIT binary patch literal 296 zcmV+@0oVSCP);zykPa?0|z+aG)mYum__73XlRkaIgb2 zI>_5>CP5b>m-+0x&kW@CUmV9rLFtb1+u`J7zUF%##nCF`)iae0a^w6)` z_t)p1WGk~Y#ySxN;xbLsRogxeM9+Ii;9`Bqnez&Ho_8F~%SHqtYL19iJ>B}RzlzThydtl9N?-l upj9-;uK(iz``gT;^C={PAt+5D5bO(KVpuOb$Wvbc00004%P)F8+hA7VG3tTiQxR z#6b~PMXMZkzV*KIan3zl!apAc)o1e7(TfwxRko?^Y6Aldvnv2AQ9ifZi&U>(3T0Lh25mLMrdt~jh(MFP@3M8jWNf+$BBv$rq6_W<03*p_&Z z&q@bm{{|aGK$A%rL@> z*g_-{;Y&pP)pc+UATG(6J=q9fdWi?~RVkIaTj88@GV+}r0r{zvm5-B2JyENbYhDmd z(s5-)$YN00000NkvXX Hu0mjfc literal 0 HcmV?d00001 diff --git a/designer-form/src/main/resources/com/fr/design/form/images/icon_switch_old_ui.png b/designer-form/src/main/resources/com/fr/design/form/images/icon_switch_old_ui.png new file mode 100755 index 0000000000000000000000000000000000000000..08217d41132434f3e03617896800278903046bad GIT binary patch literal 417 zcmV;S0bc%zP)LAb5AH}F0x5F+jGC)J>Pc@;h#mL>NPE)mCFwm0B%P+GC2EfSu{=a)oY4gh{=MpMQ|ob(~M0agea9}FM#uIvR<`u!V%YL zJpr)DFpLzl7^~OCO|^Pg_Y!ydnLLNyMC%=(Pl`n1bHO0BW%j-{uC#MkS^tg~Bvojq z!SWKob9Y_o)pW66(;vtrDr literal 0 HcmV?d00001 diff --git a/designer-form/src/main/resources/com/fr/design/form/images/loading.png b/designer-form/src/main/resources/com/fr/design/form/images/loading.png new file mode 100644 index 0000000000000000000000000000000000000000..d479fb376be6526651ffa41579bd4551f5d44916 GIT binary patch literal 7641 zcmd6MRZtvC6eS@L+}(o)C%C%@hu}^iz~D}B8(f2j4DRkO!3jFRFgSw*A3V5Zd4IdV zTeVVkTRytFySnc^efr!OO?5>qbaHeA1OzN)B{}Wa_WHG~p}u>q%klSfUK=D^X*FpC zgoY%HCre}m1gd0ZIqA>7Z%#lM0fY-Zqchpr>r)sqN{GMdxQPBdRN5`9Zr4B~nI)=- zj2)bw4eHj=kp@QfdRB;6SE}05&ml*nH}f|hlEcScy3+Uo&AJXXHO)puJz?nZNU^bS z>!!Nwj=m<#9YmES#+<+xb%~s8;j=68tGuf$-hcE+SZK)z{~y>dCA6^=gjgnKxc=`Bo3^WzL}ALM1|bu+2}O4?@~-?5dLp{HimmutsJZuYz>3ZI4`x_ zRi5lJ&(f(35m0kBw49*ad{=mi=VXy8(hWWm8ADT!v|nrQvs$o;5((K8Up08#F1Mu{ zM5`~Ec18YpPe@QdOvy6bSuRzzWK68@&&P7cU23n#K>bQrTCb^SulI|*?*sm1iR3x7 zNlgf}{q{(3TJ6jD@swRJ2PVGhbI@K}TNAQZqkUhXNg~5RVnH@z-1Df@YLkmq04-dhTex{5I<|E_uj&`!t zF~3tC9GX%_;;^eDJYuN)*R7j-jK!iCuw|`p=hs4cHh?^JfQK64bfMM7nCs6bgv%#C zSju>cqR7?q6qD^^6Xs>uSL@Me`EKL+p^qp%o`bd(si9=ZIBABs@1+Q4dsJ&Ug~8@i z%rGaG7!jv|U$bVh*}6QB1wsTd*F)~vMrHptA7Y#0Aou2U8e9o7p?igSRUK|ulM#3& z77+YN2e^!?Lrm18$~C;Y?@4KZBK=1E9B!)eWL@hqo7(HUnQf6nxxL|;M*dyw7iG7y zRtU%4*nDUHY8MZ!^$5q|@m6Oz%D2+k%|g*3Zpm02+xWk15#_N#GE^kfZ!)-?uwrYd zb>OEBL%X(cSjTcbf)uv*s%; zX_IK$lvR~CF_FnUZ<8&EjJARsf;gZ5zSQ_tQ_K*2_@!vIU44*>20g>l zFea%2&VwV{t*eyR4gYTqa?Q4j1n}Egt+s~qKUgyh7G+i^&X{2eP!*vFsZSCf32Dw* zwzP;dzmsuGb1R|0;49VQ9l_NZ(ZbLoPucO1CdYpt+D#`_FkN+IZK;F+dnQ0cOO^`4 z%h%l34{YRPc<=6B==d_&+O&8quD<|-6t3)38@w;z{}G9#B!xHDk>R%iSY2qDcx<(a z6|GMlTyc8N-2~ox%dX?T0$vDRvWE;6x_@2-v@d~UV$Igs*^>qX6x4_IE?{jt?Uok} zPX9UrYyD@s_99f#0Sx}zRbY8Jbikj)pm~7gu2By3T^AUh zNlmMz>8e(muJp`zl{pV{GJ`YDw#{kadxU=SjZX}?jIWbEkEQcOPi9Uz0Yv4AtfuFV zg4r{9{w*3SIK(UB3t@)-BsjABW<>tMQEQ(gL5qU=HTnrdO(=Dm_Fh3Cl2)pK`W-e% z={?EoWqC9}vuyE6BN2dpq(Yu_p(YHk2R3ZM#lPCcbye+Js4H99HVB$aHIRfuT!7M%63U>3^w_2 z0Ln;>Jc{RjU^Gls>xo|ak6f<_rG65U<(wr8M44ViEyM{_p@U~)3Wz@3xz!(hwA9!9 zi_FuE{p7{viRgo2oOE1PncY&QaK~9~yqn$lE#`5@dSI^-Hbnic!$@RLv9!FwY&F&N)(TLPSmW;m*A@THf95Nsgq8q~AsTFUT84f>E7LJ+aVDt8S_P;1OTxt=9JR_fWOg^Q(>L73I|1Ij8RD`UZI{B+7uQ z_%jFZdv~AE8=6)Lah?kF%aQ4L>y3Xe719&H(QFLDM5b{;zQ7i{z%DM_)=YjusIwR$ z_53BL)Z)`j4#kJSrjFTXYquCNqM*9GwoVUt!N8v%;y{r_06WfQRp+{7r)RhC$zX`@ zQ^HHMMU_+ZxXJJJ#B@dlYswRhm2Ebh=Gf5u7WW(~8_#d3LwNbI_32V^q4V+I>n)^;8>qR@h2LCsCCknzHa z7piCIU}n-p6-B_V^2EvxhheM+Jsf;rF;un|J??2NnSNj$Kf{Ek$=2`d7YvWYs$`>Zb@j=>W(6WHBNMJj`K6I*UEsD*aphS!e`FGH^ws*vwI z0Q{{oI-m`W6i9o!!~Vws-769RBkhe6-ZrVIb>z(U4HL&Oy|@*5XAI{-{flWL8=8MN zt7E!O(;T%C@YU@^H|uw)6piLA;nCZWa~=<*Gz(aqJj+!ulzi5vlxapn_gKb(Ba*ms z?XR8U<`k%Zd#~iQi3NOd94kYWhvCF4XJOL71em~@#k)Fb@k1_+Um3ch5e?&H8P;b3 zhpTQs&ornTb<=@4^HA3!^i4K$>$8Ga`mYQCV~s~_3t9EVeZqbAx3-rRYZdGmK#_Dl zvPC=s&6;yA^JR)}XHTl(qI2tsB+C~q*lxF(tUyZxj%&4zZx>I5om9Y1@L32ub00Zx zU0{LYlew`{b$jC{p)Y#z-WIF5I9)P@qF=*%bjsS#$*UWimsqH4%uhN*Fk+K+4f8c^ zb-f79zC!S4a%j#7pO=((Pz*%KsU+F(ySQsNT0bzaJPd4$SMwcX1zc|U?a4(Mc zCXEW%d|Jqj9H93(z}G3qnTq5rQkC-RprAg&oj+fI)?AIq_r@fuHIDZ66%OQPL5=Qn zOe~|*&1*T)qE2+pyJsG2mg<24>IIyCR%R@gbuj|hxmJg`7qDktoxiR9j2GX0oAkC$ zH@}G0^8$>;KR~-HPEzC4!|yDI{8hO?y?S6LC@052^FbszL|el5m;kg5si;-L2+a5Y z+xaz~wp33@Ubliaad-}VS$NmxzzD&C-L@QU*e}fs6@`Flz0(C3Ap@kk3kG2}#>fv-ff1S3nEU257S7*%0O-$T( zguf_W_v*wF)CO3zxxBB=n`^WlcwC;e=DQTAbXBAu%ue)hPQ5i^uIa+Q&q}zCtvHkY z+8I)m)jP-3xmS5K##XJR%7lM?wD13xVgvs8Qd*LFN`2ByDv3tO5c=Q+O64-$KZ%m4 zZ_bho+-&3OYfE1}CH%8KB2yM6H74os35chvVMRAbfogaY?^%+mcIaBjo&%syy0Thb zDPD0G|Eha?K->z5ua&?i6YQ+8wuKWO!K*X7Cy07OIo*V9R(fHuGDC%&fAyxWso8`_ z-2{1XcHG|3NR#>E@K@GMm6rVutvE$$rBl|Pogj6b4)NfH*vG%S?f6Ha`qgUhcCeoe zJq(Mh|57@&;*HJo#MZMU0p@p-jV1c=IKbqz4Erd2Nkxr%Ufc|aIymjLS@NDzgo8}) zC4Yk`D~sOe~t#9U#wi5cqiH8vYqobx1#Gq80jQDq=Q&w3fZ&o$+%3dv29&M2JkF%bHqCkWH3Et%|Qn;J}ZjGd&-~^ zg&Cs;xz=o%AeGplY!XKVYNq;uM_LG5Y4(HUwio$U>r^lnLm4?*ilYw_GHO)()P*tA$SKyAFAO>2 z!^HCI1)VfG$bC4Xo1%CbVo@TmVTN$m|LdNYB;c4Ls~34AIL95ri-jnP=CmTWCTG9; zQJhIdjEdzAO9O4*daRwdbbFg@x8$#D<4D5EB=wRq*M-6x1Lif7YHHI`Uc65^zRr9rbc6R7*Zl|8Ukc<&s(?-g1f3~|# zIGk2b2~SM^YsUh=*!D8;#N8EpwEuXFz2mD@D+TXn)-x1R-G(|C9z!^A9s~Nq{{&&b z+jJCK3;O{^jAo0*m3EY&;p4ulaZr#-ZH0a2h5eW~yTl0otu-KM`YD*aDpEP+|D;4n z87mc-x)1Ht&27TorFIAoO7&S;W17LSI>8q=e+hGX4^R5?JoEZrF6sR(de)8NKQg*P za};nIYkGWq3eyQ<_F1tdc|+gTnEKoi8seLeJcRR13)b$Kks8J3OOi@K<%?i0szv@x zez-l7!Fc-N=AK++&9(1jY43{DO({EhPISsrXiC#{S`!KF=Vs`IuANMU-|m@N$@HJ2 zhxA;%Kk9(aCBTn81H1Rx9Jdb=2~lxX9kYRt^;)0qfw8f%oAp5lS^P-M5M{k#p)&5P zEsCl~+JR5k8beYRvIRai~vEGmXjaw*m7ii4}IUGf)(30#p2bU5uI+ojc!>) zsQRm!&ez%{kKvI=y^kw&@F?<^ey%fCnTTUD67T8(v+|WYs8q-qoriq%Ml!OE7=$)O zw|RU-bVRj?8x`R42-Y_}E?o*mQ6sU^iH%Ove!5MQp=X|kIUR0U{h4&OuYRVzyqSOC zubIywS#;Fj;_QX#xUWpEJR{weaF|s!n=e%^=m(|U+lqc>L&FRB^NDpe3E_8Puxxso z{I~I=YOzLFnLHEUJ9cNsJGm_oJG51)&#SD|A;{6bz_9e5lrJ_A?YzJ>D45{8c2psE ziLB}p74*CFRu6R;hOR{+eosW(Y-7gOgK*i$AXJ*w^Y_Av_n_70W7cRm%Tc%UZmm2x z*k52x_VEE*H-oV^(E(4OKt?sXC_kzi{X#9SoEF2_=RN6KgPKC$^SFwOZ)_0`o(+ml zN7d?MCdj2cU+c?Ea_5etwI0m)j2OS92=W_b14iTlCWHIEKXoa zRYPMZwg|A7cWHN}+af>%VoJ3y@NJgAwa~Sk(G=6bdUfVC>8~D`v!O z=u3wSbHGo6zZV)&wbK=vxPE+{8@4A{w-r>ZbP5D>p?4bsKv%H_J4f5V`P$(~KFHg> zoj^0+F}GJuhQ3^C73^oTr2SADg~>G1+b|W?(8Tk+)U6)vbKWIm%Bu695KM$=Qm6dw z)=XnG?V%K^j4Luh2vt5%*Z75bD?Coaux3wMt1l?<8GG2p5Xu)1gz26x3B03#$Mh=w zGcg?E)hwD_B76XgZdXCa&9=o=}bY5G3R zUYszXUde}B7PGO}w7E(!K(h2C)fQW>$Ej*MS6GV8K{Vrhf>5#G*+8mP#FtI1EKFnl zHmk+pFZA{Mf*cirdO$;LwGFNv{^ff%pFGOe$&gmFI9I+#UWRr@#w>}@vbn9_6z@{5sZ+F zEi0k+@;2^}f>_@r1#3LYw8}o}jP*;@w0v^=1@1u^u3f49vaO|+>hSr7J4+_C=G<3p zwOeIzSL1WFRyegHOKaM5?x1S`VGG7PSr5v{Zh626I7@^OUAzKV{k@!qx+&_vop{Z5 z7w^%gV~#*@kN(65O9h~vY{|;jfr~w5>&-<>*mE*FU4Sf+soqo<@?68~jE7$se3 z!ee^3b4@q&KUR6aGdd%&+L?=O>AW0|0X5WBf@N}Sb3b31!R3~_7dDzcbX9hK8N3wx zFT|RPsJHiI&}f);oky5NN#w+(aBVF)#uY99zRafA4KF>3>_!F_Ps>fj2Np-PTR1(c z@>0I&-*F5oSt5==uj(bIhkZZv+U5&Fj?WyrP@FS&NDjSsEIoX*VxCjWh}%VPrXW>z zk^B@CfGD$3>0e1Wz!MeL#LDO2Xjd0Q_Lo5@b!WLFgK!QpT+UGgGY9ADK+h%A!z`Xx zuV&D+vfm{lozHaw*03Vwg!+uAu?jKOs%uef%h#n-Az}NQ|IW=QIbDUc@Zi!pQZRm^ zmGddMzGl(Lu$c*&P_B<-Cl3|xHt_#X?P>MT+&3G#pkx~Lzc6y(H`Dv_)|-1b8>oAh z*9P^cj3B+T`C1W6(Qh&qt^&%*(2XxIv)E_D>3$;Pw$fHNmgIv{qe>)BExRa)z@&0r zehn>)u?uymUC-~3Su6R~dot$cG!D}JFeJU@8l?13^~HMxY*EHpON7iD-N8Mfbu_qvczDZ*51!e;sra{N6&V$q+PZ@}*3K!sYuyuP3*{io5}4n4#STHgWN_ zWvLqS{Rg>AWmL-{`Ussx4m`tIWWxu4;JmNqXMN-@@h-tZ|BgM+8f{ZI)rgbpC|S0T zc;0#F--szCm{X^Tiw$&^h zwd#V-x^j=sITflT= 0 && e.getY() < height) { + Point convertPoint = new Point(width, 0); + SwingUtilities.convertPointToScreen(convertPoint, grid); + showToolTip(grid, e, actualWidth + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Px"), convertPoint); + return; + } else { + hideToolTip(); + } + if (Math.abs(e.getY() - height) < 5 && e.getX() >= 0 && e.getX() < width) { + Point convertPoint = new Point(0, height); + SwingUtilities.convertPointToScreen(convertPoint, grid); + showToolTip(grid, e, actualHeight + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Px"), convertPoint); + return; + } else { + hideToolTip(); + } + } + + private void showToolTip(Grid grid, MouseEvent evt, String text, Point tipLocation) { + if (tipWindow == null) { + tipWindow = new JWindow(); + + + tip = grid.createToolTip(); + tip.setBorder(BorderFactory.createEmptyBorder()); + tipWindow.getContentPane().add(tip, BorderLayout.CENTER); + } + tip.setTipText(text); + tip.setForeground(Color.decode("#88ACC6")); + tipWindow.setLocation(tipLocation.x, tipLocation.y); + tipWindow.pack(); + tipWindow.setVisible(true); + } + + private void hideToolTip() { + if (tipWindow != null) { + tipWindow.setVisible(false); + } + } + + @Override + public void mouseClicked(MouseEvent e) { + + } + + @Override + public void mousePressed(MouseEvent e) { + + } + + @Override + public void mouseReleased(MouseEvent e) { + + } + + @Override + public void mouseEntered(MouseEvent e) { + + } + + @Override + public void mouseExited(MouseEvent e) { + hideToolTip(); + } + + @Override + public void mouseWheelMoved(MouseWheelEvent e) { + hideToolTip(); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/fit/grid/ElementCasePaneUtil.java b/designer-realize/src/main/java/com/fr/design/fit/grid/ElementCasePaneUtil.java new file mode 100644 index 000000000..1078250c6 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/fit/grid/ElementCasePaneUtil.java @@ -0,0 +1,186 @@ +package com.fr.design.fit.grid; + +import com.fr.base.vcs.DesignerMode; +import com.fr.design.actions.cell.CleanAuthorityAction; +import com.fr.design.actions.columnrow.CancelColumnAction; +import com.fr.design.actions.columnrow.CancelRowAction; +import com.fr.design.actions.columnrow.ColumnHideAction; +import com.fr.design.actions.columnrow.ColumnWidthAction; +import com.fr.design.actions.columnrow.DeleteColumnAction; +import com.fr.design.actions.columnrow.DeleteRowAction; +import com.fr.design.actions.columnrow.FootColumnAction; +import com.fr.design.actions.columnrow.FootRowAction; +import com.fr.design.actions.columnrow.HeadColumnAction; +import com.fr.design.actions.columnrow.HeadRowAction; +import com.fr.design.actions.columnrow.InsertColumnAction; +import com.fr.design.actions.columnrow.InsertRowAction; +import com.fr.design.actions.columnrow.ResetColumnHideAction; +import com.fr.design.actions.columnrow.ResetRowHideAction; +import com.fr.design.actions.columnrow.RowHeightAction; +import com.fr.design.actions.columnrow.RowHideAction; +import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.grid.GridUtils; +import com.fr.grid.selection.CellSelection; +import com.fr.page.ReportPageAttrProvider; +import com.fr.report.elementcase.ElementCase; +import com.fr.stable.ColumnRow; + +import javax.swing.JPopupMenu; +import java.awt.event.MouseEvent; + +/** + * Created by kerry on 2020-04-28 + */ +public class ElementCasePaneUtil { + public static UIPopupMenu createColumnPopupMenu(ElementCasePane reportPane, MouseEvent evt, int selectedColumn) { + UIPopupMenu popupMenu = new UIPopupMenu(); + + if (DesignerMode.isAuthorityEditing()) { + popupMenu.add(new CleanAuthorityAction(reportPane).createMenuItem()); + return popupMenu; + } + + InsertColumnAction insertColumnAction = new InsertColumnAction(reportPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Insert_Column")); + + DeleteColumnAction deleteColumnAction = new DeleteColumnAction(reportPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Delete_Column")); + + ColumnWidthAction columnWidthAction = new ColumnWidthAction(reportPane, selectedColumn); + + ColumnHideAction columnHideAction = new ColumnHideAction(reportPane, selectedColumn); + + ResetColumnHideAction resetRowHideAction = new ResetColumnHideAction(reportPane, selectedColumn); + popupMenu.add(insertColumnAction.createMenuItem()); + popupMenu.add(deleteColumnAction.createMenuItem()); + popupMenu.addSeparator(); + popupMenu.add(columnWidthAction.createMenuItem()); + + CellSelection cs = (CellSelection) reportPane.getSelection(); + addColumnMenu(reportPane, popupMenu, evt, cs.getColumn(), cs.getColumn() + cs.getColumnSpan() - 1); + popupMenu.add(columnHideAction.createMenuItem()); + popupMenu.add(resetRowHideAction.createMenuItem()); + + return popupMenu; + } + + private static void addColumnMenu(ElementCasePane reportPane, UIPopupMenu popupMenu, MouseEvent evt, int selectedColumnsFrom, int selectedColumnsTo) { + HeadColumnAction headcolumnAction = new HeadColumnAction(reportPane); + FootColumnAction footcolumnAction = new FootColumnAction(reportPane); + + ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evt.getX(), evt.getY(), reportPane.getResolution()); + ElementCase elementCase = reportPane.getEditingElementCase(); + boolean cancel = false; + ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr(); + + if (reportPageAttr != null) { + popupMenu.addSeparator(); + popupMenu.add(headcolumnAction.createMenuItem()); + popupMenu.add(footcolumnAction.createMenuItem()); + int from = reportPageAttr.getRepeatHeaderColumnFrom(); + int to = reportPageAttr.getRepeatHeaderColumnTo(); + int from2 = reportPageAttr.getRepeatFooterColumnFrom(); + int to2 = reportPageAttr.getRepeatFooterColumnTo(); + int column = selectedCellPoint.getColumn(); + + if (column >= selectedColumnsFrom && column <= selectedColumnsTo) { + cancel = isCancel(elementCase, selectedColumnsFrom, selectedColumnsTo, from, to, from2, to2); + } else { + + if (elementCase.getReportPageAttr() != null) { + + if (column == from || column == to || column == from2 || column == to2) { + cancel = true; + } + } + } + if (cancel) { + CancelColumnAction cancelAction = new CancelColumnAction(reportPane); + popupMenu.add(cancelAction.createMenuItem()); + } + } + } + + private static boolean isCancel(ElementCase report, int selectedColumnsFrom, int selectedColumnsTo, int from, int to, int from2, int to2) { + + boolean cancel = false; + + if (report.getReportPageAttr() != null) { + + if (from == selectedColumnsFrom && to == selectedColumnsTo) { + cancel = true; + } + + if (from2 == selectedColumnsFrom && to2 == selectedColumnsTo) { + cancel = true; + } + } + return cancel; + } + + public static UIPopupMenu createRowPopupMenu(ElementCasePane reportPane, MouseEvent evt, int selectedRows) { + UIPopupMenu popupMenu = new UIPopupMenu(); + if (DesignerMode.isAuthorityEditing()) { + popupMenu.add(new CleanAuthorityAction(reportPane).createMenuItem()); + return popupMenu; + } + + InsertRowAction insertRowAction = new InsertRowAction(reportPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Insert_Row")); + + DeleteRowAction deleteRowAction = new DeleteRowAction(reportPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Delete_Row")); + + RowHeightAction rowHeightAction = new RowHeightAction(reportPane, selectedRows); + + RowHideAction rowHideAction = new RowHideAction(reportPane, selectedRows); + + ResetRowHideAction resetRowHideAction = new ResetRowHideAction(reportPane, selectedRows); + popupMenu.add(insertRowAction.createMenuItem()); + popupMenu.add(deleteRowAction.createMenuItem()); + popupMenu.addSeparator(); + popupMenu.add(rowHeightAction.createMenuItem()); + CellSelection cs = (CellSelection) reportPane.getSelection(); + addRowMenu(reportPane, popupMenu, evt, cs.getRow(), cs.getRow() + cs.getRowSpan() - 1); + popupMenu.add(rowHideAction.createMenuItem()); + popupMenu.add(resetRowHideAction.createMenuItem()); + return popupMenu; + } + + private static void addRowMenu(ElementCasePane reportPane, JPopupMenu popupMenu, MouseEvent evt, int selectedRowsFrom, int selectedRowsTo) { + HeadRowAction headrowAction = new HeadRowAction(reportPane); + FootRowAction footrowAction = new FootRowAction(reportPane); + + ElementCase elementCase = reportPane.getEditingElementCase(); + boolean cancel = false; + ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evt.getX(), evt.getY(), reportPane.getResolution()); + ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr(); + ElementCase report = reportPane.getEditingElementCase(); + if (reportPageAttr != null) { + popupMenu.addSeparator(); + popupMenu.add(headrowAction.createMenuItem()); + popupMenu.add(footrowAction.createMenuItem()); + int from = report.getReportPageAttr().getRepeatHeaderRowFrom(); + int to = report.getReportPageAttr().getRepeatHeaderRowTo(); + int from2 = report.getReportPageAttr().getRepeatFooterRowFrom(); + int to2 = report.getReportPageAttr().getRepeatFooterRowTo(); + + if (selectedCellPoint.getRow() >= selectedRowsFrom && selectedCellPoint.getRow() <= selectedRowsTo) { + + cancel = isCancel(report, selectedRowsFrom, selectedRowsTo, from, to, from2, to2); + + } else { + + int row = selectedCellPoint.getRow(); + if (report.getReportPageAttr() != null) { + if (row == from || row == to || row == from2 || row == to2) { + cancel = true; + } + } + } + + if (cancel) { + CancelRowAction cancelAction = new CancelRowAction(reportPane); + popupMenu.add(cancelAction.createMenuItem()); + } + } + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/fit/grid/GridHeaderWithBoundMouseHandler.java b/designer-realize/src/main/java/com/fr/design/fit/grid/GridHeaderWithBoundMouseHandler.java new file mode 100644 index 000000000..bd3c73846 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/fit/grid/GridHeaderWithBoundMouseHandler.java @@ -0,0 +1,70 @@ +package com.fr.design.fit.grid; + +import com.fr.base.DynamicUnitList; +import com.fr.design.fit.DesignerUIModeConfig; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.grid.GridHeader; +import com.fr.grid.AbstractGridHeaderMouseHandler; +import com.fr.report.elementcase.ElementCase; +import com.fr.report.elementcase.TemplateElementCase; + +import java.awt.event.MouseEvent; + +public abstract class GridHeaderWithBoundMouseHandler extends AbstractGridHeaderMouseHandler{ + protected static final int FUZZY_EDGE = 10; + private int limit; + + public GridHeaderWithBoundMouseHandler(GridHeader gHeader, int limit) { + super(gHeader); + this.limit = limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } + + public int getLimit() { + return limit; + } + + public int getDragIndex(MouseEvent evt) { + ElementCase report = this.getEditingElementCase(); + DynamicUnitList sizeList = getSizeList(report); + + int scrollValue = getScrollValue(this.getElementCasePane()); + int scrollExtent = getScrollExtent(this.getElementCasePane()); + int endValue = scrollValue + scrollExtent + 1; + + int beginValue = getBeginValue(this.getElementCasePane()); + + double tmpSize1 = 0; + double tmpSize2; + double tmpIncreaseSize = 0; + + int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + + for (int index = beginValue; index < endValue; index++) { + if (index == 0) { + index = scrollValue; + } + + tmpSize1 += tmpIncreaseSize; + tmpIncreaseSize = sizeList.get(index).toPixD(resolution); + tmpSize2 = tmpSize1 + Math.max(1, tmpIncreaseSize); + if (isOnSeparatorLineIncludeZero(evt, tmpSize2, tmpIncreaseSize) || isOnNormalSeparatorLine(evt, tmpSize2)) { + return index; + } + } + return -1; + } + + + public ElementCasePane getElementCasePane() { + return this.gHeader.getElementCasePane(); + } + + public TemplateElementCase getEditingElementCase() { + return this.getElementCasePane().getEditingElementCase(); + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitColumnMouseHandler.java b/designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitColumnMouseHandler.java new file mode 100644 index 000000000..28185bc38 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitColumnMouseHandler.java @@ -0,0 +1,194 @@ +package com.fr.design.fit.grid; + +import com.fr.base.DynamicUnitList; +import com.fr.design.fit.DesignerUIModeConfig; +import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.grid.GridColumn; +import com.fr.grid.GridHeader; +import com.fr.grid.GridUtils; +import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.Selection; +import com.fr.report.ReportHelper; +import com.fr.report.elementcase.ElementCase; +import com.fr.stable.ColumnRow; +import com.fr.stable.unit.FU; +import com.fr.stable.unit.UNIT; + +import javax.swing.SwingUtilities; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; +import java.awt.event.MouseEvent; + +/** + * peter:处理对GridColumn的Mouse事件. + */ +public class GridLimitColumnMouseHandler extends GridHeaderWithBoundMouseHandler { + + + public GridLimitColumnMouseHandler(GridColumn gridColumn, int limit) { + super(gridColumn, limit); + this.resolution = gridColumn.getResolution(); + } + + @Override + protected void resetSelectionByRightButton(ColumnRow selectedCellPoint, Selection cs, ElementCasePane ePane) { + int[] selectedColumns = cs.getSelectedColumns(); + if (selectedColumns.length == 0 + || selectedCellPoint.getColumn() < selectedColumns[0] + || selectedCellPoint.getColumn() > selectedColumns[selectedColumns.length - 1]) { + resetGridSelectionBySelect(selectedCellPoint.getColumn(), ePane); + } + } + + + protected int doChooseFrom() { + return CellSelection.CHOOSE_COLUMN; + } + + @Override + protected Rectangle resetSelectedBoundsByShift(Rectangle editRectangle, ColumnRow selectedCellPoint, ElementCasePane reportPane) { + int tempOldSelectedCellX = editRectangle.x;// editRectangle.x; + + // adjust them to got the correct selected bounds. + if (selectedCellPoint.getColumn() >= editRectangle.x) { + selectedCellPoint = ColumnRow.valueOf(selectedCellPoint.getColumn() + 1, selectedCellPoint.getRow()); + } else { + tempOldSelectedCellX++; + } + + int lastRow = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane).getRow(); + return new Rectangle(Math.min(tempOldSelectedCellX, selectedCellPoint.getColumn()), 0, Math.max(editRectangle.width, Math.abs(tempOldSelectedCellX + - selectedCellPoint.getColumn())), lastRow); + } + + @Override + protected int[] getGridSelectionIndices(CellSelection cs) { + return cs.getSelectedColumns(); + } + + @Override + protected int getScrollValue(ElementCasePane casePane) { + return casePane.getGrid().getHorizontalValue(); + } + + @Override + protected int getScrollExtent(ElementCasePane casePane) { + return casePane.getGrid().getHorizontalExtent(); + } + + @Override + protected int getBeginValue(ElementCasePane casePane) { + return casePane.getGrid().getHorizontalBeginValue(); + } + + @Override + protected int getColumnOrRowByGridHeader(ColumnRow selectedCellPoint) { + return selectedCellPoint.getColumn(); + } + + + /** + * Checks whether is on zero separator line. + */ + @Override + protected boolean isOnSeparatorLineIncludeZero(MouseEvent evt, double tmpWidth2, double tmpIncreaseWidth) { + return tmpIncreaseWidth <= 1 && (evt.getX() >= tmpWidth2 + 2 && (evt.getX() <= tmpWidth2 + SEPARATOR_GAP)); + } + + @Override + protected boolean between(MouseEvent evt, double from, double to) { + return evt.getX() > from && evt.getX() <= to; + } + + /** + * Checks whether is on normal separator line. + */ + @Override + protected boolean isOnNormalSeparatorLine(MouseEvent evt, double tmpWidth2) { + return (evt.getX() >= tmpWidth2 - 2) && (evt.getX() <= tmpWidth2 + 2); + } + + @Override + protected int evtOffset(MouseEvent evt, int offset) { + return evt.getX() - offset; + } + + @Override + protected DynamicUnitList getSizeList(ElementCase elementCase) { + return ReportHelper.getColumnWidthList(elementCase); + } + + @Override + protected String methodName() { + return "setColumnWidth"; + } + + @Override + protected String getSelectedHeaderTooltip(int selectedColumnCount) { + return selectedColumnCount + "C"; + } + + @Override + protected Point getTipLocationByMouseEvent(MouseEvent evt, GridHeader gHeader, Dimension tipPreferredSize) { + Point convertPoint = new Point(evt.getX(), 0); + SwingUtilities.convertPointToScreen(convertPoint, gHeader); + + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + convertPoint.x = Math.max(0, Math.min(convertPoint.x - tipPreferredSize.width / 2, screenSize.width - tipPreferredSize.width)); + convertPoint.y = convertPoint.y - tipPreferredSize.height - 2; + + return convertPoint; + } + + @Override + protected void resetGridSelectionBySelect(int column, ElementCasePane ePane) { + int lastRow = GridUtils.getAdjustLastColumnRowOfReportPane(ePane).getRow(); + CellSelection cellSelection = new CellSelection(column, 0, 1, lastRow); + cellSelection.setSelectedType(CellSelection.CHOOSE_COLUMN); + ePane.setSelection(cellSelection); + } + + @Override + protected String nameOfMoveCursorGIF() { + return "cursor_hmove"; + } + + @Override + protected String nameOfSelectCursorGIF() { + return "cursor_hselect"; + } + + @Override + protected String nameOfSplitCursorGIF() { + return "cursor_hsplit"; + } + + @Override + protected UIPopupMenu createPopupMenu(ElementCasePane reportPane, + MouseEvent evt, int columnIndex) { + return ElementCasePaneUtil.createColumnPopupMenu(reportPane, evt, columnIndex); + } + + @Override + protected void resetGridSelectionByDrag(CellSelection gridSelection, ElementCasePane reportPane, + int startMultiSelectIndex, int endMultiSelectIndex) { + int lastRow = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane).getRow(); + gridSelection.setLastRectangleBounds(Math.min(endMultiSelectIndex, startMultiSelectIndex), 0, Math.abs(startMultiSelectIndex - endMultiSelectIndex) + 1, lastRow); + } + + @Override + public void mouseReleased(MouseEvent e) { + super.mouseReleased(e); + int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + int dragIndex = getDragIndex(e); + if (Math.abs(e.getX() - getLimit()) < FUZZY_EDGE && dragIndex >= 0) { + UNIT oldValue = this.getEditingElementCase().getColumnWidth(dragIndex); + this.getEditingElementCase().setColumnWidth(dragIndex, FU.valueOfPix(oldValue.toPixI(resolution) + getLimit() - e.getX(), resolution)); + } + this.getElementCasePane().repaint(); + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitRowMouseHandler.java b/designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitRowMouseHandler.java new file mode 100644 index 000000000..ac4a70eab --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitRowMouseHandler.java @@ -0,0 +1,190 @@ +package com.fr.design.fit.grid; + +import com.fr.base.DynamicUnitList; +import com.fr.design.fit.DesignerUIModeConfig; +import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.grid.GridHeader; +import com.fr.grid.GridRow; +import com.fr.grid.GridUtils; +import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.Selection; +import com.fr.report.ReportHelper; +import com.fr.report.elementcase.ElementCase; +import com.fr.stable.ColumnRow; +import com.fr.stable.unit.FU; +import com.fr.stable.unit.UNIT; + +import javax.swing.SwingUtilities; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.MouseEvent; + +/** + * peter:处理对GridRow的Mouse事件. + */ +public class GridLimitRowMouseHandler extends GridHeaderWithBoundMouseHandler { + + public GridLimitRowMouseHandler(GridRow gridRow, int limit) { + super(gridRow, limit); + } + + @Override + protected void resetSelectionByRightButton(ColumnRow selectedCellPoint, Selection cs, ElementCasePane ePane) { + int[] selectedRows = cs.getSelectedRows(); + if (selectedRows.length == 0 + || selectedCellPoint.getRow() < selectedRows[0] + || selectedCellPoint.getRow() > selectedRows[selectedRows.length - 1]) { + resetGridSelectionBySelect(selectedCellPoint.getRow(), ePane); + } + } + + + protected int doChooseFrom() { + return CellSelection.CHOOSE_ROW; + } + + @Override + protected int getScrollValue(ElementCasePane casePane) { + return casePane.getGrid().getVerticalValue(); + } + + @Override + protected int getScrollExtent(ElementCasePane casePane) { + return casePane.getGrid().getVerticalExtent(); + } + + @Override + protected int getBeginValue(ElementCasePane casePane) { + return casePane.getGrid().getVerticalBeginValue(); + } + + @Override + protected Rectangle resetSelectedBoundsByShift(Rectangle editRectangle, ColumnRow selectedCellPoint, ElementCasePane reportPane) { + int tempOldSelectedCellY = editRectangle.y;// editRectangle.x; + + // ajust them to got the correct selected bounds. + if (selectedCellPoint.getRow() >= editRectangle.y) { + selectedCellPoint = ColumnRow.valueOf(selectedCellPoint.getColumn(), selectedCellPoint.getRow() + 1); + } else { + tempOldSelectedCellY++; + } + + int lastColumn = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane).getColumn(); + return new Rectangle(0, Math.min(tempOldSelectedCellY, selectedCellPoint.getRow()), + lastColumn, Math.max(editRectangle.height, Math.abs(tempOldSelectedCellY - selectedCellPoint.getRow()))); + } + + @Override + protected int[] getGridSelectionIndices(CellSelection cs) { + return cs.getSelectedRows(); + } + + @Override + protected int getColumnOrRowByGridHeader(ColumnRow selectedCellPoint) { + return selectedCellPoint.getRow(); + } + + + @Override + protected void resetGridSelectionBySelect(int row, ElementCasePane ePane) { + int lastColumn = GridUtils.getAdjustLastColumnRowOfReportPane(ePane).getColumn(); + CellSelection cellSelection = new CellSelection(0, row, lastColumn, 1); + cellSelection.setSelectedType(CellSelection.CHOOSE_ROW); + ePane.setSelection(cellSelection); + } + + /** + * Checks whether is on zero separator line. + */ + @Override + protected boolean isOnSeparatorLineIncludeZero(MouseEvent evt, double tmpHeight2, double tmpIncreaseHeight) { + return tmpIncreaseHeight <= 1 && (evt.getY() >= tmpHeight2 + 2 && evt.getY() <= tmpHeight2 + SEPARATOR_GAP); + } + + @Override + protected boolean between(MouseEvent evt, double from, double to) { + return evt.getY() > from && evt.getY() <= to; + } + + @Override + protected DynamicUnitList getSizeList(ElementCase elementCase) { + return ReportHelper.getRowHeightList(elementCase); + } + + @Override + protected String methodName() { + return "setRowHeight"; + } + + /** + * Checks whether is on normal separator line. + */ + @Override + protected boolean isOnNormalSeparatorLine(MouseEvent evt, double tmpHeight2) { + return (evt.getY() >= tmpHeight2 - 2) && (evt.getY() <= tmpHeight2 + 2); + } + + @Override + protected int evtOffset(MouseEvent evt, int offset) { + return evt.getY() - offset; + } + + @Override + protected String getSelectedHeaderTooltip(int rowSelectedCount) { + return rowSelectedCount + "R"; + } + + @Override + protected Point getTipLocationByMouseEvent(MouseEvent evt, GridHeader gHeader, Dimension tipPreferredSize) { + Point convertPoint = new Point(0, evt.getY()); + SwingUtilities.convertPointToScreen(convertPoint, gHeader); + + convertPoint.x = convertPoint.x + gHeader.getSize().width + 2; + convertPoint.y = convertPoint.y - tipPreferredSize.height / 2; + + return convertPoint; + } + + @Override + protected String nameOfMoveCursorGIF() { + return "cursor_vmove"; + } + + @Override + protected String nameOfSelectCursorGIF() { + return "cursor_vselect"; + } + + @Override + protected String nameOfSplitCursorGIF() { + return "cursor_vsplit"; + } + + @Override + protected UIPopupMenu createPopupMenu(ElementCasePane reportPane, + MouseEvent evt, int rowIndex) { + return ElementCasePaneUtil.createRowPopupMenu(reportPane, evt, rowIndex); + } + + @Override + protected void resetGridSelectionByDrag(CellSelection gridSelection, ElementCasePane reportPane, + int startMultiSelectIndex, int endMultiSelectIndex) { + int lastColumn = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane).getColumn(); + gridSelection.setLastRectangleBounds(0, Math.min(endMultiSelectIndex, startMultiSelectIndex), lastColumn, Math.abs(startMultiSelectIndex - endMultiSelectIndex) + 1); + + } + + @Override + public void mouseReleased(MouseEvent e) { + super.mouseReleased(e); + int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + int dragIndex = getDragIndex(e); + if (Math.abs(e.getY() - getLimit()) < FUZZY_EDGE && dragIndex >= 0) { + UNIT oldValue = this.getEditingElementCase().getRowHeight(dragIndex); + this.getEditingElementCase().setRowHeight(dragIndex, FU.valueOfPix(oldValue.toPixI(resolution) + getLimit() - e.getY(), resolution)); + } + this.getElementCasePane().repaint(); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/fit/grid/NewFormDesignerGridUI.java b/designer-realize/src/main/java/com/fr/design/fit/grid/NewFormDesignerGridUI.java new file mode 100644 index 000000000..c3cc4f53d --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/fit/grid/NewFormDesignerGridUI.java @@ -0,0 +1,190 @@ +package com.fr.design.fit.grid; + +import com.fr.design.designer.creator.XElementCase; +import com.fr.design.fit.AdaptiveCellElementPainter; +import com.fr.design.fit.common.FormDesignerUtil; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.mainframe.FormDesigner; +import com.fr.grid.CellElementPainter; +import com.fr.grid.Grid; +import com.fr.grid.GridColumn; +import com.fr.grid.GridRow; +import com.fr.grid.GridUI; +import com.fr.report.elementcase.TemplateElementCase; +import com.fr.report.worksheet.FormElementCase; +import com.fr.stable.Constants; +import com.fr.stable.GraphDrawHelper; + +import javax.swing.JComponent; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.Rectangle; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.event.MouseWheelListener; + + +/** + * Created by kerry on 2020-04-14 + */ +public class NewFormDesignerGridUI extends GridUI { + private GridLimitColumnMouseHandler gridColumnMouseHandler; + private GridLimitRowMouseHandler gridRowMouseHandler; + private AdaptiveGridListener adaptiveGridListener; + private FormDesigner designer; + + public NewFormDesignerGridUI(FormDesigner designer, int resolution) { + super(resolution); + this.designer = designer; + this.setCellElementPainter(new AdaptiveCellElementPainter()); + } + + public void setCellElementPainter(CellElementPainter elementPainter) { + this.painter = elementPainter; + } + + public void paint(Graphics g, JComponent c) { + Graphics2D g2d = (Graphics2D) g; + Grid grid = (Grid) c; + // 取得ElementCasePane.ElementCase + ElementCasePane elementCasePane = grid.getElementCasePane(); + final TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); + + super.paint(g, c); + + if (!(elementCase instanceof FormElementCase)) { + return; + } + final Rectangle rectangle = getBoundsLineRect(elementCase, grid); + int width = rectangle.width - columnWidthList.getRangeValue(0, horizontalValue).toPixI(resolution); + int height = rectangle.height - rowHeightList.getRangeValue(0, verticalValue).toPixI(resolution); + drawBoundsLine(g2d, width, height); + addListener(grid, elementCasePane, width, height, rectangle.width, rectangle.height); + } + + /** + * 获取需要画线的矩形大小 + */ + private Rectangle getBoundsLineRect(TemplateElementCase elementCase, Grid grid) { + final Rectangle rectangle = new Rectangle(); + XElementCase xElementCase = FormDesignerUtil.getXelementCase(designer.getRootComponent(), (FormElementCase) elementCase); + if (xElementCase != null) { + rectangle.setBounds(xElementCase.getBounds()); + + //减去内边距的宽和高 + Insets insets = xElementCase.getInsets(); + rectangle.width -= insets.left + insets.right; + rectangle.height -= insets.top + insets.bottom; + + } + return rectangle; + } + + + private void addListener(Grid grid, ElementCasePane elementCasePane, int width, int height, int actualWidth, int actualHeight) { + addGridColumnListener(elementCasePane.getGridColumn(), width); + addGridRowListener(elementCasePane.getGridRow(), height); + addMouseListener(grid, width, height, actualWidth, actualHeight); + } + + + private void drawBoundsLine(Graphics2D g2d, int width, int height) { + g2d.setPaint(Color.black); + g2d.setStroke(GraphDrawHelper.getStroke(Constants.LINE_DASH_DOT)); + g2d.drawLine(0, height, width, height); + g2d.drawLine(width, 0, width, height); + } + + private void removeGridColumnListener(GridColumn column) { + MouseMotionListener[] mouseMotionListeners = column.getMouseMotionListeners(); + for (MouseMotionListener mouseMotionListener : mouseMotionListeners) { + if (mouseMotionListener instanceof com.fr.grid.GridColumnMouseHandler || mouseMotionListener instanceof GridLimitColumnMouseHandler) { + column.removeMouseMotionListener(mouseMotionListener); + } + } + MouseListener[] mouseListeners = column.getMouseListeners(); + for (MouseListener motionListener : mouseListeners) { + if (motionListener instanceof com.fr.grid.GridColumnMouseHandler || motionListener instanceof GridLimitColumnMouseHandler) { + column.removeMouseListener(motionListener); + } + } + } + + private void removeGridRowListener(GridRow row) { + MouseMotionListener[] mouseMotionListeners = row.getMouseMotionListeners(); + for (MouseMotionListener mouseMotionListener : mouseMotionListeners) { + if (mouseMotionListener instanceof com.fr.grid.GridRowMouseHandler || mouseMotionListener instanceof GridLimitRowMouseHandler) { + row.removeMouseMotionListener(mouseMotionListener); + } + } + MouseListener[] mouseListeners = row.getMouseListeners(); + for (MouseListener motionListener : mouseListeners) { + if (motionListener instanceof com.fr.grid.GridRowMouseHandler || motionListener instanceof GridLimitRowMouseHandler) { + row.removeMouseListener(motionListener); + } + } + } + + private void removeGridListener(Grid grid) { + MouseMotionListener[] mouseMotionListeners = grid.getMouseMotionListeners(); + for (MouseMotionListener mouseMotionListener : mouseMotionListeners) { + if (mouseMotionListener instanceof AdaptiveGridListener) { + grid.removeMouseMotionListener(mouseMotionListener); + break; + } + } + MouseListener[] mouseListeners = grid.getMouseListeners(); + for (MouseListener motionListener : mouseListeners) { + if (motionListener instanceof AdaptiveGridListener) { + grid.removeMouseListener(motionListener); + break; + } + } + MouseWheelListener[] mouseWheelListeners = grid.getMouseWheelListeners(); + for (MouseWheelListener mouseWheelListener : mouseWheelListeners) { + if (mouseWheelListener instanceof AdaptiveGridListener) { + grid.removeMouseWheelListener(mouseWheelListener); + break; + } + } + } + + private void addGridColumnListener(GridColumn column, int width) { + if (gridColumnMouseHandler != null) { + gridColumnMouseHandler.setLimit(width); + return; + } + removeGridColumnListener(column); + gridColumnMouseHandler = new GridLimitColumnMouseHandler(column, width); + column.addMouseListener(gridColumnMouseHandler); + column.addMouseMotionListener(gridColumnMouseHandler); + } + + + private void addGridRowListener(GridRow row, int height) { + if (gridRowMouseHandler != null) { + gridRowMouseHandler.setLimit(height); + return; + } + removeGridRowListener(row); + gridRowMouseHandler = new GridLimitRowMouseHandler(row, height); + row.addMouseMotionListener(gridRowMouseHandler); + row.addMouseListener(gridRowMouseHandler); + } + + + private void addMouseListener(Grid grid, int width, int height, int actualWidth, int actualHeight) { + if (adaptiveGridListener != null) { + adaptiveGridListener.resetBoundInfo(width, height, actualWidth, actualHeight); + return; + } + removeGridListener(grid); + adaptiveGridListener = new AdaptiveGridListener(grid, width, height, actualWidth, actualHeight); + grid.addMouseMotionListener(adaptiveGridListener); + grid.addMouseListener(adaptiveGridListener); + grid.addMouseWheelListener(adaptiveGridListener); + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index 30f7b1546..befe413f9 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -67,6 +67,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.designer.EditingState; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.fun.ElementUIProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIPopupMenu; @@ -225,7 +226,7 @@ public abstract class ElementCasePane extends Tar //todo 直接修改分辨率 if (this.resolution == 0) { - this.resolution = ScreenResolution.getScreenResolution(); + this.resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); } this.initGridComponent(); @@ -351,10 +352,10 @@ public abstract class ElementCasePane extends Tar this.grid = new Grid(this.resolution); } if (this.gridColumn == null) { - this.gridColumn = new GridColumn(); + this.gridColumn = new GridColumn(this.resolution); } if (this.gridRow == null) { - this.gridRow = new GridRow(); + this.gridRow = new GridRow(this.resolution); } if (this.gridCorner == null) { this.gridCorner = new GridCorner(); @@ -1375,7 +1376,7 @@ public abstract class ElementCasePane extends Tar protected Selection selection; protected int verticalValue = 0; protected int horizontalValue = 0; - protected int resolution = ScreenResolution.getScreenResolution(); + protected int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); protected ElementCaseEditingState(Selection selection, int verticalValue, int horizontalValue, int resolution) { try { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java index 45c2fea61..dea5145ce 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java @@ -13,6 +13,7 @@ import com.fr.design.designer.EditingState; import com.fr.design.designer.TargetComponent; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.AuthorityEditPane; @@ -137,6 +138,9 @@ public class FormElementCaseDesigner g.setColor(Color.WHITE); g.fillRect(0, 0, size.width, size.height); g.setColor(oldColor); + if (DesignerUIModeConfig.getInstance().newUIMode()) { + g.translate(-elementCasePane.getGridCorner().getWidth(), -elementCasePane.getGridCorner().getHeight()); + } this.elementCasePane.paintComponents(g); diff --git a/designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java b/designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java index 349503bd7..b04e4ad1e 100644 --- a/designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java +++ b/designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java @@ -2,13 +2,12 @@ package com.fr.grid; import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; -import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.unit.UnitConvertUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.FloatSelection; @@ -39,7 +38,7 @@ import java.lang.reflect.Method; public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter { protected static final int SEPARATOR_GAP = 5; - private GridHeader gHeader; + protected GridHeader gHeader; private int dragType = GridUtils.DRAG_NONE; //james 是否为选定多行的drag private boolean isMultiSelectDragPermited = false; @@ -51,7 +50,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter { private int dragIndex = 0; private JToolTip tip = null; private JWindow tipWindow = null; - protected int resolution = ScreenResolution.getScreenResolution(); + protected int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); public AbstractGridHeaderMouseHandler(GridHeader gHeader) { this.gHeader = gHeader; @@ -307,7 +306,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter { // int resolution = ScreenResolution.getScreenResolution(); FU ulen = FU.valueOfPix((int) doubleValue, resolution); FU tulen = FU.valueOfPix((int) totalDoubleValue, resolution); - ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); + ReportLengthUNITProvider lengthUNIT = DesignerUIModeConfig.getInstance().parseLengthUNIT(unitType); String unit = lengthUNIT.unitText(); double len = lengthUNIT.unit2Value4Scale(ulen); double tlen = lengthUNIT.unit2Value4Scale(tulen); diff --git a/designer-realize/src/main/java/com/fr/grid/DefaultGridUIProcessor.java b/designer-realize/src/main/java/com/fr/grid/DefaultGridUIProcessor.java index 65b6aa456..0b4c900e3 100644 --- a/designer-realize/src/main/java/com/fr/grid/DefaultGridUIProcessor.java +++ b/designer-realize/src/main/java/com/fr/grid/DefaultGridUIProcessor.java @@ -1,16 +1,24 @@ package com.fr.grid; +import com.fr.design.fit.DesignerUIModeConfig; +import com.fr.design.fit.grid.NewFormDesignerGridUI; import com.fr.design.fun.impl.AbstractGridUIProcessor; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.WidgetPropertyPane; import javax.swing.plaf.ComponentUI; /** * Created by Administrator on 2016/6/28/0028. */ -public class DefaultGridUIProcessor extends AbstractGridUIProcessor{ +public class DefaultGridUIProcessor extends AbstractGridUIProcessor { @Override public ComponentUI appearanceForGrid(int resolution) { + if (DesignerUIModeConfig.getInstance().newUIMode()) { + FormDesigner designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + return new NewFormDesignerGridUI(designer, resolution); + } return new GridUI(resolution); } diff --git a/designer-realize/src/main/java/com/fr/grid/GridColumn.java b/designer-realize/src/main/java/com/fr/grid/GridColumn.java index 8ba6484bc..eed4136d4 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridColumn.java +++ b/designer-realize/src/main/java/com/fr/grid/GridColumn.java @@ -6,14 +6,10 @@ package com.fr.grid; import java.awt.Dimension; import com.fr.base.GraphHelper; -import com.fr.base.ScreenResolution; -import com.fr.design.ExtraDesignClassManager; -import com.fr.design.fun.GridUIProcessor; +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.mainframe.ElementCasePane; import com.fr.stable.StableUtils; -import javax.swing.plaf.ComponentUI; - /** * GridColumn used to paint and edit grid column. * @@ -22,20 +18,23 @@ import javax.swing.plaf.ComponentUI; */ public class GridColumn extends GridHeader { - public int resolution = ScreenResolution.getScreenResolution(); private GridColumnMouseHandler gridColumnMouseHandler; + public GridColumn(int resolution) { + super(resolution); + } + @Override protected void initByConstructor() { - resolution = ScreenResolution.getScreenResolution(); - this.setResolution(resolution); gridColumnMouseHandler = new GridColumnMouseHandler(this); this.addMouseListener(gridColumnMouseHandler); this.addMouseMotionListener(gridColumnMouseHandler); this.updateUI(); } + + @Override public String getDisplay(int index) { return StableUtils.convertIntToABC(index + 1); @@ -48,26 +47,16 @@ public class GridColumn extends GridHeader { gridColumnMouseHandler = new GridColumnMouseHandler(this); this.addMouseListener(gridColumnMouseHandler); this.addMouseMotionListener(gridColumnMouseHandler); -// gridColumnMouseHandler.setResolution(resolution); this.setUI(new GridColumnUI(resolution)); } - public void setResolution(int resolution) { - this.resolution = resolution; - } - - @Override - public int getResolution() { - return this.resolution; - } - /** * Gets the preferred size. */ @Override public Dimension getPreferredSize() { ElementCasePane reportPane = this.getElementCasePane(); - float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); + float time = (float)reportPane.getResolution()/ DesignerUIModeConfig.getInstance().getScreenResolution(); if (!reportPane.isColumnHeaderVisible()) { return new Dimension(0, 0); } diff --git a/designer-realize/src/main/java/com/fr/grid/GridColumnMouseHandler.java b/designer-realize/src/main/java/com/fr/grid/GridColumnMouseHandler.java index 09ad45d32..bc5b54c90 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridColumnMouseHandler.java +++ b/designer-realize/src/main/java/com/fr/grid/GridColumnMouseHandler.java @@ -7,9 +7,7 @@ import java.awt.Toolkit; import java.awt.event.MouseEvent; import javax.swing.SwingUtilities; - import com.fr.base.DynamicUnitList; -import com.fr.base.ScreenResolution; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.ElementCasePane; import com.fr.grid.selection.CellSelection; @@ -23,8 +21,6 @@ import com.fr.stable.ColumnRow; */ public class GridColumnMouseHandler extends AbstractGridHeaderMouseHandler { - private int resolution; - public GridColumnMouseHandler(GridColumn gridColumn) { super(gridColumn); this.resolution = gridColumn.resolution; diff --git a/designer-realize/src/main/java/com/fr/grid/GridColumnUI.java b/designer-realize/src/main/java/com/fr/grid/GridColumnUI.java index d3e90308b..088c8f220 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridColumnUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridColumnUI.java @@ -16,6 +16,7 @@ import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; import com.fr.cache.list.IntList; import com.fr.design.constants.UIConstants; +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.grid.selection.Selection; @@ -33,7 +34,7 @@ public class GridColumnUI extends ComponentUI { public GridColumnUI(int resolution){ if (resolution == 0){ - resolution = ScreenResolution.getScreenResolution(); + resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); } this.resolution = resolution; } @@ -49,7 +50,7 @@ public class GridColumnUI extends ComponentUI { Grid gird = reportPane.getGrid(); // size Dimension size = gridColumn.getSize(); - float time = (float)resolution/ScreenResolution.getScreenResolution(); + float time = (float)resolution/DesignerUIModeConfig.getInstance().getScreenResolution(); g2d.setFont(gridColumn.getFont().deriveFont(gridColumn.getFont().getSize2D() * time)); ElementCase elementCase = reportPane.getEditingElementCase(); @@ -161,7 +162,7 @@ public class GridColumnUI extends ComponentUI { columnContent += "(FR)"; } } - float time = (float)resolution/ScreenResolution.getScreenResolution(); + float time = (float)resolution/DesignerUIModeConfig.getInstance().getScreenResolution(); double stringWidth = gridColumn.getFont().getStringBounds(columnContent, fontRenderContext).getWidth() * time; if (stringWidth > tmpIncreaseWidth) { diff --git a/designer-realize/src/main/java/com/fr/grid/GridCorner.java b/designer-realize/src/main/java/com/fr/grid/GridCorner.java index f2dd43d5e..4d1d393b7 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridCorner.java +++ b/designer-realize/src/main/java/com/fr/grid/GridCorner.java @@ -6,6 +6,7 @@ package com.fr.grid; import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; import com.fr.design.constants.UIConstants; +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.mainframe.ElementCasePane; import javax.swing.event.MouseInputListener; @@ -35,7 +36,7 @@ public class GridCorner extends BaseGridComponent { Graphics2D g2d = (Graphics2D) g; ElementCasePane reportPane = this.getElementCasePane(); - float time = (float) reportPane.getResolution() / ScreenResolution.getScreenResolution(); + float time = (float) reportPane.getResolution() / DesignerUIModeConfig.getInstance().getScreenResolution(); //size Dimension size = this.getSize(); Rectangle2D rect2D = new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()); diff --git a/designer-realize/src/main/java/com/fr/grid/GridHeader.java b/designer-realize/src/main/java/com/fr/grid/GridHeader.java index 9a4a1b949..ec974b197 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridHeader.java +++ b/designer-realize/src/main/java/com/fr/grid/GridHeader.java @@ -15,7 +15,8 @@ public abstract class GridHeader extends BaseGridComponent { protected int resolution; - public GridHeader() { + public GridHeader(int resolution) { + this.resolution = resolution; //清除所有的Key Action. this.getInputMap().clear(); this.getActionMap().clear(); 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 b0f91a902..060bc2ace 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -6,6 +6,7 @@ import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.constants.UIConstants; +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.ElementCasePane; @@ -73,7 +74,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous private int ECBlockGap = 40; - private int resolution = ScreenResolution.getScreenResolution(); + private int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); protected GridMouseAdapter(Grid grid) { this.grid = grid; diff --git a/designer-realize/src/main/java/com/fr/grid/GridRow.java b/designer-realize/src/main/java/com/fr/grid/GridRow.java index 7dbb4af3a..a85c3c398 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridRow.java +++ b/designer-realize/src/main/java/com/fr/grid/GridRow.java @@ -8,6 +8,7 @@ import java.awt.Dimension; import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.fun.GridUIProcessor; import com.fr.design.mainframe.ElementCasePane; @@ -22,13 +23,14 @@ import javax.swing.plaf.ComponentUI; public class GridRow extends GridHeader { private static final int MAX = 4; - private int resolution = ScreenResolution.getScreenResolution(); private GridRowMouseHandler gridRowMouseHandler; + public GridRow(int resolution) { + super(resolution); + } + @Override protected void initByConstructor() { - resolution = ScreenResolution.getScreenResolution(); - this.setResolution(resolution); gridRowMouseHandler = new GridRowMouseHandler(this); this.addMouseListener(gridRowMouseHandler); this.addMouseMotionListener(gridRowMouseHandler); @@ -50,14 +52,6 @@ public class GridRow extends GridHeader { this.setUI(new GridRowUI(resolution)); } - public void setResolution(int resolution) { - this.resolution = resolution; - } - - public int getResolution() { - return this.resolution; - } - /** * Gets the preferred size. @@ -65,7 +59,7 @@ public class GridRow extends GridHeader { @Override public Dimension getPreferredSize() { ElementCasePane reportPane = this.getElementCasePane(); - float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); + float time = (float)reportPane.getResolution()/ DesignerUIModeConfig.getInstance().getScreenResolution(); if (!(reportPane.isRowHeaderVisible())) { return new Dimension(0, 0); } diff --git a/designer-realize/src/main/java/com/fr/grid/GridRowUI.java b/designer-realize/src/main/java/com/fr/grid/GridRowUI.java index a0245a3d8..6c2fed6d0 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridRowUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridRowUI.java @@ -7,6 +7,8 @@ import java.awt.geom.Rectangle2D; import javax.swing.JComponent; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; + +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.stable.AssistUtils; import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; @@ -32,7 +34,7 @@ public class GridRowUI extends ComponentUI { GridRowUI(int resolution){ if (resolution == 0){ - resolution = ScreenResolution.getScreenResolution(); + resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); } this.resolution = resolution; } @@ -47,7 +49,7 @@ public class GridRowUI extends ComponentUI { ElementCasePane reportPane = gridRow.getElementCasePane(); // size Dimension size = gridRow.getSize(); - float time = (float)resolution/ScreenResolution.getScreenResolution(); + float time = (float)resolution/DesignerUIModeConfig.getInstance().getScreenResolution(); g2d.setFont(gridRow.getFont().deriveFont(gridRow.getFont().getSize2D() * time)); ElementCase elementCase = reportPane.getEditingElementCase(); @@ -156,7 +158,7 @@ public class GridRowUI extends ComponentUI { , ElementCase elementCase, Dimension size, double tmpHeight1) { // FontMetrics FontRenderContext fontRenderContext = g2d.getFontRenderContext(); - float time = (float)resolution/ScreenResolution.getScreenResolution(); + float time = (float)resolution/DesignerUIModeConfig.getInstance().getScreenResolution(); float fmAscent = GraphHelper.getFontMetrics(gridRow.getFont()).getAscent() * time; double stringWidth = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getWidth() * time; double stringHeight = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getHeight() * time; diff --git a/designer-realize/src/main/java/com/fr/grid/GridUtils.java b/designer-realize/src/main/java/com/fr/grid/GridUtils.java index 80e6f3ff5..31ceacd7a 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUtils.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUtils.java @@ -5,6 +5,7 @@ import com.fr.base.ScreenResolution; import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.FloatElementsClip; +import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; @@ -124,7 +125,7 @@ public class GridUtils { */ public static double[] caculateFloatElementLocations(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList, int verticalValue, int horizentalValue) { - int resolution = ScreenResolution.getScreenResolution(); + int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution); double floatY = rowHeightList.getRangeValue(verticalValue, 0).toPixD(resolution) + floatElement.getTopDistance().toPixD(resolution); @@ -177,7 +178,7 @@ public class GridUtils { private static int cc_selected_column_or_row(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList) { double tmpIntIndex = 0; int selectedCellIndex = 0; - int resolution = ScreenResolution.getScreenResolution(); + int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); if (mouseEvtPosition < 0) { selectedCellIndex = value; for (; true; selectedCellIndex--) { diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 3f1aa2663..025539d79 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -27,6 +27,8 @@ import com.fr.design.actions.insert.flot.ImageFloatAction; import com.fr.design.actions.insert.flot.TextBoxFloatAction; import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.constants.DesignerLaunchStatus; +import com.fr.design.fit.NewJForm; +import com.fr.design.fit.common.TemplateTool; import com.fr.design.form.parameter.FormParaDesigner; import com.fr.design.fun.ElementUIProvider; import com.fr.design.gui.controlpane.NameObjectCreator; @@ -42,7 +44,7 @@ import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.ElementCaseThumbnail; import com.fr.design.mainframe.FormHierarchyTreePane; import com.fr.design.mainframe.InformationCollector; -import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.JTemplateEvent; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetToolBarPane; import com.fr.design.mainframe.alphafine.AlphaFineHelper; @@ -62,6 +64,7 @@ import com.fr.design.parameter.WorkBookParameterReader; import com.fr.design.update.actions.RecoverForDesigner; import com.fr.design.update.push.DesignerPushUpdateManager; import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane; +import com.fr.event.EventDispatcher; import com.fr.form.stable.ElementCaseThumbnailProcessor; import com.fr.general.GeneralContext; import com.fr.general.xml.GeneralXMLTools; @@ -395,9 +398,15 @@ public class DesignerActivator extends Activator { DesignModuleFactory.registerButtonDetailPaneClass(FormSubmitButtonDetailPane.class); DesignModuleFactory.registerParameterReader(new FormParameterReader()); - StableFactory.registerMarkedClass(BaseJForm.XML_TAG, JForm.class); - + StableFactory.registerMarkedClass(BaseJForm.XML_TAG, NewJForm.class); StableFactory.registerMarkedObject(ElementCaseThumbnailProcessor.MARK_STRING, new ElementCaseThumbnail()); + + registerJTemplateEvent(); + } + + private static void registerJTemplateEvent(){ + EventDispatcher.listen(JTemplateEvent.BEFORE_TEMPLATE_INIT, TemplateTool.getSwitchListener()); + EventDispatcher.listen(JTemplateEvent.BEFORE_TEMPLATE_ACTIVE, TemplateTool.getSwitchListener()); } private static void storePassport() { From 1bc69b0b2448de3f74a32e36b305d17ae9fc435b Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 4 Feb 2021 13:51:46 +0800 Subject: [PATCH 123/147] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/fit/FitStateCompatibleTest.java | 24 +++++++ .../fr/design/fit/FormUIModeConfigTest.java | 22 +++++++ .../fr/design/fit/PXReportLengthUNITTest.java | 49 ++++++++++++++ .../test/java/com/fr/design/fit/PXTest.java | 64 +++++++++++++++++++ .../fit/common/FormDesignerUtilTest.java | 38 +++++++++++ .../design/preview/DeveloperPreviewTest.java | 28 ++++++++ .../preview/FormAdaptivePreviewTest.java | 30 +++++++++ 7 files changed, 255 insertions(+) create mode 100644 designer-form/src/test/java/com/fr/design/fit/FitStateCompatibleTest.java create mode 100644 designer-form/src/test/java/com/fr/design/fit/FormUIModeConfigTest.java create mode 100644 designer-form/src/test/java/com/fr/design/fit/PXReportLengthUNITTest.java create mode 100644 designer-form/src/test/java/com/fr/design/fit/PXTest.java create mode 100644 designer-form/src/test/java/com/fr/design/fit/common/FormDesignerUtilTest.java create mode 100644 designer-form/src/test/java/com/fr/design/preview/DeveloperPreviewTest.java create mode 100644 designer-form/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java diff --git a/designer-form/src/test/java/com/fr/design/fit/FitStateCompatibleTest.java b/designer-form/src/test/java/com/fr/design/fit/FitStateCompatibleTest.java new file mode 100644 index 000000000..a826cb4b2 --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/fit/FitStateCompatibleTest.java @@ -0,0 +1,24 @@ +package com.fr.design.fit; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by kerry on 2020-04-27 + */ +public class FitStateCompatibleTest { + @Test + public void testGetNewTypeFromOld() { + Assert.assertEquals(0, FitStateCompatible.getNewTypeFromOld(0)); + Assert.assertEquals(1, FitStateCompatible.getNewTypeFromOld(1)); + Assert.assertEquals(0, FitStateCompatible.getNewTypeFromOld(2)); + Assert.assertEquals(2, FitStateCompatible.getNewTypeFromOld(3)); + } + + @Test + public void testGetOldTypeFromNew() { + Assert.assertEquals(2, FitStateCompatible.getOldTypeFromNew(0)); + Assert.assertEquals(1, FitStateCompatible.getOldTypeFromNew(1)); + Assert.assertEquals(3, FitStateCompatible.getOldTypeFromNew(2)); + } +} diff --git a/designer-form/src/test/java/com/fr/design/fit/FormUIModeConfigTest.java b/designer-form/src/test/java/com/fr/design/fit/FormUIModeConfigTest.java new file mode 100644 index 000000000..12c57280c --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/fit/FormUIModeConfigTest.java @@ -0,0 +1,22 @@ +package com.fr.design.fit; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by kerry on 2020-06-05 + */ +public class FormUIModeConfigTest { + @Test + public void testSetNewUIMode(){ + DesignerUIModeConfig.getInstance().setNewUIMode(); + Assert.assertTrue(DesignerUIModeConfig.getInstance().newUIMode()); + } + + @Test + public void testSetOldUIMode(){ + Assert.assertTrue(DesignerUIModeConfig.getInstance().newUIMode()); + DesignerUIModeConfig.getInstance().setOldUIMode(); + Assert.assertFalse(DesignerUIModeConfig.getInstance().newUIMode()); + } +} diff --git a/designer-form/src/test/java/com/fr/design/fit/PXReportLengthUNITTest.java b/designer-form/src/test/java/com/fr/design/fit/PXReportLengthUNITTest.java new file mode 100644 index 000000000..eef7eece9 --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/fit/PXReportLengthUNITTest.java @@ -0,0 +1,49 @@ +package com.fr.design.fit; + +import com.fr.base.ScreenResolution; +import com.fr.stable.unit.FU; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +/** + * Created by kerry on 2020-04-24 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest(ScreenResolution.class) +public class PXReportLengthUNITTest { + + @Test + public void testUnitText() { + PXReportLengthUNIT pxReportLengthUNIT = new PXReportLengthUNIT(); + Assert.assertEquals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Px"), pxReportLengthUNIT.unitText()); + } + + @Test + public void testUnitType() { + PXReportLengthUNIT pxReportLengthUNIT = new PXReportLengthUNIT(); + Assert.assertEquals(4, pxReportLengthUNIT.unitType()); + } + + @Test + public void testUnit2Value4Scale() { + PXReportLengthUNIT pxReportLengthUNIT = new PXReportLengthUNIT(); + PowerMock.mockStatic(ScreenResolution.class); + EasyMock.expect(ScreenResolution.getScreenResolution()).andReturn(96).once(); + PowerMock.replayAll(); + Assert.assertEquals(12, (int) pxReportLengthUNIT.unit2Value4Scale(FU.getInstance(457200L))); + } + + @Test + public void testFloat2UNIT() { + PowerMock.mockStatic(ScreenResolution.class); + EasyMock.expect(ScreenResolution.getScreenResolution()).andReturn(96).once(); + PowerMock.replayAll(); + PXReportLengthUNIT pxReportLengthUNIT = new PXReportLengthUNIT(); + Assert.assertEquals(457200L, pxReportLengthUNIT.float2UNIT(12.0F).toFU()); + } +} diff --git a/designer-form/src/test/java/com/fr/design/fit/PXTest.java b/designer-form/src/test/java/com/fr/design/fit/PXTest.java new file mode 100644 index 000000000..4db3e5e0a --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/fit/PXTest.java @@ -0,0 +1,64 @@ +package com.fr.design.fit; + +import com.fr.base.ScreenResolution; +import com.fr.invoke.Reflect; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.math.BigDecimal; + +/** + * Created by kerry on 2020-04-26 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest(ScreenResolution.class) +public class PXTest { + + @Test + public void testGetScaleNumber(){ + PowerMock.mockStatic(ScreenResolution.class); + EasyMock.expect(ScreenResolution.getScreenResolution()).andReturn(96).once(); + PowerMock.replayAll(); + PX px = new PX(100F); + BigDecimal scaleNumber = Reflect.on(px).call("getScaleNumber").get(); + Assert.assertEquals(100L, scaleNumber.longValue()); + } + + @Test + public void testGetMoreFUScale() { + PowerMock.mockStatic(ScreenResolution.class); + EasyMock.expect(ScreenResolution.getScreenResolution()).andReturn(96).times(2); + PowerMock.replayAll(); + PX px = new PX(100F); + long fuScale = Reflect.on(px).call("getMoreFUScale").get(); + Assert.assertEquals(381L, fuScale); + } + + @Test + public void testToPixI(){ + PowerMock.mockStatic(ScreenResolution.class); + EasyMock.expect(ScreenResolution.getScreenResolution()).andReturn(96).times(2); + PowerMock.replayAll(); + PX px = new PX(100F); + Assert.assertEquals(100, px.toPixI(96)); + + px = new PX(19.5F); + Assert.assertEquals(19.5F, px.toPixF(96), 0.0F); + } + + @Test + public void testToPixWithResolution(){ + Assert.assertEquals(100D, PX.toPixWithResolution(100D, 96), 0.0D); + + Assert.assertEquals(19.5D, PX.toPixWithResolution(19.5D, 96), 0.0D); + + Assert.assertEquals(150D, PX.toPixWithResolution(100D, 144), 0.0D); + + Assert.assertEquals(29.25D, PX.toPixWithResolution(19.5D, 144), 0.0D); + } +} diff --git a/designer-form/src/test/java/com/fr/design/fit/common/FormDesignerUtilTest.java b/designer-form/src/test/java/com/fr/design/fit/common/FormDesignerUtilTest.java new file mode 100644 index 000000000..786d45d91 --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/fit/common/FormDesignerUtilTest.java @@ -0,0 +1,38 @@ +package com.fr.design.fit.common; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by kerry on 2020-06-12 + */ +public class FormDesignerUtilTest { + + @Test + public void testRemoveDeletedEC(){ + List list1 = new ArrayList(); + List list2 = new ArrayList(); + list2.add("test2"); + list2.add("test3"); + list2.add("test4"); + FormDesignerUtil.removeDeletedEC(list1, list2); + Assert.assertEquals(0, list2.size()); + + list1.add("test1"); + list1.add("test3"); + list2.add("test2"); + list2.add("test3"); + list2.add("test4"); + FormDesignerUtil.removeDeletedEC(list1, list2); + Assert.assertEquals(1, list2.size()); + Assert.assertEquals("test3", list2.get(0)); + + list1.remove("test3"); + FormDesignerUtil.removeDeletedEC(list1, list2); + Assert.assertEquals(0, list2.size()); + + } +} diff --git a/designer-form/src/test/java/com/fr/design/preview/DeveloperPreviewTest.java b/designer-form/src/test/java/com/fr/design/preview/DeveloperPreviewTest.java new file mode 100644 index 000000000..624e34e59 --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/preview/DeveloperPreviewTest.java @@ -0,0 +1,28 @@ +package com.fr.design.preview; + +import com.fr.design.mainframe.JForm; +import com.fr.general.web.ParameterConstants; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Map; + +/** + * Created by kerry on 2020-04-24 + */ +public class DeveloperPreviewTest { + @Test + public void testParametersForPreview() { + DeveloperPreview formPreview = new DeveloperPreview(); + Map map = formPreview.parametersForPreview(); + Assert.assertEquals(1, map.size()); + Assert.assertEquals("developer_preview", map.get(ParameterConstants.OP)); + } + + @Test + public void testAccept() { + DeveloperPreview formPreview = new DeveloperPreview(); + Assert.assertTrue(formPreview.accept(EasyMock.mock(JForm.class))); + } +} diff --git a/designer-form/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java b/designer-form/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java new file mode 100644 index 000000000..f3d1b5079 --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java @@ -0,0 +1,30 @@ +package com.fr.design.preview; + +import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.JWorkBook; +import com.fr.general.web.ParameterConstants; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Map; + +/** + * Created by kerry on 2020-04-24 + */ +public class FormAdaptivePreviewTest { + @Test + public void testParametersForPreview() { + FormAdaptivePreview formPreview = new FormAdaptivePreview(); + Map map = formPreview.parametersForPreview(); + Assert.assertEquals(1, map.size()); + Assert.assertEquals("form_adaptive", map.get(ParameterConstants.OP)); + } + + @Test + public void testAccept() { + FormAdaptivePreview formPreview = new FormAdaptivePreview(); + Assert.assertTrue(formPreview.accept(EasyMock.mock(JForm.class))); + Assert.assertFalse(formPreview.accept(EasyMock.mock(JWorkBook.class))); + } +} From 1803689c0b25f09977985f1a8c49c61ee6392513 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Fri, 5 Feb 2021 10:14:25 +0800 Subject: [PATCH 124/147] =?UTF-8?q?CHART-18070=20=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=BB=84=E5=90=88=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChartOtherPane.java | 2 +- .../VanChartCustomConditionAttrPane.java | 4 ++- ...anChartCustomPlotConditionAttrTabPane.java | 21 +++++++++++ .../style/VanChartCustomPlotLabelTabPane.java | 15 ++++++++ .../VanChartCustomPlotTooltipTabPane.java | 15 ++++++++ .../custom/style/VanChartCustomStylePane.java | 11 ++++++ .../richText/VanChartRichEditorPane.java | 35 ++++++++++++++++--- .../designer/style/VanChartStylePane.java | 2 +- .../tooltip/VanChartPlotTooltipPane.java | 3 ++ 9 files changed, 101 insertions(+), 7 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java index 54c010119..4bc363306 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java @@ -111,7 +111,7 @@ public class ChartOtherPane extends AbstractChartAttrPane { public void populateBean(Chart chart) { interactivePane.populateBean(chart); if (ChartOtherPane.this.isHaveCondition()) { - VanChartRichEditorPane.refreshFieldNames(chart); + VanChartRichEditorPane.refreshCommonChartFieldNames(chart); conditionAttrPane.populateBean(chart); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomConditionAttrPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomConditionAttrPane.java index da696fcce..0631312c8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomConditionAttrPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomConditionAttrPane.java @@ -39,7 +39,9 @@ public class VanChartCustomConditionAttrPane extends BasicScrollPane { layoutContentPane(); } if(conditionAttrPane != null) { - conditionAttrPane.populateBean((VanChartCustomPlot)chart.getPlot()); + conditionAttrPane.setChart(chart); + conditionAttrPane.populateBean(chart.getPlot()); + conditionAttrPane.tabChanged(); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java index cc0689d9c..4cb5c652f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java @@ -1,11 +1,13 @@ package com.fr.van.chart.custom.other; +import com.fr.chart.chartattr.Chart; import com.fr.design.dialog.BasicPane; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.custom.CustomPlotFactory; import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.van.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import com.fr.van.chart.designer.other.VanChartConditionAttrPane; import javax.swing.JPanel; @@ -16,10 +18,17 @@ import java.util.List; * Created by Fangjie on 2016/4/28. */ public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTabPane { + + private Chart chart; + public VanChartCustomPlotConditionAttrTabPane(VanChartCustomPlot plot, BasicPane parent) { super(plot, parent); } + public void setChart(Chart chart) { + this.chart = chart; + } + @Override protected void initTabTitle() { List customPlotList = plot.getCustomPlotList(); @@ -73,6 +82,18 @@ public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTa } } + protected void tabChanged() { + List customPlotList = plot.getCustomPlotList(); + int index = getSelectedIndex(); + + if (customPlotList.size() > index && paneList.size() > index) { + VanChartPlot chartPlot = customPlotList.get(index); + + CustomPlotType plotType = CustomPlotFactory.getCustomType(chartPlot); + VanChartRichEditorPane.refreshCustomChartTableFieldNames(chart, plotType); + } + } + @Override public VanChartCustomPlot updateBean() { return null; diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java index 04b94ef5c..ed1dd63ff 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java @@ -68,6 +68,21 @@ public class VanChartCustomPlotLabelTabPane extends VanChartCustomPlotTabPane customPlotList = plot.getCustomPlotList(); + int index = getSelectedIndex(); + + if (customPlotList.size() > index && paneList.size() > index) { + VanChartPlot chartPlot = customPlotList.get(index); + VanChartPlotLabelPane labelPane = (VanChartPlotLabelPane)paneList.get(index); + VanChartCustomStylePane stylePane = (VanChartCustomStylePane)labelPane.getParentPane(); + + if (stylePane != null) { + stylePane.refreshTableFieldNames(chartPlot); + } + } + } + @Override public VanChartCustomPlot updateBean() { return null; diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotTooltipTabPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotTooltipTabPane.java index 8595e8451..8cb4f4920 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotTooltipTabPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotTooltipTabPane.java @@ -67,6 +67,21 @@ public class VanChartCustomPlotTooltipTabPane extends VanChartCustomPlotTabPane< } } + protected void tabChanged() { + List customPlotList = plot.getCustomPlotList(); + int index = getSelectedIndex(); + + if (customPlotList.size() > index && paneList.size() > index) { + VanChartPlot chartPlot = customPlotList.get(index); + VanChartPlotTooltipPane tooltipPane = (VanChartPlotTooltipPane)paneList.get(index); + VanChartCustomStylePane stylePane = (VanChartCustomStylePane)tooltipPane.getParentPane(); + + if (stylePane != null) { + stylePane.refreshTableFieldNames(chartPlot); + } + } + } + @Override public VanChartCustomPlot updateBean() { return null; 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 fcfdc64de..a01cbf1cb 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 @@ -5,8 +5,11 @@ import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; +import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.custom.CustomPlotFactory; 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 java.util.List; @@ -68,4 +71,12 @@ public class VanChartCustomStylePane extends VanChartStylePane { CustomPlotFactory.dataSheetSynchronization((VanChartCustomPlot) collection.getSelectedChart().getPlot()); } + public void refreshTableFieldNames(VanChartPlot plot) { + CustomPlotType plotType = CustomPlotFactory.getCustomType(plot); + VanChartRichEditorPane.refreshCustomChartTableFieldNames(getChart(), plotType); + } + + public void refreshTableFieldNames() { + + } } 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 e1b7a79c4..312c24e84 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 @@ -16,6 +16,8 @@ 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; import com.fr.plugin.chart.type.TextAlign; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.PlotFactory; @@ -48,21 +50,46 @@ public class VanChartRichEditorPane { return fieldNames; } - public static void refreshFieldNames(Chart chart) { - VanChartRichEditorPane.fieldNames = null; - + // 更新普通图表中指定plot的数据集字段 + public static void refreshCommonChartFieldNames(Chart chart) { if (chart == null) { return; } Plot plot = chart.getPlot(); - if (plot == null || !PlotFactory.plotSupportAddTableField(plot)) { + if (plot == null) { + return; + } + + VanChartRichEditorPane.fieldNames = null; + + if (!PlotFactory.plotSupportAddTableField(plot)) { return; } TopDefinitionProvider definition = chart.getFilterDefinition(); + VanChartRichEditorPane.refreshFieldNames(definition); + } + + // 更新组合图表中指定plot的数据集字段 + public static void refreshCustomChartTableFieldNames(Chart chart, CustomPlotType plotType) { + if (chart == null || plotType == null) { + return; + } + + VanChartRichEditorPane.fieldNames = null; + TopDefinitionProvider filterDefinition = chart.getFilterDefinition(); + + if (filterDefinition instanceof CustomDefinition) { + CustomDefinition customDefinition = (CustomDefinition) filterDefinition; + Map definitionProviderMap = customDefinition.getDefinitionProviderMap(); + VanChartRichEditorPane.refreshFieldNames(definitionProviderMap.get(plotType)); + } + } + // 更新富文本数据集字段 + public static void refreshFieldNames(TopDefinitionProvider definition) { if (definition == null) { return; } 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 bb8df99fd..53619765c 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 @@ -78,6 +78,6 @@ public class VanChartStylePane extends ChartStylePane { } public void refreshTableFieldNames() { - VanChartRichEditorPane.refreshFieldNames(getChart()); + VanChartRichEditorPane.refreshCommonChartFieldNames(getChart()); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java index aa86fb9a7..5f76337d6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java @@ -98,6 +98,9 @@ public class VanChartPlotTooltipPane extends BasicPane { return components; } + public VanChartStylePane getParentPane() { + return parent; + } protected void initTooltipContentPane(Plot plot){ tooltipContentPane = PlotFactory.createPlotTooltipContentPane(plot, parent, VanChartPlotTooltipPane.this); From 6793b5bbd683e8e80483846165654d53d37aba88 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Fri, 5 Feb 2021 11:09:02 +0800 Subject: [PATCH 125/147] merge code --- .../java/com/fr/design/chartx/component/MapAreaMatchPane.java | 4 ++-- .../java/com/fr/design/chartx/component/MatchAreaTable.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java index df68c4a43..58068d10a 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java @@ -6,7 +6,7 @@ import com.fr.data.TableDataSource; import com.fr.data.TableDataSourceTailor; import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.NameTableData; -import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOMatchHelper; import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataComboBox; @@ -246,7 +246,7 @@ public class MapAreaMatchPane extends BasicBeanPane { private void populateMatchData(Object[] columnData) { Set geoAreas = matchAreaTable.getItems(); - Map resultMap = GEOJSONHelper.getInstance().matchAreaList(columnData, geoAreas, matchResultTable.getCustomResult()); + Map resultMap = GEOMatchHelper.getInstance().matchAreaList(columnData, geoAreas, matchResultTable.getCustomResult()); Object[][] data = new Object[resultMap.size()][2]; diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java index 4e1297dd3..cde622464 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java @@ -1,6 +1,6 @@ package com.fr.design.chartx.component; -import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOMatchHelper; import com.fr.design.i18n.Toolkit; import com.fr.general.GeneralUtils; @@ -88,7 +88,7 @@ public class MatchAreaTable extends JTable { return; } int index = areaNameIndex.get(areaName); - String result = GEOJSONHelper.getInstance().matchArea(GeneralUtils.objectToString(areaName), items, new HashMap<>()); + String result = GEOMatchHelper.getInstance().matchArea(GeneralUtils.objectToString(areaName), items, new HashMap<>()); getColumnModel().getColumn(1).getCellEditor().stopCellEditing(); this.setValueAt(result, index, 1); } From 9ae87be65372a77383a0b6ada37701bfbcf15ca0 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Fri, 5 Feb 2021 16:04:14 +0800 Subject: [PATCH 126/147] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E7=BC=96=E8=BE=91=E5=99=A8=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/component/richText/VanChartFieldButton.java | 7 +++++-- .../designer/component/richText/VanChartFieldListPane.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java index a9caac791..ba3925501 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java @@ -28,7 +28,7 @@ public class VanChartFieldButton extends JPanel { private static final Icon ADD_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"); private static final int W = 200; - private static final int H = 28; + private static final int H = 24; private final String fieldName; private final String fieldId; @@ -146,6 +146,9 @@ public class VanChartFieldButton extends JPanel { listener.addSelectedField(fieldName, fieldId); } }); + + fieldButton.setBorderPaintedOnlyWhenPressed(true); + addButton.setBorderPaintedOnlyWhenPressed(true); } private JPanel getContentPane() { @@ -160,7 +163,7 @@ public class VanChartFieldButton extends JPanel { double[] rowSize = {p}; double[] columnSize = {e, d}; - JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 5, 0); + JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); content.setPreferredSize(new Dimension(W, H)); return content; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index 61d7cfb25..02a62de3b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -114,7 +114,7 @@ public class VanChartFieldListPane extends JPanel { addDefaultFieldButton(fieldPane); fieldPane.setPreferredSize(new Dimension(FIELD_ADD_W, getDefaultFieldButtonList().size() * FIELD_ADD_H)); - fieldPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); + fieldPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 0)); return fieldPane; } From 317e2e00c0e4862f13ace5ef1ac958cfee24db38 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 18 Feb 2021 10:47:21 +0800 Subject: [PATCH 127/147] =?UTF-8?q?CHART-18139=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E5=AD=97=E6=AE=B5=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../richText/VanChartFieldButton.java | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java index ba3925501..db701d9fc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java @@ -2,10 +2,13 @@ package com.fr.van.chart.designer.component.richText; import com.fr.base.BaseUtils; import com.fr.data.util.function.DataFunction; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.plugin.chart.base.FirstFunction; import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; @@ -15,9 +18,12 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.Icon; import javax.swing.JPanel; +import javax.swing.plaf.ButtonUI; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.Graphics2D; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; @@ -120,6 +126,10 @@ public class VanChartFieldButton extends JPanel { } private void initComponents(String fieldName, VanChartFieldListener listener) { + Color pressedColor = UIConstants.ATTRIBUTE_PRESS; + Color hoverColor = new Color(232, 232, 232); + Color normalColor = UIConstants.ATTRIBUTE_NORMAL; + fieldButton = new UIToggleButton(fieldName) { protected MouseListener getMouseListener() { @@ -134,9 +144,39 @@ public class VanChartFieldButton extends JPanel { } }; } + + public ButtonUI getUI() { + + return new UIButtonUI() { + protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { + if (isPressed(b) && b.isPressedPainted()) { + GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), pressedColor); + } else if (isRollOver(b)) { + GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), hoverColor); + } else if (b.isNormalPainted()) { + GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), normalColor); + } + } + }; + } }; - addButton = new UIButton(ADD_ICON); + addButton = new UIButton(ADD_ICON) { + public ButtonUI getUI() { + + return new UIButtonUI() { + protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { + if (isPressed(b) && b.isPressedPainted()) { + GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), pressedColor); + } else if (isRollOver(b)) { + GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), hoverColor); + } else if (b.isNormalPainted()) { + GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), normalColor); + } + } + }; + } + }; addButton.addMouseListener(new MouseAdapter() { @@ -163,7 +203,7 @@ public class VanChartFieldButton extends JPanel { double[] rowSize = {p}; double[] columnSize = {e, d}; - JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); + JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 3, 0); content.setPreferredSize(new Dimension(W, H)); return content; From 3b2df497446786e5cdd932de9931d8b370e50e78 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 18 Feb 2021 11:15:30 +0800 Subject: [PATCH 128/147] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=86=85=E9=83=A8?= =?UTF-8?q?=E7=B1=BB=E4=BB=A3=E6=9B=BF=E9=87=8D=E5=A4=8D=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../richText/VanChartFieldButton.java | 45 +++++++------------ 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java index db701d9fc..bae96b2d7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java @@ -2,7 +2,6 @@ package com.fr.van.chart.designer.component.richText; import com.fr.base.BaseUtils; import com.fr.data.util.function.DataFunction; -import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIToggleButton; @@ -32,6 +31,7 @@ import java.text.Format; public class VanChartFieldButton extends JPanel { private static final Icon ADD_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"); + private static final Color HOVER_COLOR = new Color(232, 232, 232); private static final int W = 200; private static final int H = 24; @@ -126,10 +126,6 @@ public class VanChartFieldButton extends JPanel { } private void initComponents(String fieldName, VanChartFieldListener listener) { - Color pressedColor = UIConstants.ATTRIBUTE_PRESS; - Color hoverColor = new Color(232, 232, 232); - Color normalColor = UIConstants.ATTRIBUTE_NORMAL; - fieldButton = new UIToggleButton(fieldName) { protected MouseListener getMouseListener() { @@ -146,35 +142,13 @@ public class VanChartFieldButton extends JPanel { } public ButtonUI getUI() { - - return new UIButtonUI() { - protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { - if (isPressed(b) && b.isPressedPainted()) { - GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), pressedColor); - } else if (isRollOver(b)) { - GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), hoverColor); - } else if (b.isNormalPainted()) { - GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), normalColor); - } - } - }; + return new FieldButtonUI(); } }; addButton = new UIButton(ADD_ICON) { public ButtonUI getUI() { - - return new UIButtonUI() { - protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { - if (isPressed(b) && b.isPressedPainted()) { - GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), pressedColor); - } else if (isRollOver(b)) { - GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), hoverColor); - } else if (b.isNormalPainted()) { - GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), normalColor); - } - } - }; + return new FieldButtonUI(); } }; @@ -212,4 +186,17 @@ public class VanChartFieldButton extends JPanel { public void setSelectedState(boolean selected) { fieldButton.setSelected(selected); } + + private static class FieldButtonUI extends UIButtonUI { + + protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { + if (isPressed(b) && b.isPressedPainted()) { + GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles)); + } else if (isRollOver(b)) { + GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), HOVER_COLOR); + } else if (b.isNormalPainted()) { + GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); + } + } + } } From 2677b9c993a48966664d181995014102b1f337bf Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 18 Feb 2021 15:32:54 +0800 Subject: [PATCH 129/147] =?UTF-8?q?REPORT-47034=20FRM=E6=96=B0=E5=89=8D?= =?UTF-8?q?=E7=AB=AF&=E6=96=B0=E8=87=AA=E9=80=82=E5=BA=94=E5=90=88?= =?UTF-8?q?=E5=85=A5=E4=B8=BBJAR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/fr/design/preview/FormAdaptivePreviewTest.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {designer-form => designer-realize}/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java (100%) diff --git a/designer-form/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java b/designer-realize/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java similarity index 100% rename from designer-form/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java rename to designer-realize/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java From 8c7c2ac7f38240bb8489aa320fbad938c37e585b Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 18 Feb 2021 15:34:20 +0800 Subject: [PATCH 130/147] =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/preview/FormAdaptivePreviewTest.java | 2 -- 1 file changed, 2 deletions(-) rename {designer-realize => designer-form}/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java (86%) diff --git a/designer-realize/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java b/designer-form/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java similarity index 86% rename from designer-realize/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java rename to designer-form/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java index f3d1b5079..4972568b4 100644 --- a/designer-realize/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java +++ b/designer-form/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java @@ -1,7 +1,6 @@ package com.fr.design.preview; import com.fr.design.mainframe.JForm; -import com.fr.design.mainframe.JWorkBook; import com.fr.general.web.ParameterConstants; import org.easymock.EasyMock; import org.junit.Assert; @@ -25,6 +24,5 @@ public class FormAdaptivePreviewTest { public void testAccept() { FormAdaptivePreview formPreview = new FormAdaptivePreview(); Assert.assertTrue(formPreview.accept(EasyMock.mock(JForm.class))); - Assert.assertFalse(formPreview.accept(EasyMock.mock(JWorkBook.class))); } } From 6c1859aa9ce9cedf12a1089bbe275211ec7c6751 Mon Sep 17 00:00:00 2001 From: rinoux Date: Thu, 18 Feb 2021 15:44:43 +0800 Subject: [PATCH 131/147] =?UTF-8?q?REPORT-46915=20=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/data/datapane/ESDStrategyConfigPane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java index 1d2386b6c..fb0996e8d 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java @@ -11,7 +11,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.esd.common.CacheConstants; import com.fr.esd.core.strategy.config.StrategyConfig; import com.fr.esd.core.strategy.config.StrategyConfigHelper; -import com.fr.esd.util.Utils; +import com.fr.esd.util.ESDUtils; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; @@ -174,8 +174,8 @@ public class ESDStrategyConfigPane extends BasicBeanPane { List schemaTimes = new ArrayList<>(); String text = this.schemaTime.getText(); - if (Utils.checkUpdateTimeSchema(text)) { - if (Utils.isCronExpression(text)) { + if (ESDUtils.checkUpdateTimeSchema(text)) { + if (ESDUtils.isCronExpression(text)) { schemaTimes.add(text); } else { Collections.addAll(schemaTimes, text.split(",")); From 27de15b8bee0680845d1e3fec94f1159266996e5 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Fri, 19 Feb 2021 11:24:31 +0800 Subject: [PATCH 132/147] =?UTF-8?q?CHART-18102=20JXBrowser=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E8=AF=B7=E6=B1=82=E5=A2=9E=E5=8A=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/ui/Assistant.java | 14 ++++++++++++-- .../com/fr/design/editor/rich_editor.html | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/ui/Assistant.java b/designer-base/src/main/java/com/fr/design/ui/Assistant.java index 3962692c7..930aa32bb 100644 --- a/designer-base/src/main/java/com/fr/design/ui/Assistant.java +++ b/designer-base/src/main/java/com/fr/design/ui/Assistant.java @@ -6,14 +6,12 @@ import com.teamdev.jxbrowser.chromium.BrowserContext; import com.teamdev.jxbrowser.chromium.ProtocolService; import com.teamdev.jxbrowser.chromium.URLResponse; -import javax.activation.MimetypesFileTypeMap; import java.io.DataInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; /** * @author richie @@ -50,6 +48,18 @@ public class Assistant { if (path.endsWith(".svg")) { return "image/svg+xml"; } + if (path.endsWith(".png")) { + return "image/png"; + } + 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-chart/src/main/resources/com/fr/design/editor/rich_editor.html b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html index 3434e1ae3..c1d533e8d 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html +++ b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html @@ -3,8 +3,8 @@ - - + + From 5e2dc670648102dc290af23eb7fbbf4126e40638 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Fri, 19 Feb 2021 11:58:57 +0800 Subject: [PATCH 133/147] =?UTF-8?q?CHART-18066=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E7=BC=96=E8=BE=91=E5=99=A8=E5=B0=BA?= =?UTF-8?q?=E5=AF=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/component/richText/VanChartRichTextDialog.java | 2 +- .../chart/designer/component/richText/VanChartRichTextPane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java index 2cf7050dc..993c4bc2e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java @@ -10,7 +10,7 @@ import java.awt.Frame; public class VanChartRichTextDialog extends BasicDialog { - public static final Dimension DEFAULT = new Dimension(960, 600); + public static final Dimension DEFAULT = new Dimension(960, 800); public VanChartRichTextDialog(Frame parent, BasicPane pane) { super(parent, pane); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java index d2d0769ee..b6bce1145 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -20,7 +20,7 @@ public class VanChartRichTextPane extends BasicBeanPane { private static final int FIELD_PANE_H = 270; private static final int RICH_EDITOR_W = 940; - private static final int RICH_EDITOR_H = 260; + private static final int RICH_EDITOR_H = 460; private VanChartFieldListPane fieldListPane; private VanChartFieldAttrPane fieldAttrPane; From be9e766cdb0c45e0196375634b86e231f6c7c250 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 19 Feb 2021 15:17:07 +0800 Subject: [PATCH 134/147] =?UTF-8?q?REPORT-47516=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E9=94=81=E5=AE=9A-=E9=9B=86=E7=BE=A4=E5=8D=95=E8=8A=82?= =?UTF-8?q?=E7=82=B9=EF=BC=8C=E4=B8=A4=E4=B8=AA=E7=94=A8=E6=88=B7=E5=85=88?= =?UTF-8?q?=E5=90=8E=E8=BF=9B=E5=85=A5=EF=BC=8C=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E7=9A=84=E9=94=81=E5=AE=9A=E6=9C=89=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91?= =?UTF-8?q?=E4=B8=BB=E8=A6=81=E7=9A=84=E5=8E=9F=E5=9B=A0=E6=9C=89=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=EF=BC=8C=E4=B8=80=E6=98=AF=E5=BD=93=E6=97=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=90=8C=E5=AD=A6=E5=9C=A8=E9=9B=86=E7=BE=A4=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E4=B8=8A=E7=9A=84=E6=93=8D=E4=BD=9C=E4=B8=8D=E5=BD=93?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E4=BA=86=E7=94=A8=E6=88=B7lock=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=9C=A8ClientAliveChecker=E4=B8=AD=E7=9A=84check4Edi?= =?UTF-8?q?tLock=E6=96=B9=E6=B3=95=E6=8A=A5=E9=94=99=EF=BC=8C=E7=84=B6?= =?UTF-8?q?=E5=90=8E=E8=A2=AB=E8=AE=A4=E5=AE=9A=E6=88=90=E8=84=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=B8=85=E9=99=A4=E4=BA=86=EF=BC=9B=E4=BA=8C=E6=98=AF?= =?UTF-8?q?=E6=AD=A4=E5=89=8DuserIn=E5=92=8CuserBeat=E6=97=B6=E5=AD=98?= =?UTF-8?q?=E5=85=A5=E7=9A=84=E6=98=AFLockItem=E6=9E=9A=E4=B8=BE=E7=B1=BB?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=EF=BC=8C=E7=9B=B8=E5=BD=93=E4=BA=8E=E5=B8=B8?= =?UTF-8?q?=E9=87=8F=EF=BC=8C=E9=82=A3=E4=B9=88=E6=89=80=E6=9C=89=E7=94=A8?= =?UTF-8?q?=E6=88=B7beat=E5=90=8E=E5=AD=98=E5=85=A5=E7=9A=84=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E9=83=BD=E6=98=AF=E5=90=8C=E4=B8=80=E4=B8=AA=EF=BC=8C?= =?UTF-8?q?=E8=BF=99=E4=B8=AA=E6=98=AF=E9=80=BB=E8=BE=91=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E4=B8=94=E5=9C=A8=E9=9B=86=E7=BE=A4=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E4=B8=8A=E6=B5=8B=E8=AF=95=E7=9A=84=E8=BF=87=E7=A8=8B?= =?UTF-8?q?=E4=B8=AD=E8=BF=98=E5=8F=91=E7=8E=B0LockItem=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E7=9A=84=E5=BA=8F=E5=88=97=E5=8C=96=E6=9C=89=E4=BA=9B=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E4=BC=9A=E6=8A=A5=E9=94=99=20=E3=80=90?= =?UTF-8?q?=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91=E2=91=A0=E5=B0=86?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E5=AD=98=E5=85=A5=E7=9A=84ClientID-LockItem?= =?UTF-8?q?=E9=94=AE=E5=80=BC=E5=AF=B9=E4=BF=AE=E6=94=B9=E4=B8=BA=E5=AD=98?= =?UTF-8?q?=E5=85=A5ClientID-LockedFile=E9=94=AE=E5=80=BC=E5=AF=B9?= =?UTF-8?q?=EF=BC=8CLockedFile=E6=98=AF=E4=B8=80=E4=B8=AA=E7=BB=A7?= =?UTF-8?q?=E6=89=BF=E4=BA=86HashSet=E7=9A=84=E7=B1=BB=EF=BC=8C=E9=87=8C?= =?UTF-8?q?=E9=9D=A2=E6=9C=89birth=E5=92=8Cbeat=E7=9A=84=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E5=A4=A9=E7=84=B6=E5=AE=9E=E7=8E=B0=E4=BA=86=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8C=96=E6=8E=A5=E5=8F=A3=EF=BC=8C=E6=98=AF=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E9=94=81=E5=AE=9A=E9=82=A3=E8=BE=B9=E5=86=99=E7=9A=84?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E7=B1=BB=EF=BC=8C=E8=BF=99=E8=BE=B9=E5=B0=B1?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E6=8B=BF=E6=9D=A5=E7=94=A8=E4=BA=86=EF=BC=9B?= =?UTF-8?q?=E2=91=A1=E5=B0=86EditLock=E5=92=8C=E6=A8=A1=E6=9D=BF=E9=94=81?= =?UTF-8?q?=E5=AE=9A=E7=9A=84=E4=B8=80=E4=BA=9B=E9=80=BB=E8=BE=91=E5=88=86?= =?UTF-8?q?=E7=A6=BB=E4=BA=86=E4=B8=80=E4=B8=8B=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E8=BF=87=E5=A4=9A=E8=80=A6=E5=90=88=EF=BC=9B=E2=91=A2=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E6=B5=8B=E8=AF=95=E7=9A=84=E6=97=B6=E5=80=99=E8=BF=98?= =?UTF-8?q?=E5=8F=91=E7=8E=B0=E6=95=B0=E6=8D=AE=E9=9B=86=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=A1=B5=E4=B8=8B=E7=9A=84=E6=8F=90=E7=A4=BA=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E4=BC=9A=E5=87=BA=E7=8E=B0=E4=BA=8C=E7=BA=A7=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E5=9B=A0=E6=AD=A4=E5=9C=A8EditLockU?= =?UTF-8?q?tils=E4=B8=AD=E6=B7=BB=E5=8A=A0=E4=BA=86=E4=B8=AAapi=E7=94=A8?= =?UTF-8?q?=E4=BA=8E=E4=BC=A0=E5=85=A5=E7=88=B6=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/ConnectionComboBoxPanel.java | 2 +- .../src/main/java/com/fr/design/editlock/EditLockUtils.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index d441984c2..db72768cb 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -128,7 +128,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { boolean actionLock = EditLockUtils.lock(LockItem.CONNECTION); if (!actionLock) { // 锁定失败,代表已经被其他用户锁定,跳出弹窗提示 - EditLockUtils.showLockMessage(); + EditLockUtils.showLockMessage(this); return; } // 锁定成功,执行后续操作 diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java index 4f332a170..49b1a85ce 100644 --- a/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java @@ -13,6 +13,8 @@ import org.jetbrains.annotations.Nullable; import javax.swing.Icon; import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; +import java.awt.Component; import java.awt.Image; /** @@ -65,6 +67,10 @@ public class EditLockUtils { FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), EditLockUtils.LOCKED_MESSAGE, EditLockUtils.TOOLTIPS, JOptionPane.INFORMATION_MESSAGE, EditLockUtils.TOOLTIPS_ICON); } + public static void showLockMessage(Component parentComponent) { + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(parentComponent), EditLockUtils.LOCKED_MESSAGE, EditLockUtils.TOOLTIPS, JOptionPane.INFORMATION_MESSAGE, EditLockUtils.TOOLTIPS_ICON); + } + public static boolean lock(LockItem lockItem) { return WorkContext.getCurrent().get(EditLockOperator.class).lock(lockItem); } From 3e79b082ee7e07e9889ee29c062b7f2ad72df1e0 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Fri, 19 Feb 2021 20:21:28 +0800 Subject: [PATCH 135/147] =?UTF-8?q?CHART-18255=20=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E9=BB=98=E8=AE=A4=E5=AD=97=E6=AE=B5=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E4=B8=8D=E9=9C=80=E8=A6=81=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=8D=A2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/com/fr/design/editor/rich_editor.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html index c1d533e8d..197b2ed42 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html +++ b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html @@ -47,8 +47,7 @@ var getInitContent = function (params, initParams, align) { var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); var paramGroup = params.split("|"); - - content = ""; + var content = ""; for (var i = 0, len = paramGroup.length; i < len; i++) { var [key, value] = paramGroup[i].split(":"); @@ -58,6 +57,10 @@ } } + if (BI.endWith(content, '

')) { + content = content.slice(0, -8) + '

'; + } + return content; } From 8477071a6e6ca01e8abfea32c38bb9d7ad2c2780 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Fri, 19 Feb 2021 21:44:11 +0800 Subject: [PATCH 136/147] =?UTF-8?q?CHART-18257=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=BB=84=E5=90=88=E5=9B=BE=E7=9A=84=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 947c63684..3c4cbf70c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -384,7 +384,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); VanChartRichTextPane richTextPane = this.createRichTextPane(richEditorPane); @@ -456,15 +456,19 @@ public class VanChartTooltipContentPane extends BasicBeanPane params) { List tableFieldNames = VanChartRichEditorPane.getFieldNames(); - if (tableFieldNames != null) { + if (tableFieldNames != null && params != null) { for (String fieldName : tableFieldNames) { params.put(fieldName, "${" + fieldName + "_" + fieldName.hashCode() + "}"); } } - - richText.setParams(params); } private JPanel createHtmlPane() { From 8d8566843cf8ad6c2b11584112ca519d9cfec0c7 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sat, 20 Feb 2021 11:10:05 +0800 Subject: [PATCH 137/147] =?UTF-8?q?CHART-18103=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E5=AD=97=E4=BD=93=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/com/fr/design/editor/rich_editor.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html index 197b2ed42..08e2437ad 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html +++ b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html @@ -86,7 +86,10 @@ toolbar: { buttons: [ {type: "bi.rich_editor_font_chooser"}, - {type: "bi.rich_editor_size_chooser"}, + { + type: "bi.rich_editor_size_chooser", + width: 70 + }, {type: "bi.rich_editor_bold_button"}, {type: "bi.rich_editor_italic_button"}, {type: "bi.rich_editor_underline_button"}, From e80c07a48207983a1ff117503910979f1179e3cc Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 20 Feb 2021 12:02:10 +0800 Subject: [PATCH 138/147] =?UTF-8?q?REPORT-46723=20=E5=A1=AB=E6=8A=A5?= =?UTF-8?q?=E6=99=BA=E8=83=BD=E6=B7=BB=E5=8A=A0=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../submit/SmartInsertDBManipulationPane.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java index d306bb179..12c610534 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java @@ -310,9 +310,9 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { // 单元格组要记录下之前的选中情况 private CellSelection oriCellSelection = null; - private List newAdd = new ArrayList(); + private List newAdd = new ArrayList<>(); - private List oldAdd = new ArrayList(); + private List oldAdd = new ArrayList<>(); public SmartJTablePane4DB(KeyColumnTableModel model, ElementCasePane actionReportPane) { this(model, actionReportPane, false); @@ -433,7 +433,8 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { if (!allColumnRow.contains(columnRow.toString())) { add.addColumnRow(columnRow); } - + // 重新更换区域框选单元格后 清理历史框选 + oldAdd.clear(); } if (add.getSize() > 0) { @@ -462,7 +463,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { if (!newAdd.contains(value) && !allColumnRow.contains(value)) { add.addColumnRow(ColumnRow.valueOf(value)); } - newAdd.add(value); + newAdd.add(ColumnRow.valueOf(value)); } if (cellElement == null) { @@ -470,16 +471,14 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { if (!allColumnRow.contains(columnRow.toString())) { add.addColumnRow(columnRow); } - newAdd.add(columnRow.toString()); + newAdd.add(columnRow); } } } - int oldSize = oldAdd.size(); - int newSize = newAdd.size(); - if (oldSize > newSize && oldAdd.containsAll(newAdd)) { - int diff = oldSize - newSize; - newValue.splice(newValue.getSize() - diff, diff); - } + // 计算出前后两次选中的差值 + oldAdd.removeAll(newAdd); + // 移除差值部分 + newValue.removeAll(oldAdd); oldAdd.clear(); oldAdd.addAll(newAdd); } From 5c92f84c8fa9528c7f8caf9285bea30193246f03 Mon Sep 17 00:00:00 2001 From: rinoux Date: Sat, 20 Feb 2021 13:39:32 +0800 Subject: [PATCH 139/147] =?UTF-8?q?REPORT-48124=20=E5=86=85=E7=BD=AE?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=8F=92=E4=BB=B6=E6=BC=8F=E6=8E=89=E4=BA=86?= =?UTF-8?q?=E5=85=B6=E5=AE=83=E6=8F=90=E4=BA=A4&=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E6=94=B9=E4=B8=AA=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/tabledata/tabledatapane/DBTableDataPane.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index a570f1da1..8b1eef0c3 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -238,7 +238,7 @@ public class DBTableDataPane extends AbstractTableDataPane { } - private void refresh() { + private void refreshParameters() { String[] paramTexts = new String[2]; paramTexts[0] = SqlUtils.tryPureSqlText(this.sqlTextPane.getText()); paramTexts[1] = SqlUtils.tryPureSqlText(this.pageQuery); @@ -382,7 +382,7 @@ public class DBTableDataPane extends AbstractTableDataPane { return; } - refresh(); + refreshParameters(); } @@ -487,6 +487,9 @@ public class DBTableDataPane extends AbstractTableDataPane { } + // 保存前 刷新下参数列表 保证获取到最新的参数 + refreshParameters(); + List parameterList = this.editorPane.update(); ParameterProvider[] parameters = parameterList.toArray(new ParameterProvider[0]); @@ -511,7 +514,7 @@ public class DBTableDataPane extends AbstractTableDataPane { @Override public void actionPerformed(ActionEvent e) { - DBTableDataPane.this.refresh(); + DBTableDataPane.this.refreshParameters(); } From 3138498b54aff1b0af7e8dd7812d7b2ad8bad716 Mon Sep 17 00:00:00 2001 From: rinoux Date: Sat, 20 Feb 2021 13:58:36 +0800 Subject: [PATCH 140/147] update --- .../data/tabledata/tabledatapane/DBTableDataPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index 8b1eef0c3..16b7e9fa1 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -36,6 +36,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; +import com.fr.design.utils.ParameterUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.esd.core.strategy.config.StrategyConfig; import com.fr.esd.core.strategy.config.StrategyConfigHelper; @@ -213,7 +214,7 @@ public class DBTableDataPane extends AbstractTableDataPane { box.setMinimumSize(new Dimension(300, 400)); - this.connectionTableProcedurePane.setMinimumSize(new Dimension(250, 400)); + this.connectionTableProcedurePane.setMinimumSize(new Dimension(230, 400)); this.connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400)); JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, this.connectionTableProcedurePane, sqlSplitPane); @@ -243,9 +244,9 @@ public class DBTableDataPane extends AbstractTableDataPane { paramTexts[0] = SqlUtils.tryPureSqlText(this.sqlTextPane.getText()); paramTexts[1] = SqlUtils.tryPureSqlText(this.pageQuery); List existParameterList = this.editorPane.update(); - Parameter[] ps = (existParameterList == null) ? new Parameter[0] : (Parameter[]) existParameterList.toArray(new Parameter[0]); + Parameter[] ps = (existParameterList == null) ? new Parameter[0] : existParameterList.toArray(new Parameter[0]); - this.editorPane.populate(ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps)); + this.editorPane.populate(ParameterUtils.analyzeAndUnionParameters(paramTexts, ps)); } From 82b2c8065a9a48f5ef314eca4397aedfe324b62a Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 20 Feb 2021 16:58:27 +0800 Subject: [PATCH 141/147] =?UTF-8?q?REPORT-46723=20=E5=A1=AB=E6=8A=A5?= =?UTF-8?q?=E6=99=BA=E8=83=BD=E6=B7=BB=E5=8A=A0=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E7=BB=84=20=E9=81=97=E6=BC=8F=E4=B8=80=E4=B8=AA=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=9D=A1=E4=BB=B6=E7=9A=84=E5=90=8C=E6=AD=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/write/submit/SmartInsertDBManipulationPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java index 12c610534..3fe126879 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java @@ -460,10 +460,11 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { TemplateCellElement cellElement = ePane.getEditingElementCase().getTemplateCellElement(c + i, r + j); if (cellElement != null && ((i + c) != 0 || (r + j) != 0)) { String value = cellElement.toString(); - if (!newAdd.contains(value) && !allColumnRow.contains(value)) { - add.addColumnRow(ColumnRow.valueOf(value)); + ColumnRow columnRow = ColumnRow.valueOf(value); + if (!newAdd.contains(columnRow) && !allColumnRow.contains(value)) { + add.addColumnRow(columnRow); } - newAdd.add(ColumnRow.valueOf(value)); + newAdd.add(columnRow); } if (cellElement == null) { From a1335766f0c6d9b15f7a75aa4e960fe0f364bb59 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 21 Feb 2021 14:01:49 +0800 Subject: [PATCH 142/147] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E7=BB=84=E4=BB=B6=E9=97=B4=E8=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/com/fr/design/editor/script/editor.js | 6 ++++-- .../resources/com/fr/design/editor/script/editor.model.js | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js index a2b5dd6a7..3786e47ef 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js @@ -50,12 +50,14 @@ }, items: [{ type: "bi.htape", - tgap: 5, + tgap: 3, items: [{ type: "bi.label", text: BI.i18nText("BI-Design_Font_Style") + ": ", textAlign: "left", - width: 70 + width: 60, + tgap: 2, + lgap: 3 }, { type: "bi.button_group", items: this.model.fontStyleItems, diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js index c901fd31e..e1ee49645 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js @@ -18,7 +18,6 @@ return [{ type: "bi.single_select_radio_item", text: BI.i18nText("BI-Basic_Auto"), - hgap: 5, width: 50, logic: { dynamic: true @@ -28,7 +27,6 @@ }, { type: "bi.single_select_radio_item", text: BI.i18nText("BI-Basic_Custom"), - hgap: 5, width: 60, logic: { dynamic: true From 1b271beae8c31369a0fc9886c2c6fbb317926826 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 21 Feb 2021 23:11:34 +0800 Subject: [PATCH 143/147] =?UTF-8?q?CHART-18112=20=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E7=BB=84=E4=BB=B6=E6=96=B0=E5=BB=BA=E5=92=8C=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E5=90=8E=E9=80=89=E4=B8=AD=E6=9C=80=E5=90=8E=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=85=83=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/editor/rich_editor.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html index 08e2437ad..6df5a29a1 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html +++ b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html @@ -64,6 +64,18 @@ return content; } + var selectLast = function (instance) { + if (instance == null) { + return; + } + + var target = instance.selElm() + + if (target) { + instance.selected({target}); + } + }; + var dimensionIds = getDimensionIds(params); if (initParams) { @@ -110,6 +122,8 @@ } }); + selectLast(rich_editor.editor.instance); + Pool.refresh = function () { var content = Pool.data.getContent(); var isAuto = Pool.data.isAuto(); @@ -130,6 +144,8 @@ }); rich_editor.setFocus(); + + selectLast(rich_editor.editor.instance); }; Pool.addField = function () { From 48945145e62358b38e3691d0310367602160ad40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 22 Feb 2021 11:14:38 +0800 Subject: [PATCH 144/147] =?UTF-8?q?CHART-18270=20=E7=82=B9=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E5=9B=BE=E7=89=87=E7=9A=84=E5=AE=BD=E9=AB=98=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0px=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/component/marker/VanChartImageMarkerPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java index 5e05305ca..d28354bdb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java @@ -4,6 +4,7 @@ import com.fr.base.background.ImageFileBackground; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; @@ -30,8 +31,8 @@ public class VanChartImageMarkerPane extends BasicBeanPane { public VanChartImageMarkerPane() { imageBackgroundPane = new ImageBackgroundQuickPane(false); imageBackgroundPane.setPreferredSize(getImageBackgroundPreferredSize(imageBackgroundPane.getPreferredSize())); - width = new UISpinner(0, 100, 0.5, 30); - height = new UISpinner(0, 100, 0.5, 30); + width = new UISpinnerWithPx(0, 100, 0.5, 30); + height = new UISpinnerWithPx(0, 100, 0.5, 30); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; From 8d1d3dabfb7ffa2efbd9cfe09239df675cbda80d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 23 Feb 2021 11:32:07 +0800 Subject: [PATCH 145/147] =?UTF-8?q?CHART-18309=20=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E5=9B=BE=E9=9D=A2=E6=9D=BF=E8=BE=B9=E6=A1=86=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/structure/desinger/style/StructureNodeStylePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java index 333646c3c..be2f5ff3e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java @@ -52,7 +52,7 @@ public class StructureNodeStylePane extends BasicBeanPane { protected Component[][] getPaneComponents() { return new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Node_Radius")), typeComboBox}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Color")), typeComboBox}, new Component[]{null, centerPane}, }; } From 07c48910f14f3f27906ddc548550b56c5048d1c7 Mon Sep 17 00:00:00 2001 From: Yvan Date: Tue, 23 Feb 2021 15:14:30 +0800 Subject: [PATCH 146/147] =?UTF-8?q?REPORT-47782=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-=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E7=95=8C=E9=9D=A2=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=8C=89=E9=92=AE=EF=BC=8C=E9=BC=A0=E6=A0=87?= =?UTF-8?q?=E6=82=AC=E6=B5=AE=E6=97=B6=E7=9A=84=E6=8F=90=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E5=AF=B9=20=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0?= =?UTF-8?q?=E3=80=91=E6=95=B0=E6=8D=AE=E9=9B=86=E6=9F=A5=E8=AF=A2=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BB=A5=E5=8F=8A=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E9=A1=B5=E9=9D=A2=E4=B8=AD=E7=9A=84=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=AD=A3=E5=B8=B8=E7=8A=B6=E6=80=81=E4=B8=8B=E6=B2=A1?= =?UTF-8?q?=E6=9C=89tooltips=EF=BC=8C=E4=BD=86=E6=98=AFUILockButton?= =?UTF-8?q?=E5=9C=A8=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E4=BC=9A=E4=BC=A0=E5=85=A5=E4=B8=80=E4=B8=AA=E7=A9=BA=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=EF=BC=8C=E5=AF=BC=E8=87=B4=E4=BC=9A=E6=9C=89?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=B0=8F=E6=96=B9=E6=A0=BC=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=87=BA=E6=9D=A5=20=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D?= =?UTF-8?q?=E8=B7=AF=E3=80=91=E6=8A=8A=E5=88=9D=E5=A7=8B=E5=8C=96=E4=BC=A0?= =?UTF-8?q?=E5=85=A5=E7=9A=84=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BAnull=EF=BC=8CsetTooltipsText=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E4=B8=AD=E4=BC=9A=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E4=B8=BAnull,=E5=A6=82=E6=9E=9C=E6=98=AFnull=E5=B0=B1=E4=BC=9A?= =?UTF-8?q?=E6=8A=8Atooltips=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/connect/ConnectionComboBoxPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index db72768cb..1ce37b4c5 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -71,7 +71,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { EditLockUtils.CONNECTION_LOCKED_ICON, IconUtils.readIcon("/com/fr/design/images/m_web/connection"), EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, - StringUtils.EMPTY + null ); editButton.setPreferredSize(buttonSize); editButton.addActionListener(new ActionListener() { From b4593d108658c2585d7271a88c1aa6e50df0b99b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Tue, 23 Feb 2021 17:39:50 +0800 Subject: [PATCH 147/147] merge code --- build.gradle | 1 - .../com/fr/design/DesignModelAdapter.java | 94 +- .../actions/file/BatchCompileAction.java | 47 - .../actions/server/LocalAnalyzerAction.java | 49 - .../data/DesignerStrategyConfigUtils.java | 154 -- .../data/datapane/ESDStrategyConfigPane.java | 225 -- .../data/datapane/TableDataTreePane.java | 766 ++----- .../tabledatapane/DBTableDataPane.java | 504 ++-- .../gui/itree/filetree/FileTreeIcon.java | 12 - .../com/fr/design/mainframe/JTemplate.java | 22 +- .../mainframe/vcs/common/VcsHelper.java | 1 - .../fr/design/preview/PagePlusPreview.java | 41 - .../java/com/fr/file/FILEChooserPane.java | 1 - .../cptx/io/DesignReadWritableProvider.java | 60 - .../monitor/DesignerMetricRecorder.java | 97 - .../app/designer/toolbar/CompileAction.java | 116 - .../designer/toolbar/TemplateTransformer.java | 221 -- .../app/designer/toolbar/TransformResult.java | 55 - .../designer/toolbar/TransformResultInfo.java | 64 - .../transform/BatchTransformProgress.java | 25 - .../transform/BatchTransformUtil.java | 25 - .../designer/transform/BatchTransformer.java | 71 - .../designer/transform/UpdateCallBack.java | 22 - .../transform/ui/BatchTransformDialog.java | 61 - .../transform/ui/BatchTransformPane.java | 223 -- .../ui/PrepareTransformFileList.java | 79 - .../transform/ui/TransformFileTree.java | 204 -- .../transform/ui/TransformPreparePane.java | 130 -- .../transform/ui/TransformResultList.java | 70 - .../transform/ui/TransformResultPane.java | 110 - .../ui/UIListControlCellRenderer.java | 86 - .../transform/ui/UpdateProgressDialog.java | 70 - .../transform/ui/UpdateProgressPane.java | 72 - .../designer/utils/CompileTransformUtil.java | 55 - .../designer/utils/DesignerCptxFileUtils.java | 79 - .../com/fr/design/images/bbs/bbs_normal.svg | 2 +- .../images/buttonicon/prewidget_normal.svg | 8 - .../buttonicon/widget/files_up_normal.svg | 7 - .../images/control/addPopup_disabled.svg | 16 - .../design/images/control/addPopup_normal.svg | 14 - .../design/images/control/batch_esd_off.png | Bin 1286 -> 0 bytes .../fr/design/images/control/batch_esd_on.png | Bin 1275 -> 0 bytes .../design/images/control/edit_disabled.svg | 8 - .../fr/design/images/control/edit_normal.svg | 8 - .../design/images/control/remove_disabled.svg | 11 - .../design/images/control/remove_normal.svg | 9 - .../design/images/m_file/preview_disabled.svg | 11 - .../design/images/m_file/preview_normal.svg | 9 - .../toolbar/TemplateTransformerDebugTest.java | 239 -- .../toolbar/TemplateTransformerTest.java | 85 - .../toolbar/TransformResultInfoTest.java | 32 - .../transform/BatchTransformProgressTest.java | 27 - .../transform/BatchTransformUtilTest.java | 35 - .../transform/BatchTransformerTest.java | 124 - .../utils/CompileTransformUtilTest.java | 58 - .../component/VanChartTooltipContentPane.java | 11 +- .../fr/design/actions/FormFitAttrAction.java | 83 - .../actions/NewFormMobileAttrAction.java | 115 - .../design/designer/beans/LayoutAdapter.java | 2 +- .../design/designer/creator/XChartEditor.java | 3 - .../designer/creator/XWAbsoluteLayout.java | 6 +- .../design/designer/creator/XWFitLayout.java | 4 +- .../fr/design/fit/DesignerUIModeConfig.java | 124 - .../com/fr/design/fit/FitStateCompatible.java | 36 - .../java/com/fr/design/fit/JFormType.java | 133 -- .../main/java/com/fr/design/fit/NewJForm.java | 285 --- .../src/main/java/com/fr/design/fit/PX.java | 27 - .../com/fr/design/fit/PXReportLengthUNIT.java | 32 - .../ElementEditorExtendDefinePane.java | 91 - .../FRAbsoluteBodyLayoutExtendDefinePane.java | 161 -- .../FRAbsoluteLayoutExtendDefinePane.java | 27 - .../attrpane/FRFitLayoutExtendDefinePane.java | 246 -- .../fit/attrpane/PcFitExpandablePane.java | 107 - .../attrpane/RootDesignExtendDefinePane.java | 303 --- .../design/fit/common/AdaptiveSwitchUtil.java | 225 -- .../com/fr/design/fit/common/BaseUtils.java | 1266 ---------- .../design/fit/common/FormDesignerUtil.java | 45 - .../com/fr/design/fit/common/LayoutTool.java | 177 -- .../fr/design/fit/common/NewFormStyle.java | 2030 ----------------- .../com/fr/design/fit/common/PaintUtils.java | 835 ------- .../fr/design/fit/common/TemplateTool.java | 214 -- .../fit/menupane/BrowserFitAttrPane.java | 303 --- .../design/fit/menupane/FitPreviewPane.java | 76 - .../fr/design/fit/menupane/FitRadioGroup.java | 80 - .../design/fit/menupane/FontRadioGroup.java | 17 - .../design/fit/menupane/FormFitAttrPane.java | 58 - .../fr/design/fit/toolbar/SwitchAction.java | 287 --- .../fr/design/mainframe/CoverReportPane.java | 4 +- .../mainframe/EditingMouseListener.java | 16 +- .../com/fr/design/mainframe/FormArea.java | 28 +- .../com/fr/design/mainframe/FormDesigner.java | 3 +- .../fr/design/mainframe/FormModelAdapter.java | 23 +- .../fr/design/preview/DeveloperPreview.java | 53 - .../design/preview/FormAdaptivePreview.java | 54 - .../design/form/images/developer_preview.png | Bin 542 -> 0 bytes .../form/images/developer_preview24.png | Bin 862 -> 0 bytes .../fr/design/form/images/icon_form_tab.png | Bin 130 -> 0 bytes .../com/fr/design/form/images/icon_switch.png | Bin 304 -> 0 bytes .../form/images/icon_switch_disable.png | Bin 296 -> 0 bytes .../design/form/images/icon_switch_new_ui.png | Bin 413 -> 0 bytes .../design/form/images/icon_switch_old_ui.png | Bin 417 -> 0 bytes .../com/fr/design/form/images/loading.png | Bin 7641 -> 0 bytes .../fr/design/fit/FitStateCompatibleTest.java | 24 - .../fr/design/fit/FormUIModeConfigTest.java | 22 - .../fr/design/fit/PXReportLengthUNITTest.java | 49 - .../test/java/com/fr/design/fit/PXTest.java | 64 - .../fit/common/FormDesignerUtilTest.java | 38 - .../design/preview/DeveloperPreviewTest.java | 28 - .../preview/FormAdaptivePreviewTest.java | 28 - .../columnrow/ColumnRowSizingAction.java | 7 +- .../java/com/fr/design/condition/WHPane.java | 10 +- .../fit/AdaptiveCellElementPainter.java | 27 - .../design/fit/grid/AdaptiveGridListener.java | 123 - .../design/fit/grid/ElementCasePaneUtil.java | 186 -- .../grid/GridHeaderWithBoundMouseHandler.java | 70 - .../fit/grid/GridLimitColumnMouseHandler.java | 194 -- .../fit/grid/GridLimitRowMouseHandler.java | 190 -- .../fit/grid/NewFormDesignerGridUI.java | 190 -- .../fr/design/mainframe/ElementCasePane.java | 9 +- .../com/fr/design/mainframe/JWorkBook.java | 4 +- .../mainframe/WorkBookModelAdapter.java | 35 +- .../mainframe/app/DesignerAppActivator.java | 3 +- .../settingpane/CellExpandExtraAttrPane.java | 20 +- .../form/FormElementCaseDesigner.java | 4 - .../submit/SmartInsertDBManipulationPane.java | 26 +- .../grid/AbstractGridHeaderMouseHandler.java | 9 +- .../com/fr/grid/DefaultGridUIProcessor.java | 10 +- .../src/main/java/com/fr/grid/GridColumn.java | 27 +- .../com/fr/grid/GridColumnMouseHandler.java | 4 + .../main/java/com/fr/grid/GridColumnUI.java | 7 +- .../src/main/java/com/fr/grid/GridCorner.java | 3 +- .../src/main/java/com/fr/grid/GridHeader.java | 3 +- .../java/com/fr/grid/GridMouseAdapter.java | 3 +- .../src/main/java/com/fr/grid/GridRow.java | 18 +- .../src/main/java/com/fr/grid/GridRowUI.java | 8 +- .../src/main/java/com/fr/grid/GridUtils.java | 5 +- .../java/com/fr/nx/app/designer/CptxApp.java | 53 - .../com/fr/nx/app/designer/JStreamBook.java | 117 - .../com/fr/nx/app/designer/StartupAssist.java | 75 - .../app/designer/cell/CellTreeAttrPanel.java | 109 - .../cell/CellTreeAttrPanelProvider.java | 30 - .../designer/menu/CalculateAttrAction.java | 76 - .../app/designer/menu/CalculateAttrPane.java | 200 -- .../app/designer/menu/FeatureFlagsPanel.java | 73 - .../designer/menu/bean/FeatureFlagBean.java | 36 - .../main/java/com/fr/start/MainDesigner.java | 2 - .../fr/start/module/DesignerActivator.java | 15 +- .../com/fr/nx/app/designer/CptxAppTest.java | 54 - .../fr/nx/app/designer/JStreamBookTest.java | 121 - .../resources/cpt/read-write-expand-order.cpt | 79 - .../resources/cpt/read-write-image-ref.cpt | 78 - 151 files changed, 568 insertions(+), 14203 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/actions/file/BatchCompileAction.java delete mode 100644 designer-base/src/main/java/com/fr/design/actions/server/LocalAnalyzerAction.java delete mode 100644 designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java delete mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java delete mode 100644 designer-base/src/main/java/com/fr/design/preview/PagePlusPreview.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/cptx/io/DesignReadWritableProvider.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/monitor/DesignerMetricRecorder.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/toolbar/CompileAction.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TemplateTransformer.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResult.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResultInfo.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformProgress.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformUtil.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformer.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/UpdateCallBack.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformDialog.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformPane.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/PrepareTransformFileList.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformPreparePane.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultList.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultPane.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UIListControlCellRenderer.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressDialog.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressPane.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/utils/CompileTransformUtil.java delete mode 100644 designer-base/src/main/java/com/fr/nx/app/designer/utils/DesignerCptxFileUtils.java delete mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/prewidget_normal.svg delete mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/files_up_normal.svg delete mode 100644 designer-base/src/main/resources/com/fr/design/images/control/addPopup_disabled.svg delete mode 100644 designer-base/src/main/resources/com/fr/design/images/control/addPopup_normal.svg delete mode 100644 designer-base/src/main/resources/com/fr/design/images/control/batch_esd_off.png delete mode 100644 designer-base/src/main/resources/com/fr/design/images/control/batch_esd_on.png delete mode 100644 designer-base/src/main/resources/com/fr/design/images/control/edit_disabled.svg delete mode 100644 designer-base/src/main/resources/com/fr/design/images/control/edit_normal.svg delete mode 100644 designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg delete mode 100644 designer-base/src/main/resources/com/fr/design/images/control/remove_normal.svg delete mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg delete mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/preview_normal.svg delete mode 100644 designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerDebugTest.java delete mode 100644 designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerTest.java delete mode 100644 designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TransformResultInfoTest.java delete mode 100644 designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformProgressTest.java delete mode 100644 designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformUtilTest.java delete mode 100644 designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformerTest.java delete mode 100644 designer-base/src/test/java/com/fr/nx/app/designer/utils/CompileTransformUtilTest.java delete mode 100644 designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java delete mode 100644 designer-form/src/main/java/com/fr/design/actions/NewFormMobileAttrAction.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/DesignerUIModeConfig.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/FitStateCompatible.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/JFormType.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/NewJForm.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/PX.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/PXReportLengthUNIT.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/attrpane/ElementEditorExtendDefinePane.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteBodyLayoutExtendDefinePane.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteLayoutExtendDefinePane.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/attrpane/FRFitLayoutExtendDefinePane.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/attrpane/PcFitExpandablePane.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/attrpane/RootDesignExtendDefinePane.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/common/BaseUtils.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/common/FormDesignerUtil.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/common/LayoutTool.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/common/NewFormStyle.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/common/PaintUtils.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/menupane/BrowserFitAttrPane.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/menupane/FitPreviewPane.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/menupane/FitRadioGroup.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/menupane/FontRadioGroup.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/menupane/FormFitAttrPane.java delete mode 100644 designer-form/src/main/java/com/fr/design/fit/toolbar/SwitchAction.java delete mode 100644 designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java delete mode 100644 designer-form/src/main/java/com/fr/design/preview/FormAdaptivePreview.java delete mode 100755 designer-form/src/main/resources/com/fr/design/form/images/developer_preview.png delete mode 100755 designer-form/src/main/resources/com/fr/design/form/images/developer_preview24.png delete mode 100755 designer-form/src/main/resources/com/fr/design/form/images/icon_form_tab.png delete mode 100644 designer-form/src/main/resources/com/fr/design/form/images/icon_switch.png delete mode 100755 designer-form/src/main/resources/com/fr/design/form/images/icon_switch_disable.png delete mode 100755 designer-form/src/main/resources/com/fr/design/form/images/icon_switch_new_ui.png delete mode 100755 designer-form/src/main/resources/com/fr/design/form/images/icon_switch_old_ui.png delete mode 100644 designer-form/src/main/resources/com/fr/design/form/images/loading.png delete mode 100644 designer-form/src/test/java/com/fr/design/fit/FitStateCompatibleTest.java delete mode 100644 designer-form/src/test/java/com/fr/design/fit/FormUIModeConfigTest.java delete mode 100644 designer-form/src/test/java/com/fr/design/fit/PXReportLengthUNITTest.java delete mode 100644 designer-form/src/test/java/com/fr/design/fit/PXTest.java delete mode 100644 designer-form/src/test/java/com/fr/design/fit/common/FormDesignerUtilTest.java delete mode 100644 designer-form/src/test/java/com/fr/design/preview/DeveloperPreviewTest.java delete mode 100644 designer-form/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java delete mode 100644 designer-realize/src/main/java/com/fr/design/fit/AdaptiveCellElementPainter.java delete mode 100644 designer-realize/src/main/java/com/fr/design/fit/grid/AdaptiveGridListener.java delete mode 100644 designer-realize/src/main/java/com/fr/design/fit/grid/ElementCasePaneUtil.java delete mode 100644 designer-realize/src/main/java/com/fr/design/fit/grid/GridHeaderWithBoundMouseHandler.java delete mode 100644 designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitColumnMouseHandler.java delete mode 100644 designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitRowMouseHandler.java delete mode 100644 designer-realize/src/main/java/com/fr/design/fit/grid/NewFormDesignerGridUI.java delete mode 100644 designer-realize/src/main/java/com/fr/nx/app/designer/CptxApp.java delete mode 100644 designer-realize/src/main/java/com/fr/nx/app/designer/JStreamBook.java delete mode 100644 designer-realize/src/main/java/com/fr/nx/app/designer/StartupAssist.java delete mode 100644 designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanel.java delete mode 100644 designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanelProvider.java delete mode 100644 designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrAction.java delete mode 100644 designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrPane.java delete mode 100644 designer-realize/src/main/java/com/fr/nx/app/designer/menu/FeatureFlagsPanel.java delete mode 100644 designer-realize/src/main/java/com/fr/nx/app/designer/menu/bean/FeatureFlagBean.java delete mode 100644 designer-realize/src/test/java/com/fr/nx/app/designer/CptxAppTest.java delete mode 100644 designer-realize/src/test/java/com/fr/nx/app/designer/JStreamBookTest.java delete mode 100644 designer-realize/src/test/resources/cpt/read-write-expand-order.cpt delete mode 100644 designer-realize/src/test/resources/cpt/read-write-image-ref.cpt diff --git a/build.gradle b/build.gradle index 8399410db..617b9d0fa 100644 --- a/build.gradle +++ b/build.gradle @@ -73,7 +73,6 @@ allprojects { implementation 'com.fr.decision:fine-decision:' + frVersion implementation 'com.fr.schedule:fine-schedule:' + frVersion implementation 'com.fr.report:engine-report:' + frDevVersion - implementation 'com.fr.report:engine-x:' + frDevVersion implementation 'com.fr.report:engine-chart:' + frDevVersion implementation 'com.fr.report:engine-i18n:' + frDevVersion implementation 'com.fr.design:design-i18n:' + frDevVersion diff --git a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java index 24dd31484..e5930ee91 100644 --- a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java @@ -1,8 +1,11 @@ package com.fr.design; import com.fr.base.Parameter; +import com.fr.base.ParameterConfig; +import com.fr.base.TableData; import com.fr.base.io.BaseBook; import com.fr.data.TableDataSource; +import com.fr.data.operator.DataOperator; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; @@ -11,9 +14,14 @@ import com.fr.form.ui.DataControl; import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.Filter; +import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; import com.fr.stable.js.WidgetName; +import com.fr.util.ParameterApplyHelper; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -40,7 +48,7 @@ public abstract class DesignModelAdapter tableDataParametersMap = new HashMap<>(); + + public DesignModelAdapter(S jTemplate) { this.jTemplate = jTemplate; @@ -241,6 +255,79 @@ public abstract class DesignModelAdapter map, Filter filter) { + Iterator it = this.getBook().getTableDataNameIterator(); + try { + // 清空下缓存 + tableDataParametersMap.clear(); + while (it.hasNext()) { + String name = it.next(); + TableData tableData = this.getBook().getTableData(name); + ParameterProvider[] parameterProviders = DataOperator.getInstance().getTableDataParameters(tableData); + if (filter != null) { + ParameterApplyHelper.addPara2Map(map, parameterProviders, filter); + } else { + ParameterApplyHelper.addPara2Map(map, parameterProviders); + } + tableDataParametersMap.put(name, parameterProviders); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + protected void updateTableDataParameters(String oldName, + String tdName, + TableData tableData, + Map map, + Filter filter) { + + ParameterProvider[] providers = null; + + if (!ComparatorUtils.equals(oldName, tdName)) { + // 更新下缓存名称 替换下数据集名称 + providers = tableDataParametersMap.remove(oldName); + if (providers != null) { + tableDataParametersMap.put(tdName, providers); + } + } + + + try { + for (Map.Entry entry : tableDataParametersMap.entrySet()) { + ParameterProvider[] parameterProviders; + if (ComparatorUtils.equals(entry.getKey(), tdName)) { + parameterProviders = DataOperator.getInstance().getTableDataParameters(tableData); + // 用来更新缓存 + providers = parameterProviders; + } else { + parameterProviders = entry.getValue(); + } + + if (filter != null) { + ParameterApplyHelper.addPara2Map(map, parameterProviders, filter); + } else { + ParameterApplyHelper.addPara2Map(map, parameterProviders); + } + + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + + if (providers != null) { + // 更新缓存 + tableDataParametersMap.put(tdName, providers); + } + } + + protected void addGlobalParameters(Map map) { + // 添加全局参数 + Parameter[] glbParas = ParameterConfig.getInstance().getGlobalParameters(); + ParameterApplyHelper.addPara2Map(map, glbParas); + + } + /** * 环境改变. */ @@ -251,6 +338,11 @@ public abstract class DesignModelAdapter jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (jTemplate != null) { - IOFile ioFile = (IOFile) jTemplate.getTarget(); - - attr = ioFile.getAttrMark(StrategyConfigsAttr.ATTR_MARK); - if (attr == null) { - attr = new StrategyConfigsAttr(); - ioFile.addAttrMark(attr); - } - - //新建模版此时不存在,不需要注册钩子 - if (attr.getXmlSavedHook() == null && WorkContext.getWorkResource().exist(jTemplate.getPath())) { - attr.setXmlSavedHook(new StrategyConfigsAttrSavedHook(jTemplate.getPath(), attr)); - } - return attr; - } else { - throw new IllegalStateException("[ESD]No editing template found."); - } - } - - - /** - * 当前编辑的模版是否被批量开启 - * - * @return - */ - public static boolean isEditingTemplateRecommended() { - JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - - if (jTemplate != null) { - FILE file = jTemplate.getEditingFILE(); - if (file != null) { - String path = file.getPath(); - return StrategyConfigHelper.recommended(path); - } - } - return false; - } - - - /** - * 获取模版数据集配置 - * - * @param dsName - * @return - */ - public static StrategyConfig getStrategyConfig(String dsName) { - - return getStrategyConfigsAttr().getStrategyConfig(dsName); - } - - /** - * 移除模版数据集配置 - * - * @param dsName - * @return - */ - public static StrategyConfig removeStrategyConfig(String dsName) { - - return getStrategyConfigsAttr().removeStrategyConfig(dsName); - } - - /** - * 添加模版数据集配置 - * - * @param strategyConfig - */ - public static void addStrategyConfig(StrategyConfig strategyConfig) { - - getStrategyConfigsAttr().addStrategyConfig(strategyConfig); - } - - - private static class StrategyConfigsAttrSavedHook implements XMLSavedHook { - - private static final long serialVersionUID = -8843201977112289321L; - - private final String tplPath; - private final Map origStrategyConfigs; - - public StrategyConfigsAttrSavedHook(String tplPath, StrategyConfigsAttr raw) { - this.tplPath = tplPath; - this.origStrategyConfigs = new HashMap<>(); - this.initOrigStrategyConfigs(raw); - } - - - private void initOrigStrategyConfigs(StrategyConfigsAttr raw) { - origStrategyConfigs.clear(); - raw.getStrategyConfigs().forEach((k, v) -> { - try { - origStrategyConfigs.put(k, v.clone()); - } catch (CloneNotSupportedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - }); - } - - @Override - public void doAfterSaved(StrategyConfigsAttr saved) { - - FineLoggerFactory.getLogger().info("[ESD]Write StrategyConfigsAttr done, now check change."); - Set dsNames = new HashSet<>(); - dsNames.addAll(origStrategyConfigs.keySet()); - dsNames.addAll(saved.getStrategyConfigs().keySet()); - - if (StringUtils.isNotEmpty(tplPath)) { - dsNames.forEach(dsName -> { - if (StringUtils.isNotEmpty(dsName)) { - StrategyEventsNotifier.compareAndFireConfigEvents(origStrategyConfigs.get(dsName), saved.getStrategyConfig(dsName), new DSMapping(tplPath, new DsNameTarget(dsName))); - } - }); - } - - initOrigStrategyConfigs(saved); - } - } -} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java deleted file mode 100644 index fb0996e8d..000000000 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.fr.design.data.datapane; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.gui.ibutton.UIRadioButton; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.ActionLabel; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.esd.common.CacheConstants; -import com.fr.esd.core.strategy.config.StrategyConfig; -import com.fr.esd.core.strategy.config.StrategyConfigHelper; -import com.fr.esd.util.ESDUtils; -import com.fr.locale.InterProviderFactory; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.StringUtils; - -import javax.swing.AbstractAction; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Desktop; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * @author rinoux - * @version 10.0 - * Created by rinoux on 2020/7/22 - */ -public class ESDStrategyConfigPane extends BasicBeanPane { - private UIRadioButton selectAutoUpdate; - private UIRadioButton selectBySchema; - private UICheckBox shouldEvolve; - private UILabel updateIntervalCheckTips; - private UITextField updateInterval; - private UITextField schemaTime; - private ActionLabel actionLabel; - private UILabel schemaTimeCheckTips; - private final boolean global; - private StrategyConfig strategyConfig; - - private static final String CRON_HELP_URL = "http://help.fanruan.com/finereport/doc-view-693.html"; - - public ESDStrategyConfigPane(boolean global) { - this.global = global; - init(); - } - - private void init() { - setLayout(FRGUIPaneFactory.createM_BorderLayout()); - - this.selectAutoUpdate = new UIRadioButton(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Every_Interval")); - - this.updateInterval = new UITextField(4); - this.shouldEvolve = new UICheckBox(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Auto_Evolved_Strategy"), false); - this.shouldEvolve.setEnabled(false); - this.updateIntervalCheckTips = new UILabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Interval_Format")); - this.updateIntervalCheckTips.setForeground(Color.RED); - this.updateIntervalCheckTips.setVisible(false); - - this.selectBySchema = new UIRadioButton(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cron")); - this.schemaTime = new UITextField(10); - this.schemaTimeCheckTips = new UILabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Time_Format")); - this.schemaTimeCheckTips.setVisible(false); - this.schemaTimeCheckTips.setForeground(Color.RED); - - - this.selectAutoUpdate.addActionListener(new AbstractAction() { - public void actionPerformed(ActionEvent e) { - ESDStrategyConfigPane.this.selectBySchema.setSelected(!ESDStrategyConfigPane.this.selectAutoUpdate.isSelected()); - ESDStrategyConfigPane.this.schemaTime.setEnabled(false); - ESDStrategyConfigPane.this.updateInterval.setEnabled(true); - ESDStrategyConfigPane.this.shouldEvolve.setEnabled(true); - } - }); - - this.selectBySchema.addActionListener(new AbstractAction() { - public void actionPerformed(ActionEvent e) { - ESDStrategyConfigPane.this.selectAutoUpdate.setSelected(!ESDStrategyConfigPane.this.selectBySchema.isSelected()); - ESDStrategyConfigPane.this.schemaTime.setEnabled(true); - ESDStrategyConfigPane.this.updateInterval.setEnabled(false); - ESDStrategyConfigPane.this.shouldEvolve.setEnabled(false); - } - }); - - JPanel pane = FRGUIPaneFactory.createVerticalTitledBorderPane(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cache_Update_Strategy")); - add(pane, BorderLayout.NORTH); - - JPanel row1 = GUICoreUtils.createFlowPane(new Component[]{ - this.selectAutoUpdate, - this.updateInterval, - new UILabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Minute_Update_Cache")), - this.shouldEvolve, - this.updateIntervalCheckTips - }, 0, 5); - pane.add(row1); - - ActionLabel actionLabel = new ActionLabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cron_Help")); - actionLabel.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - try { - Desktop.getDesktop().browse(new URI(CRON_HELP_URL)); - } catch (Exception exp) { - FineLoggerFactory.getLogger().error(exp.getMessage(), e); - } - } - }); - - JPanel row2 = GUICoreUtils.createFlowPane(new Component[]{ - this.selectBySchema, - this.schemaTime, - actionLabel, - this.schemaTimeCheckTips - }, 0, 5); - pane.add(row2); - } - - - public void populateBean(StrategyConfig ob) { - - if (ob == null && !global) { - ob = StrategyConfigHelper.createStrategyConfig(true, false, true); - } - this.strategyConfig = ob; - - this.updateInterval.setText(ob.getUpdateInterval() <= 0 ? "0" : String.valueOf(ob.getUpdateInterval() / (double) CacheConstants.MILLIS_OF_MINUTE)); - this.schemaTime.setText(StringUtils.join(",", ob.getUpdateSchema().toArray(new String[0]))); - this.shouldEvolve.setSelected(ob.shouldEvolve()); - this.selectBySchema.setSelected(ob.isScheduleBySchema()); - this.selectAutoUpdate.setSelected(!ob.isScheduleBySchema()); - - if (global) { - //使用全局配置,禁用面板编辑 - disablePane(); - } else { - setSchemaEnable(!this.selectAutoUpdate.isSelected()); - } - } - - - private void disablePane() { - this.selectAutoUpdate.setEnabled(false); - this.updateInterval.setEnabled(false); - this.shouldEvolve.setEnabled(false); - - this.selectBySchema.setEnabled(false); - this.schemaTime.setEnabled(false); - } - - private void setSchemaEnable(boolean enable) { - this.updateInterval.setEnabled(!enable); - this.shouldEvolve.setEnabled(!enable); - - this.schemaTime.setEnabled(enable); - } - - - public StrategyConfig updateBean() { - StrategyConfig config = null; - if (!this.global) { - try { - //这里是new的config - config = this.strategyConfig.clone(); - - if (this.selectBySchema.isSelected()) { - List schemaTimes = new ArrayList<>(); - String text = this.schemaTime.getText(); - - if (ESDUtils.checkUpdateTimeSchema(text)) { - if (ESDUtils.isCronExpression(text)) { - schemaTimes.add(text); - } else { - Collections.addAll(schemaTimes, text.split(",")); - } - } else { - this.schemaTimeCheckTips.setVisible(true); - throw new IllegalArgumentException("update schema time format error."); - } - config.setScheduleBySchema(true); - config.setUpdateSchema(schemaTimes); - } else { - String interval = this.updateInterval.getText(); - if (checkUpdateInterval(interval)) { - long intervalMillis = StringUtils.isEmpty(interval) ? 0 : (long) (Double.parseDouble(interval) * CacheConstants.MILLIS_OF_MINUTE); - config.setUpdateInterval(intervalMillis); - } else { - this.updateIntervalCheckTips.setVisible(true); - throw new IllegalArgumentException("Error update interval format."); - } - - config.setShouldEvolve(this.shouldEvolve.isSelected()); - config.setScheduleBySchema(false); - } - } catch (CloneNotSupportedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - - return config; - } - - - private boolean checkUpdateInterval(String intervalValue) { - try { - return !StringUtils.isEmpty(intervalValue) && !(Double.parseDouble(intervalValue) <= 0); - } catch (NumberFormatException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - - return false; - } - - - protected String title4PopupWindow() { - return InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cache_Strategy_Config_Title"); - } -} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 9fd8cfa09..2356de6d4 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -1,8 +1,8 @@ package com.fr.design.data.datapane; +import com.fr.base.BaseUtils; import com.fr.base.TableData; import com.fr.data.TableDataSource; -import com.fr.data.impl.DBTableData; import com.fr.data.impl.TableDataSourceDependent; import com.fr.design.DesignModelAdapter; import com.fr.design.ExtraDesignClassManager; @@ -11,67 +11,52 @@ import com.fr.design.constants.UIConstants; import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.data.BasicTableDataUtils; import com.fr.design.data.DesignTableDataManager; -import com.fr.design.data.DesignerStrategyConfigUtils; import com.fr.design.data.tabledata.StoreProcedureWorkerListener; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; -import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane; import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper; -import com.fr.design.data.tabledata.wrapper.TableDataWrapper; -import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; -import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itoolbar.UIToolbar; -import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; -import com.fr.design.i18n.Toolkit; import com.fr.design.icon.IconPathConstants; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.menu.LineSeparator; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; -import com.fr.esd.core.strategy.config.StrategyConfig; -import com.fr.esd.core.strategy.config.StrategyConfigHelper; -import com.fr.esd.event.DSMapping; -import com.fr.esd.event.DsNameTarget; -import com.fr.esd.event.StrategyEventsNotifier; import com.fr.general.ComparatorUtils; -import com.fr.general.IOUtils; +import com.fr.general.GeneralContext; import com.fr.general.NameObject; -import com.fr.log.FineLoggerFactory; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.core.PropertyChangeAdapter; -import org.jetbrains.annotations.NotNull; import javax.swing.BorderFactory; -import javax.swing.Icon; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; import javax.swing.ToolTipManager; -import javax.swing.tree.TreePath; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.dnd.DnDConstants; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; -import java.util.List; import java.util.Map; -import java.util.concurrent.ExecutionException; public class TableDataTreePane extends BasicTableDataTreePane { - private static final TableDataTreePane singleton = new TableDataTreePane(); + private static TableDataTreePane singleton = new TableDataTreePane(); public static final int PLUGIN_LISTENER_PRIORITY = 1; @@ -93,42 +78,31 @@ public class TableDataTreePane extends BasicTableDataTreePane { } private TableDataSourceOP op; - private TableDataTree tableDataTree; + private TableDataTree dataTree; private EditAction editAction; private RemoveAction removeAction; - private EsdOnAction esdAction; - private EsdOffAction esdOffAction; private PreviewTableDataAction previewTableDataAction; private TableDataTreePane() { - initPane(); - } - - private void initPane() { this.setLayout(new BorderLayout(4, 0)); this.setBorder(null); - - //TableDataTree - tableDataTree = new TableDataTree(); - ToolTipManager.sharedInstance().registerComponent(tableDataTree); + dataTree = new TableDataTree(); + ToolTipManager.sharedInstance().registerComponent(dataTree); ToolTipManager.sharedInstance().setDismissDelay(3000); ToolTipManager.sharedInstance().setInitialDelay(0); - - - addMenuDef = new MenuDef(Toolkit.i18nText("Fine-Design_Basic_Action_Add")); + addMenuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Add")); addMenuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH); + createAddMenuDef(); + // 创建插件监听 + createPluginListener(); editAction = new EditAction(); removeAction = new RemoveAction(); - previewTableDataAction = new PreviewTableDataAction(tableDataTree); + previewTableDataAction = new PreviewTableDataAction(dataTree); connectionTableAction = new ConnectionTableAction(); - esdAction = new EsdOnAction(); - esdOffAction = new EsdOffAction(); - - ToolBarDef toolbarDef = new ToolBarDef(); - toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction, SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction, esdAction, esdOffAction); + toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction, SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction); UIToolbar toolBar = ToolBarDef.createJToolBar(); toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); toolBar.setBorderPainted(true); @@ -138,152 +112,115 @@ public class TableDataTreePane extends BasicTableDataTreePane { toolbarPane.add(toolBar, BorderLayout.CENTER); this.add(toolbarPane, BorderLayout.NORTH); - UIScrollPane scrollPane = new UIScrollPane(tableDataTree); + UIScrollPane scrollPane = new UIScrollPane(dataTree); scrollPane.setBorder(null); - initButtonGroup(); + initbuttonGroup(); JPanel jPanel = new JPanel(new BorderLayout(0, 0)); JPanel buttonPane = new JPanel(new GridLayout()); buttonPane.add(buttonGroup, BorderLayout.CENTER); jPanel.add(buttonPane, BorderLayout.NORTH); jPanel.add(scrollPane, BorderLayout.CENTER); this.add(jPanel, BorderLayout.CENTER); - tableDataTree.addMouseListener(new MouseAdapter() { + dataTree.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { checkButtonEnabled(); } }); - tableDataTree.addKeyListener(getTableTreeNodeListener(editAction, previewTableDataAction, removeAction, op, tableDataTree)); + dataTree.addKeyListener(getTableTreeNodeListener(editAction, previewTableDataAction, removeAction, op, dataTree)); // TreeCellEditor - tableDataTree.setEditable(true); - TableDataTreeCellEditor treeCellEditor = new TableDataTreeCellEditor(new UITextField(), tableDataTree, this); + dataTree.setEditable(true); + TableDataTreeCellEditor treeCellEditor = new TableDataTreeCellEditor(new UITextField(), dataTree, this); treeCellEditor.addCellEditorListener(treeCellEditor); - tableDataTree.setCellEditor(treeCellEditor); - new TableDataTreeDragSource(tableDataTree, DnDConstants.ACTION_COPY); + dataTree.setCellEditor(treeCellEditor); + new TableDataTreeDragSource(dataTree, DnDConstants.ACTION_COPY); checkButtonEnabled(); } + private void createPluginListener() { + + //菜单栏监听 + GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) { + + @Override + public void on(PluginEvent event) { + + addMenuDef.clearShortCuts(); + createAddMenuDef(); + } + }, new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + + return context.contain(PluginModule.ExtraDesign); + } + }); + } + + + protected void checkButtonEnabled() { + super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, dataTree); + } + /** * 刷新 */ - @Override public void refreshDockingView() { populate(new TableDataSourceOP(tc)); this.checkButtonEnabled(); } - - @Override - public final void createAddMenuDef() { - TableDataNameObjectCreator[] creators = TableDataCreatorProducer.getInstance().createReportTableDataCreator(); - for (final TableDataNameObjectCreator creator : creators) { - if (creator.shouldInsertSeparator()) { - addMenuDef.addShortCut(new LineSeparator()); - } - - addMenuDef.addShortCut(new AddAction() { - @Override - protected String getTDName() { - return creator.menuName(); - } - - @Override - protected Icon getTDIcon() { - return creator.menuIcon(); - } - - @Override - protected String getNamePrefix() { - return creator.getPrefix(); - } - - @Override - protected TemplateTableDataWrapper getTableDataInstance() { - TableData tableData = (TableData) creator.createObject(); - - //新建的DBTableData单独换为DBTableData - if (tableData instanceof DBTableData) { - tableData = new DBTableData(); - String dsName = createDsName(creator.getPrefix()); - ((DBTableData) tableData).setDsName(dsName); - } else { - // TODO: 2020/11/10 后期支持其它数据集,这里转化可以不用侵入修改TableDataCreatorProducer - } - return new TemplateTableDataWrapper(tableData); + protected void initbuttonGroup() { +// Icon[] iconArray = {BaseUtils.readIcon("/com/fr/design/images/data/datasource.png"), BaseUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase.png")}; + final Integer[] modeArray = {TEMPLATE_TABLE_DATA, SERVER_TABLE_DATA}; + String[] textArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Source_Type_Template"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData")}; + buttonGroup = new UIHeadGroup(textArray) { + public void tabChanged(int index) { + if (op != null) { + op.setDataMode(modeArray[buttonGroup.getSelectedIndex()]); + addMenuDef.setEnabled(modeArray[buttonGroup.getSelectedIndex()] == TEMPLATE_TABLE_DATA ? true : false); + refreshDockingView(); } - }); - } + } + }; + buttonGroup.setNeedLeftRightOutLine(false); } /** * 编辑面板 * - * @param tableDataPane 面板 - * @param originalName 原始名字 + * @param uPanel 面板 + * @param originalName 原始名字 */ - @Override - public void dgEdit(final AbstractTableDataPane tableDataPane, String originalName, boolean isUpdate) { - tableDataPane.addStoreProcedureWorkerListener(new StoreProcedureWorkerListener() { + public void dgEdit(final AbstractTableDataPane uPanel, String originalName, boolean isUpdate) { + uPanel.addStoreProcedureWorkerListener(new StoreProcedureWorkerListener() { public void fireDoneAction() { - if (tableDataTree.getSelectionPath() == null) { - tableDataTree.refresh(); + if (dataTree.getSelectionPath() == null) { + dataTree.refresh(); } else { - Object object = tableDataTree.getSelectionPath().getLastPathComponent(); - int[] rows = tableDataTree.getSelectionRows(); - tableDataTree.refreshChildByName(object.toString()); - tableDataTree.setSelectionRows(rows); + Object object = dataTree.getSelectionPath().getLastPathComponent(); + int[] rows = dataTree.getSelectionRows(); + dataTree.refreshChildByName(object.toString()); + dataTree.setSelectionRows(rows); } } }); - final NamePane tdNamePanel = tableDataPane.asNamePane(); - tdNamePanel.setObjectName(originalName); - + final BasicPane.NamePane nPanel = uPanel.asNamePane(); + nPanel.setObjectName(originalName); final String oldName = originalName; + final BasicDialog dg; allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); - - final BasicDialog dg = tdNamePanel.showLargeWindow(SwingUtilities.getWindowAncestor(TableDataTreePane.this), new DialogActionAdapter() { - @Override + dg = nPanel.showLargeWindow(SwingUtilities.getWindowAncestor(TableDataTreePane.this), new DialogActionAdapter() { public void doOk() { DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); - tc.renameTableData(oldName, tdNamePanel.getObjectName(), false); + tc.renameTableData(oldName, nPanel.getObjectName(), false); TableDataSource tds = tc.getBook(); - TableData td = tableDataPane.updateBean(); + TableData td = uPanel.updateBean(); if (td instanceof TableDataSourceDependent) { ((TableDataSourceDependent) td).setTableDataSource(tds); } - String tdName = tdNamePanel.getObjectName(); - - - //模版还没保存的时候不知道后缀,不能设置到策略配置里面 - if (tableDataPane instanceof DBTableDataPane) { - StrategyConfig editingConfig = ((DBTableDataPane) tableDataPane).updateStrategyConfig(); - if (editingConfig != null) { - editingConfig.setDsName(tdName); - if (!ComparatorUtils.equals(oldName, tdName)) { - //重命名 - DesignerStrategyConfigUtils.removeStrategyConfig(oldName); - } - - DesignerStrategyConfigUtils.addStrategyConfig(editingConfig); - } - ((DBTableData) td).setDsName(tdName); - } - - - //服务器数据集不会走这里,入口不一样 - /*if (tableDataPane instanceof ServerDBTableDataPane) { - StrategyConfig editingConfig = ((ServerDBTableDataPane) tableDataPane).updateStrategyConfig(); - if (editingConfig != null) { - editingConfig.setDsName(tdName); - if (!ComparatorUtils.equals(oldName, tdName)) { - //重命名 - DesignerStrategyConfigUtils.removeServerStrategyConfig(oldName); - } - - DesignerStrategyConfigUtils.addServerStrategyConfig(editingConfig); - } - }*/ - + String tdName = nPanel.getObjectName(); tds.putTableData(tdName, td); Map map = new HashMap(); if (!ComparatorUtils.equals(oldName, tdName)) { @@ -291,35 +228,82 @@ public class TableDataTreePane extends BasicTableDataTreePane { } fireDSChanged(map); tc.fireTargetModified(); - tc.parameterChanged(); - int[] rows = tableDataTree.getSelectionRows(); - tableDataTree.refreshChildByName(tdName); - tableDataTree.setSelectionRows(rows); - - - //单独编辑数据集关闭,修改缓存配置状态,刷新下一键开启/关闭按钮 - checkButtonEnabled(); - } - - @Override - public void doCancel() { - super.doCancel(); + tc.tableDataParametersChanged(oldName, tdName, td); + int[] rows = dataTree.getSelectionRows(); + dataTree.refreshChildByName(tdName); + dataTree.setSelectionRows(rows); } }); - tdNamePanel.addPropertyChangeListener(new PropertyChangeAdapter() { + nPanel.addPropertyChangeListener(new PropertyChangeAdapter() { @Override public void propertyChange() { - doPropertyChange(dg, tdNamePanel, oldName); + doPropertyChange(dg, nPanel, oldName); } }); dg.setVisible(true); } - @Override - public void removeTableData(String sourceName) { - TableDataSource tds = this.tc.getBook(); - tds.removeTableData(sourceName); - this.tableDataTree.refresh(); + private class EditAction extends UpdateAction { + public EditAction() { + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); + this.setMnemonic('E'); + this.setSmallIcon("/com/fr/design/images/control/edit"); + } + + public void actionPerformed(ActionEvent e) { + final NameObject selectedNO = dataTree.getSelectedNameObject(); + if (selectedNO == null) { + return; + } + DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName()); + dgEdit(((AbstractTableDataWrapper) selectedNO.getObject()).creatTableDataPane(), selectedNO.getName(), false); + } + } + + private class RemoveAction extends UpdateAction { + + public RemoveAction() { + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); + this.setMnemonic('R'); + this.setSmallIcon("/com/fr/design/images/control/remove"); + } + + @Override + public void actionPerformed(ActionEvent e) { + NameObject selectedNO = dataTree.getSelectedNameObject(); + + if (selectedNO == null) { + return; + } + + int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + ":" + selectedNO.getName() + "?", + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); + if (returnVal == JOptionPane.OK_OPTION) { + // richer:这个地方为什么要在DataSourceTree里面去remove呢?多此一举吧 + op.removeAction(selectedNO.getName()); + dataTree.refresh(); + // Richie:默认最后一行获得焦点. + dataTree.requestFocus(); + dataTree.setSelectionRow(dataTree.getRowCount() - 1); + fireDSChanged(); + checkButtonEnabled(); + DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName()); + } + } + } + + private void populate(TableDataSourceOP op) { + this.op = op; + dataTree.populate(op); + checkButtonEnabled(); + } + + + /** + * @return + */ + public TableDataTree getDataTree() { + return dataTree; } /** @@ -328,7 +312,6 @@ public class TableDataTreePane extends BasicTableDataTreePane { * @param srcName 数据集来源(比如报表块,就是报表块的名称) * @param tableDataSource 数据集 */ - @Override public Map addTableData(String srcName, TableDataSource tableDataSource, boolean isCover) { Map tdNameMap = new HashMap<>(); allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); @@ -347,55 +330,29 @@ public class TableDataTreePane extends BasicTableDataTreePane { } } tc.parameterChanged(); - tableDataTree.refresh(); + dataTree.refresh(); return Collections.unmodifiableMap(tdNameMap); } - /** - * 合并数据集 - * - * @param srcName 数据集来源(比如报表块,就是报表块的名称) - * @param tableDataSource 数据集 - */ @Override - public Map addTableData(String srcName, TableDataSource tableDataSource) { - Map tdNameMap = new HashMap<>(); - allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); - DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); + public void removeTableData(String sourceName) { TableDataSource tds = tc.getBook(); - Iterator tdIterator = tableDataSource.getTableDataNameIterator(); - while (tdIterator.hasNext()) { - String tdName = tdIterator.next(); - String oldName = tdName; - TableData td = tableDataSource.getTableData(tdName); - if (tds.getTableData(tdName) != null || isDsNameRepeaded(tdName)) { - //如果有同名的就拼上来源名称 - tdName = srcName + tdName; - } - int i = 0; - while (tds.getTableData(tdName) != null) { - i++;//如果拼上名字后依然已经存在就加编号 - tdName += i; - } - tds.putTableData(tdName, td); - if (!ComparatorUtils.equals(oldName, tdName)) { - tdNameMap.put(oldName, tdName); - } - } - tc.parameterChanged(); - tableDataTree.refresh(); - return Collections.unmodifiableMap(tdNameMap); + tds.removeTableData(sourceName); + dataTree.refresh(); } - @Override + + + public void addDataPane(final AbstractTableDataPane uPanel, String paneName) { final NamePane nPanel = uPanel.asNamePane(); nPanel.setObjectName(paneName); + final String oldName = paneName; allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); - tc.renameTableData(paneName, nPanel.getObjectName(), false); + tc.renameTableData(oldName, nPanel.getObjectName(), false); TableDataSource tds = tc.getBook(); TableData td = uPanel.updateBean(); if (td instanceof TableDataSourceDependent) { @@ -404,409 +361,14 @@ public class TableDataTreePane extends BasicTableDataTreePane { String tdName = nPanel.getObjectName(); tds.putTableData(tdName, td); Map map = new HashMap(); - if (!ComparatorUtils.equals(paneName, tdName)) { - map.put(paneName, tdName); + if (!ComparatorUtils.equals(oldName, tdName)) { + map.put(oldName, tdName); } fireDSChanged(map); tc.fireTargetModified(); - tc.parameterChanged(); - int[] rows = tableDataTree.getSelectionRows(); - tableDataTree.refreshChildByName(tdName); - tableDataTree.setSelectionRows(rows); - } - - @Override - public TableDataTree getDataTree() { - return this.tableDataTree; - } - - private void populate(TableDataSourceOP op) { - this.op = op; - tableDataTree.populate(op); - checkButtonEnabled(); - } - - - private void resetAddMenuDef() { - this.addMenuDef.clearShortCuts(); - this.createAddMenuDef(); - } - - private void checkButtonEnabled() { - super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, tableDataTree); - this.checkESDComponentsEnabled(); - } - - - private void checkESDComponentsEnabled() { - if (buttonGroup.getSelectedIndex() == 1) { - //切换到服务器数据集的tab,禁用 - esdAction.setEnabled(false); - esdOffAction.setEnabled(false); - return; - } - - new SwingWorker() { - @Override - protected ButtonStatus doInBackground() throws Exception { - ButtonStatus btnStatus = new ButtonStatus(); - Map statusMap = checkCanBeEsdBatchEnableStatus(); - if (statusMap.size() == 0) { - //没有db数据集 - return btnStatus; - } else { - int canTurnOnCount = 0; - int canTurnOffCount = 0; - for (ESDStatus status : statusMap.values()) { - switch (status) { - case GLOBAL_ON: - case GLOBAL_OFF: - case SINGLE_OFF: - canTurnOnCount++; - break; - case SINGLE_ON: - canTurnOffCount++; - break; - default: - break; - } - } - btnStatus.setOnStatus(canTurnOnCount > 0); - btnStatus.setOffStatus(canTurnOffCount > 0); - } - return btnStatus; - } - - @Override - protected void done() { - try { - ButtonStatus buttonStatus = get(); - esdAction.setEnabled(buttonStatus.isOnStatus()); - esdOffAction.setEnabled(buttonStatus.isOffStatus()); - } catch (InterruptedException | ExecutionException e) { - FineLoggerFactory.getLogger().error("get esd status of ds error for " + e.getMessage(), e); - } - } - }.execute(); - } - - private static class ButtonStatus { - private boolean onStatus = false; - private boolean offStatus = false; - - public boolean isOnStatus() { - return onStatus; - } - - public void setOnStatus(boolean onStatus) { - this.onStatus = onStatus; - } - - public boolean isOffStatus() { - return offStatus; - } - - public void setOffStatus(boolean offStatus) { - this.offStatus = offStatus; - } - } - - //模版数据集 - private void initButtonGroup() { - final Integer[] modeArray = {TEMPLATE_TABLE_DATA, SERVER_TABLE_DATA}; - String[] textArray = {Toolkit.i18nText("Fine-Design_Basic_Tabledata_Source_Type_Template"), Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData")}; - buttonGroup = new UIHeadGroup(textArray) { - public void tabChanged(int index) { - if (op != null) { - op.setDataMode(modeArray[buttonGroup.getSelectedIndex()]); - addMenuDef.setEnabled(modeArray[buttonGroup.getSelectedIndex()] == TEMPLATE_TABLE_DATA); - refreshDockingView(); - - } - } - }; - buttonGroup.setNeedLeftRightOutLine(false); - } - - - private TableDataWrapper findTableDataWrapper(TreePath treePath) { - if (treePath != null) { - ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) treePath.getLastPathComponent(); - Object selectedUserObject = selectedTreeNode.getUserObject(); - NameObject nameObject = null; - if (selectedUserObject instanceof NameObject) { - nameObject = (NameObject) selectedUserObject; - } else { - selectedTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent(); - selectedUserObject = selectedTreeNode.getUserObject(); - if (selectedUserObject instanceof NameObject) { - nameObject = (NameObject) selectedUserObject; - } - } - if (nameObject != null && nameObject.getObject() instanceof TableDataWrapper) { - return (TableDataWrapper) nameObject.getObject(); - } - } - - return null; - } - - private String getTplPath() { - return HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getPath(); - } - - enum ESDStatus { - GLOBAL_ON, - GLOBAL_OFF, - SINGLE_ON, - SINGLE_OFF; - } - - - private Map checkCanBeEsdBatchEnableStatus() { - //<数据集, 是否可以被单独开启> - Map result = new HashMap<>(); - for (int i = 0; i < tableDataTree.getRowCount(); i++) { - TreePath treePath = tableDataTree.getPathForRow(i); - - TableDataWrapper wrapper = findTableDataWrapper(treePath); - if (wrapper.getTableData() instanceof DBTableData) { - DBTableData td = (DBTableData) wrapper.getTableData(); - - StrategyConfig config = DesignerStrategyConfigUtils.getStrategyConfig(wrapper.getTableDataName()); - if (config == null) { - result.put(td, td.isShare() ? ESDStatus.SINGLE_ON : ESDStatus.SINGLE_OFF); - } else { - if (config.isUseGlobal()) { - if (StrategyConfigHelper.recommended(getTplPath())) { - result.put(td, ESDStatus.GLOBAL_ON); - } else { - result.put(td, ESDStatus.GLOBAL_OFF); - } - } else { - if (config.enabled()) { - result.put(td, ESDStatus.SINGLE_ON); - } else { - result.put(td, ESDStatus.SINGLE_OFF); - } - } - } - } - } - - return result; - } - - - private class EsdOnAction extends AbstractESDAction { - - @Override - public String getName() { - return Toolkit.i18nText("Fine-Design_ESD_Batch_Enable"); - } - - @Override - public Icon getIcon() { - return IOUtils.readIcon("/com/fr/design/images/control/batch_esd_on.png"); - } - - @Override - public void doWithTableDataWrapper(TableDataWrapper wrapper) { - String dsName = wrapper.getTableDataName(); - if (wrapper.getTableData() instanceof DBTableData) { - StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName); - strategyConfig.setEnable(true); - strategyConfig.setUseGlobal(false); - DesignerStrategyConfigUtils.addStrategyConfig(strategyConfig); - DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); - } - } - } - - private @NotNull StrategyConfig getOrCreateStrategyConfig(String dsName) { - StrategyConfig config = DesignerStrategyConfigUtils.getStrategyConfig(dsName); - - if (config == null) { - config = StrategyConfigHelper.createStrategyConfig(true); - config.setDsName(dsName); - } - - return config; - } - - - private String createDsName(String prefix) { - int count = 1; - allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); - while (isDsNameRepeaded(prefix + count)) { - count++; - } - return prefix + count; - } - - - private class EsdOffAction extends AbstractESDAction { - - @Override - public String getName() { - return Toolkit.i18nText("Fine-Design_ESD_Batch_Disable"); - } - - @Override - public Icon getIcon() { - return IOUtils.readIcon("/com/fr/design/images/control/batch_esd_off.png"); - } - - @Override - public void doWithTableDataWrapper(TableDataWrapper wrapper) { - String dsName = wrapper.getTableDataName(); - if (wrapper.getTableData() instanceof DBTableData) { - ((DBTableData) wrapper.getTableData()).setShare(false); - StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName); - strategyConfig.setEnable(false); - strategyConfig.setUseGlobal(false); - DesignerStrategyConfigUtils.addStrategyConfig(strategyConfig); - DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); - } - } - } - - private abstract class AbstractESDAction extends UpdateAction { - - public abstract String getName(); - - public abstract Icon getIcon(); - - public abstract void doWithTableDataWrapper(TableDataWrapper tableDataWrapper); - - public AbstractESDAction() { - this.setName(getName()); - this.setMnemonic('R'); - this.setSmallIcon(getIcon()); - } - - @Override - public void actionPerformed(ActionEvent e) { - List tableDataWrapperList = new ArrayList<>(); - - for (int i = 0; i < tableDataTree.getRowCount(); i++) { - TreePath treePath = tableDataTree.getPathForRow(i); - TableDataWrapper wrapper = findTableDataWrapper(treePath); - if (wrapper != null) { - tableDataWrapperList.add(wrapper); - } - } - if (tableDataWrapperList.isEmpty()) { - return; - } - new SwingWorker() { - @Override - protected Void doInBackground() throws Exception { - for (TableDataWrapper tableDataWrapper : tableDataWrapperList) { - doWithTableDataWrapper(tableDataWrapper); - } - return null; - } - - @Override - protected void done() { - refreshDockingView(); - } - }.execute(); - } - } - - - /** - * 新建数据集 - *

- * 抽象化,支持不同类型数据集创建 - */ - private abstract class AddAction extends UpdateAction { - - protected abstract String getTDName(); - - protected abstract Icon getTDIcon(); - - protected abstract String getNamePrefix(); - - protected abstract TemplateTableDataWrapper getTableDataInstance(); - - public AddAction() { - this.setName(this.getTDName()); - this.setSmallIcon(this.getTDIcon()); - } - - @Override - public void actionPerformed(ActionEvent e) { - dgEdit(getTableDataInstance().creatTableDataPane(), createDsName(getNamePrefix()), false); - } - } - - - private class EditAction extends UpdateAction { - public EditAction() { - this.setName(Toolkit.i18nText("Fine-Design_Basic_Edit")); - this.setMnemonic('E'); - this.setSmallIcon(IOUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)); - } - - @Override - public void actionPerformed(ActionEvent e) { - final NameObject selectedNO = tableDataTree.getSelectedNameObject(); - if (selectedNO == null) { - return; - } - - String dsName = selectedNO.getName(); - DesignTableDataManager.removeSelectedColumnNames(dsName); - - AbstractTableDataWrapper wrapper = (AbstractTableDataWrapper) selectedNO.getObject(); - - AbstractTableDataPane tableDataPane = wrapper.creatTableDataPane(); - - //下面创建creatTableDataPane后会直接populate,所以populate时不能用后设置的一些参数,比如name - dgEdit(tableDataPane, dsName, false); - } - } - - private class RemoveAction extends UpdateAction { - - public RemoveAction() { - this.setName(Toolkit.i18nText("Fine-Design_Basic_Remove")); - this.setMnemonic('R'); - this.setSmallIcon(IOUtils.readIcon(IconPathConstants.TD_REMOVE_ICON_PATH)); - } - - @Override - public void actionPerformed(ActionEvent e) { - NameObject selectedNO = tableDataTree.getSelectedNameObject(); - - if (selectedNO == null) { - return; - } - - int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + ":" + selectedNO.getName() + "?", - Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); - if (returnVal == JOptionPane.OK_OPTION) { - // richer:这个地方为什么要在DataSourceTree里面去remove呢?多此一举吧 - op.removeAction(selectedNO.getName()); - tableDataTree.refresh(); - // Richie:默认最后一行获得焦点. - tableDataTree.requestFocus(); - tableDataTree.setSelectionRow(tableDataTree.getRowCount() - 1); - fireDSChanged(); - checkButtonEnabled(); - - //删掉缓存配置 - DesignerStrategyConfigUtils.removeStrategyConfig(selectedNO.getName()); - - // 如果一个模版是平台开启,这个数据集的配置不会存xml,预览模版时直接从全局配置copy,这样 - // 导致删除的时候StrategyConfigsAttrSavedHook没有通过前后配置比较感知数据集被删除,因此不会发出事件让其失效 - // 这里额外发出一次数据集修改事件 - StrategyEventsNotifier.modifyDataSet(new DSMapping(getTplPath(), new DsNameTarget(selectedNO.getName()))); - DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName()); - } - } + tc.tableDataParametersChanged(oldName, tdName, td); + int[] rows = dataTree.getSelectionRows(); + dataTree.refreshChildByName(tdName); + dataTree.setSelectionRows(rows); } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index 16b7e9fa1..6065d0485 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -1,5 +1,6 @@ package com.fr.design.data.tabledata.tabledatapane; +import com.fr.base.BaseUtils; import com.fr.base.Parameter; import com.fr.base.ParameterHelper; import com.fr.data.core.db.TableProcedure; @@ -12,19 +13,15 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; -import com.fr.design.data.DesignerStrategyConfigUtils; -import com.fr.design.data.datapane.ESDStrategyConfigPane; import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane; +import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane.DoubleClickSelectedNodeOnTreeListener; import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.datapane.sqlpane.SQLEditPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.DBTableDataMenuHandler; -import com.fr.design.gui.ibutton.UIButton; 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.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.UITableEditAction; @@ -32,27 +29,18 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane; -import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; import com.fr.design.utils.ParameterUtils; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.esd.core.strategy.config.StrategyConfig; -import com.fr.esd.core.strategy.config.StrategyConfigHelper; -import com.fr.esd.event.DSMapping; -import com.fr.esd.event.DsNameTarget; -import com.fr.esd.event.StrategyEventsNotifier; -import com.fr.esd.event.xml.XMLSavedHook; import com.fr.general.ComparatorUtils; -import com.fr.general.IOUtils; import com.fr.general.sql.SqlUtils; import com.fr.log.FineLoggerFactory; import com.fr.script.Calculator; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; -import com.fr.workspace.WorkContext; import javax.swing.BorderFactory; import javax.swing.Box; @@ -67,7 +55,6 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyEvent; @@ -75,39 +62,25 @@ import java.awt.event.KeyListener; import java.util.ArrayList; import java.util.List; -/** - * @author rinoux - * @version 10.0 - * Created by rinoux on 2020/7/22 - */ public class DBTableDataPane extends AbstractTableDataPane { - private static final int BOTTOM = 6; - private static final String PREVIEW_BUTTON = Toolkit.i18nText("Fine-Design_Basic_Preview"); - private static final String REFRESH_BUTTON = Toolkit.i18nText("Fine-Design_Basic_Refresh"); + private static final String PREVIEW_BUTTON = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"); + private static final String REFRESH_BUTTON = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"); private ConnectionTableProcedurePane connectionTableProcedurePane; private UITableEditorPane editorPane; + private DBTableDataMenuHandler dbTableDataMenuHandler; private SQLEditPane sqlTextPane; - UIComboBox configFromList; - UICheckBox esdEnabled; - private UIButton esdSettingsBtn; - private UILabel barErrorTips; - private String pageQuery; + private UICheckBox isShareCheckBox; + private MaxMemRowCountPanel maxPanel; + private String pageQuery = null; private DBTableData dbTableData; - StrategyConfig strategyConfig; - - public DBTableDataPane() { - init(); - initMainSplitPane(); - } - private void init() { - setLayout(new BorderLayout(4, 4)); + this.setLayout(new BorderLayout(4, 4)); - this.sqlTextPane = new SQLEditPane(); - this.sqlTextPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); + sqlTextPane = new SQLEditPane(); + sqlTextPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); ParameterTableModel model = new ParameterTableModel() { @Override @@ -115,27 +88,25 @@ public class DBTableDataPane extends AbstractTableDataPane { return ArrayUtils.add(super.createDBTableAction(), new RefreshAction()); } }; - editorPane = new UITableEditorPane<>(model); - + editorPane = new UITableEditorPane(model); - this.connectionTableProcedurePane = new ConnectionTableProcedurePane() { + // 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table + connectionTableProcedurePane = new ConnectionTableProcedurePane() { @Override protected void filter(Connection connection, String conName, List nameList) { - connection.addConnection(nameList, conName, new Class[]{ - JDBCDatabaseConnection.class, - JNDIDatabaseConnection.class - }); - } + connection.addConnection(nameList, conName, new Class[]{JDBCDatabaseConnection.class, JNDIDatabaseConnection.class}); + } @Override protected void addKeyMonitor() { - this.searchField.addKeyListener(new KeyListener() { + searchField.addKeyListener(new KeyListener() { + @Override public void keyTyped(KeyEvent e) { + //do nothing } - @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { @@ -144,39 +115,39 @@ public class DBTableDataPane extends AbstractTableDataPane { } } - @Override public void keyReleased(KeyEvent e) { + //do nothing } }); } }; - this.connectionTableProcedurePane.addDoubleClickListener(new ConnectionTableProcedurePane.DoubleClickSelectedNodeOnTreeListener() { + connectionTableProcedurePane.addDoubleClickListener(new DoubleClickSelectedNodeOnTreeListener() { + @Override public void actionPerformed(TableProcedure target) { - Document document = DBTableDataPane.this.sqlTextPane.getDocument(); + Document document = sqlTextPane.getDocument(); try { - document.insertString(DBTableDataPane.this.sqlTextPane.getCaretPosition(), target.toString(), null); + document.insertString(sqlTextPane.getCaretPosition(), target.toString(), null); } catch (BadLocationException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - - - DBTableDataPane.this.sqlTextPane.requestFocus(); + // 这里开始作色,本来可以给sqlTextPane添加DocumentListener来实现的, + // 后来发现insertString的时候,锁定了JTextPane,不能调用setXXX来作色,先这样了. + // sqlTextPane.syntaxTexts(); + sqlTextPane.requestFocus(); } }); - - this.sqlTextPane.addFocusListener(new FocusListener() { + sqlTextPane.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { - barErrorTips.setVisible(false); + // do nothing } - @Override public void focusLost(FocusEvent e) { - if (DBTableDataPane.this.isPreviewOrRefreshButton(e)) { - DBTableDataPane.this.checkParameter(); + if (isPreviewOrRefreshButton(e)) { + checkParameter(); } } }); @@ -192,189 +163,105 @@ public class DBTableDataPane extends AbstractTableDataPane { northPane.add(editToolBar, BorderLayout.CENTER); northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, BOTTOM, 0)); - RTextScrollPane sqlTextScrollPane = new RTextScrollPane(this.sqlTextPane); + RTextScrollPane sqlTextScrollPane = new RTextScrollPane(sqlTextPane); sqlTextScrollPane.setLineNumbersEnabled(true); sqlTextScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); sqlTextScrollPane.setPreferredSize(new Dimension(680, 600)); JPanel paraMeanPane = new JPanel(new BorderLayout()); paraMeanPane.setPreferredSize(new Dimension(680, 90)); - UILabel paraMean = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Param_DES")); + UILabel paraMean = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Param_DES")); paraMeanPane.add(paraMean, BorderLayout.CENTER); box.add(northPane); box.add(sqlTextScrollPane); box.add(paraMeanPane); - box.add(this.editorPane); + box.add(editorPane); JPanel sqlSplitPane = new JPanel(new BorderLayout(4, 4)); sqlSplitPane.add(box, BorderLayout.CENTER); box.setMinimumSize(new Dimension(300, 400)); - - this.connectionTableProcedurePane.setMinimumSize(new Dimension(230, 400)); - this.connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400)); - - JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, this.connectionTableProcedurePane, sqlSplitPane); + // 防止数据连接名过长时影响 split pane 分割效果 + // 本界面中给MaxMemRowCountPanel留的空间太小,造成MaxMemRowCountPanel显示异常,这边减小一点最小宽度,拉长MaxMemRowCountPanel + connectionTableProcedurePane.setMinimumSize(new Dimension(230, 400)); + connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400)); + // 使用SplitPane + JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane); mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor())); mainSplitPane.setOneTouchExpandable(true); - add(mainSplitPane, BorderLayout.CENTER); + this.add(mainSplitPane, BorderLayout.CENTER); + } + + public DBTableDataPane() { + init(); + initMainSplitPane(); } private boolean isPreviewOrRefreshButton(FocusEvent e) { if (e.getOppositeComponent() != null) { String name = e.getOppositeComponent().getName(); - return (ComparatorUtils.equals(name, PREVIEW_BUTTON) || ComparatorUtils.equals(name, REFRESH_BUTTON)); + return ComparatorUtils.equals(name, PREVIEW_BUTTON) || ComparatorUtils.equals(name, REFRESH_BUTTON); } return false; } - @Override protected String title4PopupWindow() { - return Toolkit.i18nText("Fine-Design_Basic_DS-Database_Query"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS-Database_Query"); } - - private void refreshParameters() { + private void refresh() { String[] paramTexts = new String[2]; - paramTexts[0] = SqlUtils.tryPureSqlText(this.sqlTextPane.getText()); - paramTexts[1] = SqlUtils.tryPureSqlText(this.pageQuery); - List existParameterList = this.editorPane.update(); - Parameter[] ps = (existParameterList == null) ? new Parameter[0] : existParameterList.toArray(new Parameter[0]); - - this.editorPane.populate(ParameterUtils.analyzeAndUnionParameters(paramTexts, ps)); + paramTexts[0] = SqlUtils.tryPureSqlText(sqlTextPane.getText()); + paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery); + List existParameterList = editorPane.update(); + Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[0]); + editorPane.populate(ParameterUtils.analyzeAndUnionParameters(paramTexts, ps)); } - private JToolBar createToolBar() { + // p:工具栏. ToolBarDef toolBarDef = new ToolBarDef(); toolBarDef.addShortCut(new PreviewAction()); toolBarDef.addShortCut(SeparatorDef.DEFAULT); toolBarDef.addShortCut(new EditPageQueryAction()); - this.dbTableDataMenuHandler = ExtraDesignClassManager.getInstance().getSingle("DBTableDataMenuHandler"); - if (this.dbTableDataMenuHandler != null) { + dbTableDataMenuHandler = ExtraDesignClassManager.getInstance().getSingle(DBTableDataMenuHandler.MARK_STRING); + if (dbTableDataMenuHandler != null) { toolBarDef.addShortCut(SeparatorDef.DEFAULT); - toolBarDef.addShortCut(this.dbTableDataMenuHandler.createQueryAction()); + toolBarDef.addShortCut(dbTableDataMenuHandler.createQueryAction()); } - - UILabel esdSettingsLabel = new UILabel(Toolkit.i18nText("Fine-Design_ESD_Cache_Settings")); - this.configFromList = new UIComboBox(ConfigFrom.values()); - this.esdEnabled = new UICheckBox(Toolkit.i18nText("Fine-Design_ESD_Enable_Cache")); - this.barErrorTips = new UILabel(); - this.barErrorTips.setForeground(Color.RED); - this.barErrorTips.setVisible(false); - - esdSettingsBtn = new UIButton(Toolkit.i18nText("Fine-Design_ESD_Strategy_Config")); - - esdSettingsBtn.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - final boolean global = (DBTableDataPane.this.configFromList.getSelectedIndex() == DBTableDataPane.ConfigFrom.GLOBAL.getIndex()); - - final ESDStrategyConfigPane strategyConfigPane = new ESDStrategyConfigPane(global); - - StrategyConfig populateStrategyConfig = null; - if (global) { - populateStrategyConfig = StrategyConfigHelper.getGlobalStrategyConfig(); - } else { - populateStrategyConfig = strategyConfig; - } - - //显示对应的配置 - strategyConfigPane.populateBean(populateStrategyConfig); - - BasicDialog dlg = strategyConfigPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - @Override - public void doOk() { - super.doOk(); - if (!global) { - //点击策略配置面板的确定,重新设置策略配置 - strategyConfig = strategyConfigPane.updateBean(); - } - } - }); - dlg.setAlwaysOnTop(true); - dlg.setVisible(true); - } - }); - - this.configFromList.setSelectedIndex(DBTableDataPane.ConfigFrom.GLOBAL.getIndex()); - this.configFromList.addActionListener(e -> setEsdEnabled()); - + isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Is_Share_DBTableData")); + isShareCheckBox.setBackground(Color.WHITE); + maxPanel = new MaxMemRowCountPanel(); + maxPanel.setBorder(null); UIToolbar editToolBar = ToolBarDef.createJToolBar(); toolBarDef.updateToolBar(editToolBar); - - editToolBar.add(esdSettingsLabel); - editToolBar.add(this.configFromList); - editToolBar.add(this.esdEnabled); - editToolBar.add(this.esdSettingsBtn); - editToolBar.add(this.barErrorTips); + editToolBar.add(isShareCheckBox); + editToolBar.add(maxPanel); return editToolBar; } - - /* private void showBarError(String errorTips) { - this.barErrorTips.setText(errorTips); - this.barErrorTips.setVisible(true); - } - - private boolean checkQuery(String errorTips) { - if (StringUtils.isEmpty(this.sqlTextPane.getText())) { - showBarError(errorTips); - return false; - } - - return true; - }*/ - - - /** - * 设置是否开启 - */ - protected void setEsdEnabled() { - boolean useIndividualConfig = configFromList.getSelectedIndex() == ConfigFrom.INDIVIDUAL.getIndex(); - if (useIndividualConfig) { - if (this.strategyConfig == null) { - //新建的数据集,选择单独时,可用但是不勾选 - this.esdEnabled.setSelected(false); - this.esdEnabled.setEnabled(true); - } else { - this.esdEnabled.setSelected(!this.strategyConfig.isUseGlobal() && this.strategyConfig.enabled()); - this.esdEnabled.setEnabled(true); - } - } else { - this.esdEnabled.setSelected(DesignerStrategyConfigUtils.isEditingTemplateRecommended()); - this.esdEnabled.setEnabled(false); - } - } - - - public StrategyConfig updateStrategyConfig() { - return this.strategyConfig; - } - private void checkParameter() { String[] paramTexts = new String[2]; - paramTexts[0] = this.sqlTextPane.getText(); - paramTexts[1] = this.pageQuery; + paramTexts[0] = sqlTextPane.getText(); + paramTexts[1] = pageQuery; Parameter[] parameters = ParameterHelper.analyze4Parameters(paramTexts, false); - if (parameters.length < 1 && this.editorPane.update().size() < 1) { + if (parameters.length < 1 && editorPane.update().size() < 1) { return; } boolean isIn = true; - List list = this.editorPane.update(); - List name = new ArrayList<>(); - for (ParameterProvider parameter : list) { - name.add(parameter.getName()); + List list = editorPane.update(); + List name = new ArrayList(); + for (int i = 0; i < list.size(); i++) { + name.add(list.get(i).getName()); } - for (Parameter parameter : parameters) { - if (!name.contains(parameter.getName())) { + for (int i = 0; i < parameters.length; i++) { + if (!name.contains(parameters[i].getName())) { isIn = false; break; } @@ -382,175 +269,115 @@ public class DBTableDataPane extends AbstractTableDataPane { if (list.size() == parameters.length && isIn) { return; } - - refreshParameters(); + // bug:34175 删了是否刷新对话框, 均直接刷新 + refresh(); } - @Override - public void populateBean(DBTableData dbTableData) { - this.dbTableData = dbTableData; - if (this.dbTableDataMenuHandler != null) { - this.dbTableDataMenuHandler.populate(dbTableData); + public void populateBean(DBTableData dbtabledata) { + this.dbTableData = dbtabledata; + if (dbTableDataMenuHandler != null) { + dbTableDataMenuHandler.populate(dbtabledata); } - + ParameterProvider[] parameters = null; Calculator c = Calculator.createCalculator(); - ParameterProvider[] parameters = dbTableData.getParameters(c); - this.editorPane.populate(parameters); + parameters = dbtabledata.getParameters(c); + editorPane.populate(parameters); + com.fr.data.impl.Connection db = null; + String query = null; + boolean isShare = false; + int maxMemeryRow = -1; - Connection db = dbTableData.getDatabase(); - String query = dbTableData.getQuery(); - this.pageQuery = dbTableData.getPageQuerySql(); + db = dbtabledata.getDatabase(); + query = dbtabledata.getQuery(); + isShare = dbtabledata.isShare(); + maxMemeryRow = dbtabledata.getMaxMemRowCount(); + this.pageQuery = dbtabledata.getPageQuerySql(); this.connectionTableProcedurePane.setSelectedDatabaseConnection(db); this.sqlTextPane.setText(query); this.sqlTextPane.requestFocus(); this.sqlTextPane.moveCaretPosition(this.sqlTextPane.getCaretPosition()); - - //查找映射的配置 - this.strategyConfig = mapStrategyConfig(dbTableData); - - boolean shouldEnable = false; - ConfigFrom from = ConfigFrom.GLOBAL; - - if (this.strategyConfig != null) { - if (this.strategyConfig.enabled()) { - shouldEnable = true; - } - if (!this.strategyConfig.isUseGlobal()) { - from = ConfigFrom.INDIVIDUAL; - } - } - this.esdEnabled.setSelected(shouldEnable); - this.configFromList.setSelectedIndex(from.getIndex()); - } - - - protected StrategyConfig mapStrategyConfig(DBTableData dbTableData) { - //获取配置,如果是模版数据集,dbTableData实例应该是DBTableData,如果是服务器数据集是DBTableData - StrategyConfig strategyConfig = null; - if (dbTableData != null) { - //设置保存数据集的事件检查钩子 - String tplPath = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath(); - - //新建模版此时不存在,不需要注册钩子 - if (dbTableData.getXmlSavedHook() == null && WorkContext.getWorkResource().exist(tplPath)) { - dbTableData.setXmlSavedHook(new DBTableDataSavedHook(tplPath, dbTableData)); - } - - //获取当前的缓存配置,没有就创建一份 - String dsName = this.dbTableData.getDsName(); - strategyConfig = DesignerStrategyConfigUtils.getStrategyConfig(dsName); - if (strategyConfig == null && dbTableData.isShare()) { - strategyConfig = StrategyConfigHelper.createStrategyConfig(true, false, true); - } - } - - return strategyConfig; + isShareCheckBox.setSelected(isShare); + maxPanel.setValue(maxMemeryRow); } - + @Override public DBTableData updateBean() { - - updateDBTableData(); - - //这边只修改enable和useGlobal - boolean global = DBTableDataPane.this.configFromList.getSelectedIndex() == DBTableDataPane.ConfigFrom.GLOBAL.getIndex(); - boolean enable = DBTableDataPane.this.esdEnabled.isSelected(); - - - //未开启缓存的,如果选择了单独配置,需要创建配置 - if (this.strategyConfig == null && !global) { - this.strategyConfig = StrategyConfig.createDefault(); - } - - //设置配置来源和开启状态 - if (this.strategyConfig != null) { - this.strategyConfig.setEnable(enable); - this.strategyConfig.setUseGlobal(global); - } - - return this.dbTableData; - } - - - private void updateDBTableData() { String dbName = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(); if (StringUtils.isBlank(dbName) || StringUtils.isBlank(this.sqlTextPane.getText())) { try { - throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); + } catch (Exception ignore) { + // JOptionPane.showMessageDialog(DBTableDataPane.this, + // com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); } } - - // 保存前 刷新下参数列表 保证获取到最新的参数 - refreshParameters(); - - List parameterList = this.editorPane.update(); - ParameterProvider[] parameters = parameterList.toArray(new ParameterProvider[0]); + refresh(); + List parameterList = editorPane.update(); + Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]); dbTableData.setDatabase(new NameDatabaseConnection(dbName)); + // p:必须先设置Parameters数组,因为setQuery里面会自动设置的 dbTableData.setParameters(parameters); - dbTableData.setQuery(this.sqlTextPane.getText().trim()); + dbTableData.setQuery(this.sqlTextPane.getText()); + dbTableData.setShare(isShareCheckBox.isSelected()); + dbTableData.setMaxMemRowCount(maxPanel.getValue()); dbTableData.setPageQuerySql(this.pageQuery); - if (this.dbTableDataMenuHandler != null) { - this.dbTableDataMenuHandler.update(); + if (dbTableDataMenuHandler != null) { + dbTableDataMenuHandler.update(); } + return dbTableData; } protected class RefreshAction extends UITableEditAction { public RefreshAction() { - setName(REFRESH_BUTTON); - setSmallIcon(IOUtils.readIcon("/com/fr/design/images/control/refresh.png")); + this.setName(REFRESH_BUTTON); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); } - @Override public void actionPerformed(ActionEvent e) { - DBTableDataPane.this.refreshParameters(); + refresh(); } - @Override public void checkEnabled() { + // do nothing } } - - private class PreviewAction - extends UpdateAction { + private class PreviewAction extends UpdateAction { public PreviewAction() { - setName(PREVIEW_BUTTON); - setMnemonic('P'); - setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_file/preview.png")); + this.setName(PREVIEW_BUTTON); + this.setMnemonic('P'); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); } - @Override public void actionPerformed(ActionEvent evt) { - DBTableDataPane.this.checkParameter(); + checkParameter(); PreviewTablePane.previewTableData(DBTableDataPane.this.updateBean()); } } private class EditPageQueryAction extends UpdateAction { public EditPageQueryAction() { - this.setName(Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Page_Query")); + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Page_Query")); this.setMnemonic('L'); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_file/text.png")); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/text.png")); } @Override public void actionPerformed(ActionEvent e) { - final QueryPane pane = new QueryPane(Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Define_Page_Query_SQL")); + final QueryPane pane = new QueryPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Define_Page_Query_SQL")); pane.populate(pageQuery); BasicDialog dialog = pane.showWindow(DesignerContext.getDesignerFrame()); dialog.addDialogActionListener(new DialogActionAdapter() { @@ -564,9 +391,9 @@ public class DBTableDataPane extends AbstractTableDataPane { } } - private static class QueryPane extends BasicPane { + private class QueryPane extends BasicPane { private SQLEditPane pageQueryPane; - private final String title; + private String title; public QueryPane(String title) { this.title = title; @@ -583,96 +410,21 @@ public class DBTableDataPane extends AbstractTableDataPane { if (StringUtils.isBlank(text)) { return; } - this.pageQueryPane.setText(text); + pageQueryPane.setText(text); } public String update() { - String text = this.pageQueryPane.getText(); + String text = pageQueryPane.getText(); if (StringUtils.isBlank(text)) { return null; + } else { + return text; } - return text; } - @Override protected String title4PopupWindow() { - return this.title; - } - } - - - enum ConfigFrom { - GLOBAL(0, Toolkit.i18nText("Fine-Design_ESD_Use_Global_Settings")), - - INDIVIDUAL(1, Toolkit.i18nText("Fine-Design_ESD_Use_Individual_Settings")); - - int index; - - String displayText; - - ConfigFrom(int index, String displayText) { - this.index = index; - this.displayText = displayText; - } - - - static int parse(StrategyConfig config) { - return (config == null || config.isUseGlobal()) ? ConfigFrom.GLOBAL.getIndex() : ConfigFrom.INDIVIDUAL.getIndex(); - } - - public int getIndex() { - return this.index; - } - - - public String getDisplayText() { - return this.displayText; - } - - - public String toString() { - return getDisplayText(); - } - } - - - private static class DBTableDataSavedHook implements XMLSavedHook { - - private static final long serialVersionUID = 4925391747683335372L; - - private final String tplPath; - private String origName; - - private String origConnection; - - private String origQuery; - - public DBTableDataSavedHook(String tplPath, DBTableData origDBTableData) { - this.tplPath = tplPath; - this.origName = origDBTableData.getDsName(); - this.origConnection = origDBTableData.getDatabase().toString(); - this.origQuery = origDBTableData.getQuery(); - } - - @Override - public void doAfterSaved(DBTableData saved) { - String dsName = saved.getDsName(); - String conn = saved.getDatabase().toString(); - String query = saved.getQuery(); - - - //检查数据集名称、数据链接和sql是否修改,如果修改需要触发缓存监听事件 - if (!dsName.equals(origName) || !conn.equals(origConnection) || !query.equals(origQuery)) { - if (StringUtils.isNotEmpty(tplPath) && StringUtils.isNotEmpty(origName)) { - //新建数据集的origName为null,不用触发 - StrategyEventsNotifier.modifyDataSet(new DSMapping(tplPath, new DsNameTarget(origName))); - } - } - - this.origName = dsName; - this.origConnection = conn; - this.origQuery = query; + return title; } } } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java index e0515fe81..b418c1db4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java @@ -48,9 +48,6 @@ public class FileTreeIcon { public static final Icon MODERN_CHT_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/modern_style_cht_file_icon_16x16.png"); - public static final Icon CPTX_ICON = BaseUtils.readIcon("/com/fr/nx/app/designer/cptx_file_icon.png"); - public static final Icon CPTX_LOCKED_ICON = BaseUtils.readIcon("/com/fr/nx/app/designer/cptx_file_icon_locked.png"); - public static final LockIcon FOLDER_LOCK_ICON = new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/fold.png")); public static final LockIcon FILE_LOCK_ICON = @@ -111,7 +108,6 @@ public class FileTreeIcon { public final static int CPT_FILE = 11; //.cpt public final static int FRM_FILE = 12; //.form .frm public final static int CHT_FILE = 13; //.chart .cht - public final static int CPTX_FILE = 14; //.cptx public static Icon getIcon(File file) { return FileTreeIcon.getIcon(file, false); @@ -256,12 +252,6 @@ public class FileTreeIcon { } else { return FileTreeIcon.MODERN_CPT_FILE_IMAGE_ICON; } - } else if (fileType == CPTX_FILE) { - if (isLocked) { - return FileTreeIcon.CPTX_LOCKED_ICON; - } else { - return FileTreeIcon.CPTX_ICON; - } } else if (fileType == FRM_FILE) { //form frm if (isLocked) { return FileTreeIcon.FRM_FILE_LOCK_ICON; @@ -324,8 +314,6 @@ public class FileTreeIcon { return BMP_FILE; } else if (fileName.endsWith(".cpt")) { return CPT_FILE; - } else if (fileName.endsWith(".cptx")) { - return CPTX_FILE; } else if (fileName.endsWith(".frm") || fileName.endsWith(".form")) { return FRM_FILE; } else if (fileName.endsWith(".cht") || fileName.endsWith(".chart")) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index f558f93fc..483e74d9d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -3,7 +3,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.Parameter; -import com.fr.base.extension.FileExtension; import com.fr.base.io.BaseBook; import com.fr.base.iofile.attr.DesignBanCopyAttrMark; import com.fr.base.iofile.attr.TemplateIdAttrMark; @@ -15,7 +14,6 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.TableDataSourceAction; import com.fr.design.actions.edit.RedoAction; import com.fr.design.actions.edit.UndoAction; -import com.fr.design.actions.file.BatchCompileAction; import com.fr.design.actions.file.SaveAsTemplateAction; import com.fr.design.actions.file.SaveTemplateAction; import com.fr.design.actions.file.WebPreviewUtils; @@ -62,8 +60,6 @@ import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; -import com.fr.nx.app.designer.toolbar.CompileAction; -import com.fr.nx.app.designer.toolbar.TemplateTransformer; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; @@ -785,12 +781,10 @@ public abstract class JTemplate> protected boolean saveToNewFile(String oldName) { boolean result = false; - String path = this.editingFILE.getPath(); Set providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG); for (ReportSupportedFileUIProvider provider : providers) { - result = result || provider.saveToNewFile(path, this); + result = result || provider.saveToNewFile(this.editingFILE.getPath(), this); } - result = result || saveToNewFile4Cptx(path); if (!result) { result = result || this.saveFile(); //更换最近打开 @@ -800,14 +794,6 @@ public abstract class JTemplate> return result; } - private boolean saveToNewFile4Cptx(String targetPath) { - if (FileExtension.CPTX.matchExtension(targetPath)) { - TemplateTransformer.TO_CPTX.transform(this); - return true; - } - return false; - } - protected void mkNewFile(FILE file) { try { file.mkfile(); @@ -901,7 +887,7 @@ public abstract class JTemplate> } else if (DesignerMode.isAuthorityEditing()) { return new ShortCut[]{new SaveTemplateAction(this), new UndoAction(this), new RedoAction(this)}; } else { - return new ShortCut[]{new SaveTemplateAction(this), new SaveAsTemplateAction(this), new BatchCompileAction(), new UndoAction(this), new RedoAction(this)}; + return new ShortCut[]{new SaveTemplateAction(this), new SaveAsTemplateAction(this), new UndoAction(this), new RedoAction(this)}; } } @@ -1337,10 +1323,8 @@ public abstract class JTemplate> * @return 按钮组 */ public UIButton[] createExtraButtons() { - UIButton[] uiButtons = new UIButton[] { - (UIButton) new CompileAction().createToolBarComponent() - }; Set providers = ExtraDesignClassManager.getInstance().getArray(DesignerFrameUpButtonProvider.XML_TAG); + UIButton[] uiButtons = new UIButton[0]; for (DesignerFrameUpButtonProvider provider : providers) { uiButtons = ArrayUtils.addAll(uiButtons, provider.getUpButtons(getMenuState())); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 0ec5b9c4f..8229c9f8d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.vcs.common; - import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; import com.fr.design.file.HistoryTemplateListCache; diff --git a/designer-base/src/main/java/com/fr/design/preview/PagePlusPreview.java b/designer-base/src/main/java/com/fr/design/preview/PagePlusPreview.java deleted file mode 100644 index 04fd6623c..000000000 --- a/designer-base/src/main/java/com/fr/design/preview/PagePlusPreview.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.fr.design.preview; - -import com.fr.design.fun.impl.AbstractPreviewProvider; -import com.fr.general.web.ParameterConstants; -import com.fr.locale.InterProviderFactory; - -import java.util.HashMap; -import java.util.Map; - -import static com.fr.nx.app.web.v9.PagePlusActor.TYPE; - -public class PagePlusPreview extends AbstractPreviewProvider { - private static final int CODE = 100; - - @Override - public String nameForPopupItem() { - return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Page-Plus"); - } - - @Override - public String iconPathForPopupItem() { - return "com/fr/design/images/buttonicon/pages.png"; - } - - @Override - public String iconPathForLarge() { - return "com/fr/design/images/buttonicon/pageb24.png"; - } - - @Override - public int previewTypeCode() { - return CODE; - } - - @Override - public Map parametersForPreview() { - Map map = new HashMap(); - map.put(ParameterConstants.OP, TYPE); - return map; - } -} diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index a97b7db9d..43c3f43ad 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -770,7 +770,6 @@ public class FILEChooserPane extends BasicPane { // ben:filefilter设置初值为cpt过滤 this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPT, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); - this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPTX, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); // richer:form文件 daniel 改成三个字 this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/cptx/io/DesignReadWritableProvider.java b/designer-base/src/main/java/com/fr/nx/app/designer/cptx/io/DesignReadWritableProvider.java deleted file mode 100644 index 0896e66e9..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/cptx/io/DesignReadWritableProvider.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.fr.nx.app.designer.cptx.io; - -import com.fr.common.annotations.Negative; -import com.fr.file.FILE; -import com.fr.nx.app.designer.utils.DesignerCptxFileUtils; -import com.fr.nx.cptx.io.handle.impl.AbstractCptxIOProvider; -import com.fr.nx.cptx.pack.util.CompiledReportInputStream; -import com.fr.nx.cptx.pack.util.CompiledReportOutputStream; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -/** - * 用于设计器保存编译后的结果并缓存可web预览模版 - * 没有可观的内存实现,内存实现方式复杂,赶发布,先提供简单的内存实现方式 - * - * @author: Maksim - * @Date: Created in 2020/4/10 - * @Description: 用于cptx写操作的Provider - */ -@Negative(until = "2020-05-10") -public class DesignReadWritableProvider extends AbstractCptxIOProvider { - /** - * 原文件 - */ - private final FILE file; - /** - * 编译文件夹 - */ - private final String compileDir; - - private CompiledReportOutputStream outputStream; - - public DesignReadWritableProvider(FILE file) { - this.file = file; - this.compileDir = DesignerCptxFileUtils.generateCompileDir(file); - } - - @Override - public InputStream open() throws Exception { - if (outputStream == null) { - throw new IOException("can not read cptx template before compile"); - } - return new CompiledReportInputStream(outputStream.toByteArray()); - } - - /** - * 对于写操作,用到的只有这个方法,以流形式来操作 - * - * @return 保存的目标输出流 - * @throws Exception e - */ - @Override - public OutputStream createTemp() throws Exception { - outputStream = new CompiledReportOutputStream(file.asOutputStream(), compileDir); - return outputStream; - } - -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/monitor/DesignerMetricRecorder.java b/designer-base/src/main/java/com/fr/nx/app/designer/monitor/DesignerMetricRecorder.java deleted file mode 100644 index 0644bd511..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/monitor/DesignerMetricRecorder.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.fr.nx.app.designer.monitor; - -import com.fr.design.mainframe.errorinfo.ErrorInfo; -import com.fr.intelli.record.MetricRegistry; -import com.fr.json.JSON; -import com.fr.json.JSONFactory; -import com.fr.json.JSONObject; -import com.fr.message.ErrorMessage; -import com.fr.nx.app.designer.toolbar.TransformResult; - -/** - * Created by loy on 2021/1/18. - * - *

设计器埋点记录相关 - */ -public class DesignerMetricRecorder { - - private static final String ATTR_TEMPLATE_ID = "templateid"; - private static final String ATTR_USERNAME = "username"; - private static final String ATTR_UUID = "uuid"; - private static final String ATTR_ACTIVE_KEY = "activekey"; - private static final String ATTR_TEST_LOG = "testlog"; - private static final String ATTR_REPORT_CONTENT = "reportcontent"; - private static final String ATTR_ERROR_STACK = "errorstack"; - private static final String IDENTIFICATION = "view_plus"; - - private DesignerMetricRecorder() { - } - - /** - * 模板转换失败的埋点 - */ - public static void submitFailedTransform(TransformResult result, String templateID, String name, Exception e) { - if (isPressureTesting()) { - return; - } - saveAsJSON(result, templateID, name, e); - } - - /** - * 记录在设计器的错误信息收集中 - */ - private static void saveToErrorInfo(TransformResult result, String templateID, String name, Exception e, String unsupportMessage) { - JSONObject jo = JSONFactory.createJSON(JSON.OBJECT); - jo.put(ATTR_USERNAME, IDENTIFICATION); - jo.put(ATTR_UUID, IDENTIFICATION); - jo.put(ATTR_ACTIVE_KEY, IDENTIFICATION); - jo.put(ATTR_TEMPLATE_ID, templateID); - jo.put(ATTR_REPORT_CONTENT, name); - if (result == TransformResult.FAILED) { - jo.put(ATTR_TEST_LOG, e); - jo.put(ATTR_ERROR_STACK, e.getMessage()); - } else { - jo.put(ATTR_TEST_LOG, unsupportMessage); - } - new ErrorInfo().saveFileToCache(jo); - } - - /** - * 记录在fine_record_error表中 - */ - private static void saveToErrorMessage(TransformResult result, String templateID, String name, Exception e, String unsupportMessage) { - String errorMessage = unsupportMessage; - if (result == TransformResult.FAILED) { - errorMessage = e.getStackTrace()[0].toString(); - } - ErrorMessage message = ErrorMessage.build(e == null ? errorMessage : e.getMessage(), errorMessage); - message.setTname(name); - message.setDisplayName(name); - MetricRegistry.getMetric().submit(message); - } - - private static void saveAsJSON(TransformResult result, String templateID, String name, Exception e) { - saveToErrorInfo(result, templateID, name, e, null); - saveToErrorMessage(result, templateID, name, e, null); - } - - /** - * 预编译中不支持的功能的埋点 - */ - public static void submitUnSupportTransform(TransformResult result, String templateID, String name, String unsupportMessage) { - if (isPressureTesting()) { - return; - } - saveToErrorInfo(result, templateID, name, null, unsupportMessage); - saveToErrorMessage(result, templateID, name, null, unsupportMessage); - } - - /** - * 埋点对压测性能的影响控制参数 - * - * @return 是否压测 - */ - public static boolean isPressureTesting() { - return Boolean.parseBoolean(System.getProperty("monitorDebug")); - } -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/CompileAction.java b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/CompileAction.java deleted file mode 100644 index 4496ecd9a..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/CompileAction.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.fr.nx.app.designer.toolbar; - -import com.fr.base.extension.FileExtension; -import com.fr.design.actions.UpdateAction; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.menu.MenuKeySet; -import com.fr.file.FILE; -import com.fr.file.FileNodeFILE; -import com.fr.general.IOUtils; -import com.fr.locale.InterProviderFactory; -import com.fr.nx.app.designer.utils.CompileTransformUtil; - -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.KeyStroke; -import java.awt.event.ActionEvent; -import java.awt.event.KeyEvent; - -import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; -import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; -import static javax.swing.JOptionPane.OK_CANCEL_OPTION; -import static javax.swing.JOptionPane.OK_OPTION; -import static javax.swing.JOptionPane.WARNING_MESSAGE; - -/** - * Created by kerry on 2019-10-14 - */ -public class CompileAction extends UpdateAction { - public static final Icon TRANS_ICON = IOUtils.readIcon("/com/fr/nx/app/designer/transform.png"); - - private static final MenuKeySet COMPILE_ATTR = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'C'; - } - - @Override - public String getMenuName() { - return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Transform-Tooltip"); - } - - @Override - public KeyStroke getKeyStroke() { - return KeyStroke.getKeyStroke(KeyEvent.VK_T, DEFAULT_MODIFIER); - } - }; - - public CompileAction() { - initMenuStyle(); - } - - private void initMenuStyle() { - this.setMenuKeySet(COMPILE_ATTR); - this.setName(getMenuKeySet().getMenuKeySetName()); - this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(TRANS_ICON); - this.setAccelerator(getMenuKeySet().getKeyStroke()); - } - - @Override - public void actionPerformed(ActionEvent e) { - JTemplate jtemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); - if (jtemplate == null || jtemplate.getEditingFILE() == null) { - return; - } - FILE currentTemplate = jtemplate.getEditingFILE(); - if(currentTemplate instanceof FileNodeFILE){ - transformAndDisplay(jtemplate); - }else { - //模板不在报表环境下,提示保存 - int selVal = showConfirmDialog( - DesignerContext.getDesignerFrame(), - InterProviderFactory.getProvider().getLocText("Fine-Plugin-Engine_Preview_Message"), - InterProviderFactory.getProvider().getLocText("Fine-Plugin-Engine_Transformer_Tips"), - OK_CANCEL_OPTION, - WARNING_MESSAGE); - - if (OK_OPTION == selVal) { - //保存成功才会执行编译 - if (jtemplate.saveAsTemplate2Env()) { - transformAndDisplay(jtemplate); - } - } - } - - } - - //编译模板并展示 - private void transformAndDisplay(JTemplate jtemplate){ - String path = jtemplate.getEditingFILE().getPath(); - TemplateTransformer transformer = TemplateTransformer.parse(path); - FILE targetFile = CompileTransformUtil.getTargetFile(jtemplate, transformer); - TransformResult result = transformer.transform(jtemplate, targetFile); - jtemplate.fireJTemplateSaved(); - result.display(); - } - - @Override - public boolean isEnabled() { - JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - String path = jt.getEditingFILE().getPath(); - return FileExtension.CPTX.matchExtension(path) || FileExtension.CPT.matchExtension(path); - } - - @Override - public JComponent createToolBarComponent() { - UIButton transBtn = (UIButton) super.createToolBarComponent(); - transBtn.set4ToolbarButton(); - transBtn.setToolTipText(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Transform-Tooltip")); - return transBtn; - } - -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TemplateTransformer.java b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TemplateTransformer.java deleted file mode 100644 index 6294fa4d8..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TemplateTransformer.java +++ /dev/null @@ -1,221 +0,0 @@ -package com.fr.nx.app.designer.toolbar; - -import com.fr.base.extension.FileExtension; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.file.MutilTempalteTabPane; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JTemplate; -import com.fr.file.FILE; -import com.fr.file.FileNodeFILE; -import com.fr.file.filetree.FileNode; -import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; -import com.fr.main.impl.WorkBook; -import com.fr.nx.app.designer.monitor.DesignerMetricRecorder; -import com.fr.nx.compile.CompileStatus; -import com.fr.nx.compile.ReportCompiler; -import com.fr.nx.compile.adapter.LegacyWorkBookAdapter; -import com.fr.nx.compile.util.ReportCompileUtils; -import com.fr.nx.cptx.CptxIOManager; -import com.fr.nx.cptx.cache.CptxTemplatePool; -import com.fr.nx.cptx.entry.CptxTemplate; -import com.fr.nx.cptx.io.handle.CptxTemplateHandle; -import com.fr.nx.app.designer.cptx.io.DesignReadWritableProvider; -import com.fr.nx.cptx.monitor.CompileMonitorHandler; -import com.fr.nx.cptx.utils.CptxFileUtils; -import com.fr.nx.data.layer.LayerItem; -import com.fr.nx.data.layer.LayerProps; -import com.fr.nx.template.compile.CompiledReport; -import com.fr.stable.StringUtils; -import org.jetbrains.annotations.NotNull; - -import java.io.OutputStream; - -import static com.fr.base.extension.FileExtension.ALL; -import static com.fr.base.extension.FileExtension.CPT; -import static com.fr.base.extension.FileExtension.CPTX; - -/** - * 模板转换器, 可以把cptx模板转为cpt, 或者cpt模板转为cptx. - * 以后可以扩展支持frm frmx互相转换 - */ - -public enum TemplateTransformer { - - TO_CPTX(CPT) { - @Override - public TransformResult transform(JTemplate jtemplate, FILE file) { - WorkBook workbook = (WorkBook) jtemplate.getTarget(); - TransformResultInfo resultInfo = compileCPTX(workbook, file); - if (needDoAfterTransformed(resultInfo.getResult())) { - doAfterTransformed(file, jtemplate); - } - return resultInfo.getResult(); - } - }, - TO_CPT(CPTX) { - @Override - public TransformResult transform(JTemplate jtemplate, FILE file) { - WorkBook workbook = (WorkBook) jtemplate.getTarget(); - try { - workbook.export(file.asOutputStream()); - doAfterTransformed(file, jtemplate); - return TransformResult.SUCCESS; - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - return TransformResult.FAILED; - } - } - }, - OTHER(ALL); - private FileExtension extension; - - TemplateTransformer(FileExtension extension) { - this.extension = extension; - } - - public TransformResult transform(JTemplate jtemplate) { - return transform(jtemplate, jtemplate.getEditingFILE()); - } - - public TransformResult transform(JTemplate jtemplate, FILE newFile) { - return TransformResult.UNSUPPORT; - } - - public static TemplateTransformer parse(String path) { - for (TemplateTransformer transformer : values()) { - if (transformer.extension.matchExtension(path)) { - return transformer; - } - } - return OTHER; - } - - private static boolean needDoAfterTransformed(TransformResult result) { - return ComparatorUtils.equals(TransformResult.SUCCESS, result) - || ComparatorUtils.equals(TransformResult.UNSUPPORT, result); - } - - private static void doAfterTransformed(FILE file, JTemplate jtemplate) { - JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (ComparatorUtils.equals(file.getPath(), jt.getPath())) { - HistoryTemplateListCache.getInstance().closeSelectedReport(jt); - DesignerContext.getDesignerFrame().openTemplate(file); - return; - } - MutilTempalteTabPane.getInstance().setIsCloseCurrent(true); - MutilTempalteTabPane.getInstance().closeFormat(jt); - MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt); - DesignerContext.getDesignerFrame().openTemplate(file); - } - - - public static FILE createOutputFile(String oldPath, String oldSuffix, String newSuffix) { - String newPath = generateNewPath(oldPath, oldSuffix, newSuffix); - return new FileNodeFILE(new FileNode(newPath, false)); - } - - private static String generateNewPath(String oldPath, String oldSuffix, String newSuffix) { - if (StringUtils.isEmpty(oldPath) || StringUtils.isEmpty(oldSuffix) || StringUtils.isEmpty(newSuffix)) { - return oldPath; - } - - if (oldPath.endsWith(oldSuffix)) { - return StringUtils.cutStringEndWith(oldPath, oldSuffix) + newSuffix; - } - return oldPath; - } - - /** - * 编译和保存 - * - * @param workbook work - * @param file file - * @return 编译保存结果 - */ - @NotNull - public static TransformResultInfo compileCPTX(WorkBook workbook, FILE file) { - //对于非工作目录的cptx,修改无需执行编译 - if(!(file instanceof FileNodeFILE)){ - try { - OutputStream outputStream = file.asOutputStream(); - workbook.export(outputStream); - return TransformResultInfo.generateResult(TransformResult.SUCCESS).saved(true); - }catch (Exception e){ - FineLoggerFactory.getLogger().error(e.getMessage(), e); - return TransformResultInfo.generateResult(TransformResult.FAILED).saved(false); - } - } - boolean saved; - CompiledReport report = null; - CompileStatus compileStatus = CompileStatus.SUCCEED; - if (workbook == null || file == null) { - return TransformResultInfo - .generateResult(TransformResult.FAILED, "work and file must not be null") - .saved(false); - } - String failMessage = null; - // 编译 - ReportCompiler compiler; - try { - compiler = new ReportCompiler(new LegacyWorkBookAdapter(workbook)); - long startTime = System.currentTimeMillis(); - compiler.compile(); - report = compiler.getCompiledReport(); - // 折叠树埋点 - LayerProps props = ReportCompileUtils.getLayerProps(report); - LayerItem[] items; - if (props != null && (items = props.getLayerItems()) != null) { - CompileMonitorHandler.submitTreeCompileFocusPoint( - startTime, file.getPath(), items.length, - props.getExpandLayer(), true - ); - } - compileStatus = compiler.getStatus(); - failMessage = compiler.getFailMessage(); - long endTime = System.currentTimeMillis(); - CompileMonitorHandler.submitCompileMessage(startTime, endTime, file.getPath(), ""); - if (compileStatus != CompileStatus.SUCCEED) { - DesignerMetricRecorder.submitUnSupportTransform( - TransformResult.UNSUPPORT, - workbook.getTemplateID(), - file.getName(), - compileStatus == CompileStatus.FAILED_UNSUPPORT ? failMessage : null - ); - } - } catch (Exception exception) { - String templateID = workbook.getTemplateID(); - String fileName = file.getName(); - DesignerMetricRecorder.submitFailedTransform(TransformResult.FAILED, templateID, fileName, exception); - FineLoggerFactory.getLogger().error(exception.getMessage(), exception); - } - - // 构建编译结果,当前的 cptx template 是未经反序列化钩子处理过的 cptx 模版对象,不能直接用于模版预览 - CptxTemplate template = CptxIOManager.createCptxTemplate(workbook, report, compileStatus, failMessage); - // 保存 - DesignReadWritableProvider cptx = new DesignReadWritableProvider(file); - CptxTemplateHandle handle = CptxIOManager.create(template, cptx); - try { - saved = handle.save(); - } catch (Exception exception) { - // 存储cptx格式报错或者失败 - FineLoggerFactory.getLogger().error(exception.getMessage(), exception); - DesignerMetricRecorder.submitFailedTransform(TransformResult.FAILED, workbook.getTemplateID(), file.getName(), exception); - return TransformResultInfo.generateResult(TransformResult.FAILED, failMessage).saved(false); - } - // 读取可 web 预览模版并缓存 - try { - // todo 是否考虑异步 - String timestampedPath = CptxFileUtils.getTimestampedPath(file.getPath()); - CptxTemplate previewCptxTemplate = CptxIOManager.open(cptx).getTemplate(); - CptxTemplatePool.getInstance().addCptxTemplate(timestampedPath, previewCptxTemplate); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - if (report == null) { - // 编译报错或者失败 - return TransformResultInfo.generateResult(TransformResult.FAILED, failMessage).saved(saved); - } - return TransformResultInfo.generateResult(TransformResult.parse(compileStatus), failMessage).saved(saved); - } -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResult.java b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResult.java deleted file mode 100644 index 9668ec805..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResult.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.fr.nx.app.designer.toolbar; - -import com.fr.design.file.TemplateTreePane; -import com.fr.design.mainframe.DesignerContext; -import com.fr.locale.InterProviderFactory; -import com.fr.nx.compile.CompileStatus; - -import javax.swing.JOptionPane; - -public enum TransformResult { - - SUCCESS(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Transform-Success")) { - @Override - public void display() { - // 转换成功后, 刷新下目录树 - TemplateTreePane.getInstance().refresh(); - super.display(); - } - }, - FAILED(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Transform-Failed")), - UNSUPPORT(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Transform-Unsupport")){ - @Override - public void display() { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), TransformResult.SUCCESS.toString()); - } - }; - - private String msg; - - private TransformResult(String msg) { - this.msg = msg; - } - - // 展示结果 - public void display() { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), this.toString()); - } - - @Override - public String toString() { - return this.msg; - } - - public static TransformResult parse(CompileStatus status) { - switch (status) { - case SUCCEED: - return TransformResult.SUCCESS; - case FAILED_UNSUPPORT: - return TransformResult.UNSUPPORT; - default: - return TransformResult.FAILED; - } - - } -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResultInfo.java b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResultInfo.java deleted file mode 100644 index e988e04e7..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TransformResultInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.fr.nx.app.designer.toolbar; - -import com.fr.locale.InterProviderFactory; -import com.fr.stable.StringUtils; - -/** - * Created by kerry on 2020-01-15 - */ -public class TransformResultInfo { - - private boolean saved; - private TransformResult result; - private final String transformLog; - - public static TransformResultInfo generateResult(TransformResult result, String transformLog) { - return new TransformResultInfo(result, transformLog); - } - - public static TransformResultInfo generateResult(TransformResult result) { - return new TransformResultInfo(result, StringUtils.EMPTY); - } - - - private TransformResultInfo(TransformResult result, String transformLog) { - this.result = result; - this.transformLog = transformLog; - this.saved = false; - } - - public boolean isSaved() { - return saved; - } - - public void setSaved(boolean saved) { - this.saved = saved; - } - - public TransformResultInfo saved(boolean saved) { - setSaved(saved); - return this; - } - - public TransformResult getResult() { - return result; - } - - public void setResult(TransformResult result) { - this.result = result; - } - - public String getTransformLog() { - switch (this.result) { - case FAILED: - return transformLog + "\n" - + InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Failed_Tip"); - case SUCCESS: - return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Success_Tip"); - case UNSUPPORT: - return transformLog + "\n" - + InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Unsupport_Tip"); - } - return transformLog; - } -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformProgress.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformProgress.java deleted file mode 100644 index 7b11cd34c..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformProgress.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fr.nx.app.designer.transform; - -/** - * Created by kerry on 2019-12-10 - */ -public class BatchTransformProgress { - private double progress = 0.0D; - private int total = 0; - private int complete = 0; - - public BatchTransformProgress(int total) { - this.total = total; - } - - - public double getProgress() { - return this.progress; - } - - - public void updateProgress() { - this.complete++; - this.progress = this.complete * 1D / this.total; - } -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformUtil.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformUtil.java deleted file mode 100644 index aef4eed21..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformUtil.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fr.nx.app.designer.transform; - -import com.fr.file.filetree.FileNode; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by kerry on 2020-02-14 - */ -public class BatchTransformUtil { - private BatchTransformUtil() { - - } - - public static FileNode[] filterTransformedFile(FileNode[] fileNodes, List transformedList){ - List list = new ArrayList(); - for (FileNode fileNode : fileNodes) { - if (!transformedList.contains(fileNode)) { - list.add(fileNode); - } - } - return list.toArray(new FileNode[list.size()]); - } -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformer.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformer.java deleted file mode 100644 index 0f6a76f83..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformer.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.fr.nx.app.designer.transform; - -import com.fr.design.utils.concurrent.ThreadFactoryBuilder; -import com.fr.file.filetree.FileNode; -import com.fr.plugin.context.PluginContexts; -import com.fr.nx.app.designer.toolbar.TransformResultInfo; -import com.fr.nx.app.designer.utils.CompileTransformUtil; - -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; - -/** - * Created by kerry on 2019-12-10 - */ -public class BatchTransformer { - private BatchTransformProgress progress = new BatchTransformProgress(0); - private Map transformResults = new ConcurrentHashMap(); - private UpdateCallBack updateCallBack; - private static final int MAXPOOLSIZE = 5; - private static final String THREAD_NAME_TEMPLATE = "batchtransform-thread-%s"; - private ExecutorService threadPoolExecutor = - PluginContexts.currentContext().newFixedThreadPool(MAXPOOLSIZE, - new ThreadFactoryBuilder().setNameFormat(THREAD_NAME_TEMPLATE).build()); - - public BatchTransformer(UpdateCallBack updateCallBack) { - this.updateCallBack = updateCallBack; - } - - - public void batchTransform(List fileNodes) { - //先清理下 - transformResults.clear(); - progress = new BatchTransformProgress(fileNodes.size()); - for (FileNode fileNode : fileNodes) { - transform(fileNode); - } - } - - private void transform(final FileNode fileNode) { - - threadPoolExecutor.execute(new Runnable() { - @Override - public void run() { - TransformResultInfo transformResult = CompileTransformUtil.compileFile(fileNode); - transformResults.put(fileNode, transformResult); - updateTransformProgress(); - } - }); - } - - private synchronized void updateTransformProgress() { - progress.updateProgress(); - updateCallBack.updateProgress(progress.getProgress()); - } - - public void shutDown() { - if (threadPoolExecutor != null) { - threadPoolExecutor.shutdownNow(); - } - threadPoolExecutor = PluginContexts.currentContext().newFixedThreadPool(MAXPOOLSIZE, - new ThreadFactoryBuilder().setNameFormat(THREAD_NAME_TEMPLATE).build()); - updateCallBack.shutDown(); - } - - public Map getResults() { - return transformResults; - } - -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/UpdateCallBack.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/UpdateCallBack.java deleted file mode 100644 index 85e1a1151..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/UpdateCallBack.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.fr.nx.app.designer.transform; - -/** - * Created by kerry on 2019-12-10 - */ -public interface UpdateCallBack { - /** - * 更新进度 - * @param progress 进度 - */ - void updateProgress(double progress); - - /** - * 进度中断 - */ - void shutDown(); - - /** - * 进度重置 - */ - void reset(); -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformDialog.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformDialog.java deleted file mode 100644 index 75b32cb27..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformDialog.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.fr.nx.app.designer.transform.ui; - -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.locale.InterProviderFactory; - -import javax.swing.JDialog; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Frame; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -/** - * Created by kerry on 2019-12-19 - */ -public class BatchTransformDialog extends JDialog implements ActionListener { - private UIButton closeBtn; - - public BatchTransformDialog(Frame parent, JPanel contentPane) { - super(parent, true); - - this.setTitle(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Batch_Transform")); - this.setResizable(false); - JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - this.setContentPane(defaultPane); - - closeBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Close")); - closeBtn.addActionListener(this); - JPanel buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); - buttonPanel.add(closeBtn); - - defaultPane.add(contentPane, BorderLayout.CENTER); - defaultPane.add(buttonPanel, BorderLayout.SOUTH); - - addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { - dialogExit(); - } - }); - - this.getRootPane().setDefaultButton(closeBtn); - - this.setSize(new Dimension(900, 600)); - GUICoreUtils.centerWindow(this); - } - - @Override - public void actionPerformed(ActionEvent e) { - dialogExit(); - } - - - private void dialogExit() { - this.dispose(); - } -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformPane.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformPane.java deleted file mode 100644 index c11e4e4ad..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/BatchTransformPane.java +++ /dev/null @@ -1,223 +0,0 @@ -package com.fr.nx.app.designer.transform.ui; - -import com.fr.base.extension.FileExtension; -import com.fr.design.dialog.BasicPane; -import com.fr.design.file.NodeAuthProcessor; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.gui.itree.filetree.FileNodeComparator; -import com.fr.design.gui.itree.filetree.FileNodeConstants; -import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrame; -import com.fr.file.filetree.FileNode; -import com.fr.file.filetree.IOFileNodeFilter; -import com.fr.locale.InterProviderFactory; -import com.fr.log.FineLoggerFactory; -import com.fr.nx.app.designer.toolbar.TransformResultInfo; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import javax.swing.tree.DefaultTreeModel; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dialog; -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -/** - * Created by kerry on 2019-12-10 - */ -public class BatchTransformPane extends BasicPane { - private UITextField searchField; - private TransformFileTree tree; - private Dialog showDialog; - private TransformPreparePane preparePane; - private TransformResultPane resultPane; - - - public BatchTransformPane() { - DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - this.showDialog = new BatchTransformDialog(designerFrame, this); - initPane(); - } - - private void initPane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - initNorthPane(); - initSouthPane(); - } - - private void initNorthPane() { - UILabel northTip = new UILabel(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Tip")); - northTip.setForeground(Color.decode("#8F8F92")); - northTip.setBorder(BorderFactory.createEmptyBorder(0, 550, 10, 10)); - this.add(northTip, BorderLayout.NORTH); - } - - private void initSouthPane() { - preparePane = new TransformPreparePane(this.showDialog, this); - tree = new TransformFileTree(preparePane); - this.add(preparePane, BorderLayout.CENTER); - initLeftPane(); - initRightPane(); - } - - private void initLeftPane() { - IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{FileExtension.CPT.getSuffix()}); - tree.setDigIn(true); - tree.setFileNodeFilter(filter); - UIScrollPane scrollPane = new UIScrollPane(tree); - scrollPane.setPreferredSize(new Dimension(320, 442)); - scrollPane.setBorder(BorderFactory.createEmptyBorder(12, 0, 0, 0)); - tree.refreshEnv(); - JPanel selectPane = FRGUIPaneFactory.createTitledBorderPaneCenter( - InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Select_Template")); - JPanel searchPane = initSearchPane(); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.add(searchPane, BorderLayout.NORTH); - jPanel.add(scrollPane, BorderLayout.WEST); - jPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - selectPane.add(jPanel); - selectPane.setPreferredSize(new Dimension(330, 501)); - this.add(selectPane, BorderLayout.WEST); - } - - - private void initRightPane() { - resultPane = new TransformResultPane(); - this.add(resultPane, BorderLayout.EAST); - } - - private JPanel initSearchPane() { - JPanel jPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - jPanel.setBorder(BorderFactory.createEmptyBorder()); - searchField = new UITextField(); - searchField.requestFocus(); - searchField.addKeyListener(keyFieldKeyListener); - searchField.setPreferredSize(new Dimension(261, 20)); - jPanel.add(searchField); - UIButton searchBtn = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Search")); - searchBtn.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - search(); - } - }); - searchBtn.setPreferredSize(new Dimension(44, 20)); - jPanel.add(searchBtn); - return jPanel; - } - - - private KeyAdapter keyFieldKeyListener = new KeyAdapter() { - - @Override - public void keyPressed(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_ENTER) { - search(); - e.consume(); - } - } - }; - - - - private void search() { - //重新构建TreeModel - filter(searchField.getText()); - ExpandMutableTreeNode rootNode = (ExpandMutableTreeNode) tree.getModel().getRoot(); - ((DefaultTreeModel) tree.getModel()).reload(rootNode); - // 展开所有isExpanded为true的TreeNode - rootNode.expandCurrentTreeNode(tree); - } - - public void filter(String filterString) { - NodeAuthProcessor.getInstance().refresh(); - DefaultTreeModel defaultTreeModel = (DefaultTreeModel) tree.getModel(); - ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot(); - NodeAuthProcessor.getInstance().fixTreeNodeAuth(rootTreeNode); - filter(rootTreeNode, filterString); - defaultTreeModel.reload(rootTreeNode); - } - - private void filter(ExpandMutableTreeNode rootTreeNode, String filterString) { - rootTreeNode.removeAllChildren(); - - FileNode[] fns; - fns = listFileNodes(rootTreeNode); - - ExpandMutableTreeNode[] subTreeNodes = NodeAuthProcessor.getInstance().parser2TreeNodeArray(fns); - - for (ExpandMutableTreeNode node : subTreeNodes) { - filter(node, filterString); - if (node.getChildCount() > 0 || (node.getChildCount() == 0 && node.toString().contains(filterString))) { - node.setExpanded(true); - rootTreeNode.add(node); - } - } - - } - - private FileNode[] listFileNodes(ExpandMutableTreeNode rootTreeNode) { - if (rootTreeNode == null) { - return new FileNode[0]; - } - - Object object = rootTreeNode.getUserObject(); - if (!(object instanceof FileNode)) { - return new FileNode[0]; - } - - FileNode[] fileNodes = null; - try { - fileNodes = tree.listFile(((FileNode) object).getEnvPath()); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - if (fileNodes == null) { - fileNodes = new FileNode[0]; - } - Arrays.sort(fileNodes, new FileNodeComparator(FileNodeConstants.getSupportFileTypes())); - return fileNodes; - } - - public void resetFilePaths(Map resultMap) { - this.tree.resetSelectedPaths(); - Iterator iterator = resultMap.keySet().iterator(); - List list = new ArrayList(); - while (iterator.hasNext()){ - FileNode node = iterator.next(); - list.add(node); - } - this.tree.addTransformedList(list); - this.tree.refresh(); - resultPane.populate(resultMap); - } - - public void removeSelectedNode(FileNode fileNode) { - String path = fileNode.getEnvPath(); - this.tree.removeSelectedPath(path); - } - - - @Override - protected String title4PopupWindow() { - return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Batch_Transform"); - } - - public Dialog showDialog() { - return this.showDialog; - } -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/PrepareTransformFileList.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/PrepareTransformFileList.java deleted file mode 100644 index 22d6afcfd..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/PrepareTransformFileList.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.fr.nx.app.designer.transform.ui; - -import com.fr.base.BaseUtils; -import com.fr.design.constants.UIConstants; -import com.fr.design.gui.ilist.UIList; -import com.fr.design.gui.itree.filetree.FileTreeIcon; -import com.fr.file.filetree.FileNode; - -import javax.swing.DefaultListModel; -import javax.swing.Icon; -import javax.swing.JList; -import javax.swing.ListSelectionModel; -import javax.swing.SwingUtilities; -import java.awt.Rectangle; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; - -/** - * Created by kerry on 2020-01-13 - */ -public class PrepareTransformFileList extends UIList { - private TransformPreparePane transformingPane; - private static final int DELETE_RANGE = 20; - - - public PrepareTransformFileList(final TransformPreparePane transformingPane) { - super(); - this.transformingPane = transformingPane; - this.setBackground(UIConstants.TREE_BACKGROUND); - this.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); - DefaultListModel listModel = new DefaultListModel(); - this.setModel(listModel); - this.setCellRenderer(new UIListControlCellRenderer() { - @Override - protected Icon getLeftLabelIcon(Object value) { - if (value instanceof FileNode) { - return FileTreeIcon.getIcon((FileNode) value); - } - return null; - } - - @Override - protected Icon getRightLabelIcon(Object value) { - return BaseUtils.readIcon("/com/fr/nx/app/designer/transform/tab_close.png"); - } - }); - this.addMouseListener(getListMouseListener()); - } - - - private MouseListener getListMouseListener() { - return new MouseAdapter() { - @Override - public void mouseReleased(MouseEvent evt) { - JList list = (JList) evt.getSource(); - int selectedIndex = list.getSelectedIndex(); - Rectangle rectangle = list.getCellBounds(selectedIndex, selectedIndex); - if (SwingUtilities.isLeftMouseButton(evt) - && pointInSelected(rectangle, evt.getX(), evt.getY())) { - Object value = PrepareTransformFileList.this.getSelectedValue(); - if (value != null) { - transformingPane.removeSelectedNode((FileNode) value); - } - } - } - }; - } - - private boolean pointInSelected(Rectangle rectangle, int x, int y) { - if (rectangle == null) { - return false; - } - return x >= rectangle.x + rectangle.width - DELETE_RANGE && - x <= rectangle.x + rectangle.width && - y >= rectangle.y && y <= rectangle.y + rectangle.height; - } -} - diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java deleted file mode 100644 index cbfcd253f..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.fr.nx.app.designer.transform.ui; - -import com.fr.base.FRContext; -import com.fr.base.extension.FileExtension; -import com.fr.design.gui.itree.checkboxtree.CheckBoxTree; -import com.fr.design.gui.itree.checkboxtree.CheckBoxTreeCellRenderer; -import com.fr.design.gui.itree.checkboxtree.CheckBoxTreeSelectionModel; -import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; -import com.fr.design.remote.ui.tree.FileAuthorityTree; -import com.fr.file.filetree.FileNode; -import com.fr.general.ComparatorUtils; -import com.fr.nx.app.designer.transform.BatchTransformUtil; - -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreeCellRenderer; -import javax.swing.tree.TreePath; -import java.awt.AlphaComposite; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.event.MouseEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * Created by kerry on 2020-01-13 - */ -public class TransformFileTree extends FileAuthorityTree { - private TransformPreparePane preparePane; - private static final float CHECKBOX_ENABLE_OPACITY = 0.4f; - - private List transformedList = new ArrayList(); - - public TransformFileTree(TransformPreparePane preparePane) { - this.preparePane = preparePane; - } - - public void addTransformedList(List removeList) { - this.transformedList.addAll(removeList); - } - - @Override - protected CheckBoxTree.Handler createHandler() { - return new CheckBoxTree.Handler(this) { - @Override - public void mousePressed(MouseEvent e) { - super.mousePressed(e); - TreePath treePath = this.getTreePathForMouseEvent(e); - if (treePath == null) { - return; - } - CheckBoxTreeSelectionModel selectionModel = _tree.getCheckBoxTreeSelectionModel(); - boolean selected = selectionModel.isPathSelected(treePath, selectionModel.isDigIn()); - ExpandMutableTreeNode lastPathComponent = (ExpandMutableTreeNode) treePath.getLastPathComponent(); - List selectedFileNodes = filterBatchFileNode(lastPathComponent); - preparePane.removeTransformNode(selectedFileNodes); - if (selected) { - preparePane.addTransformNode(selectedFileNodes); - } - - } - }; - } - - - private List filterBatchFileNode(ExpandMutableTreeNode treeNode) { - List fileNodeList = new ArrayList<>(); - int childCount = treeNode.getChildCount(); - if (childCount > 0) { - loadPendingChildTreeNode(treeNode); - int expandChildCount = treeNode.getChildCount(); - for (int i = 0; i < expandChildCount; i++) { - fileNodeList.addAll(filterBatchFileNode((ExpandMutableTreeNode) treeNode.getChildAt(i))); - } - } else { - FileNode fileNode = (FileNode) treeNode.getUserObject(); - boolean locked = fileNodeLocked(treeNode); - if (!fileNode.isDirectory() && !locked) { - fileNodeList.add((FileNode) treeNode.getUserObject()); - } - } - return fileNodeList; - } - - - private boolean fileNodeLocked(ExpandMutableTreeNode treeNode) { - Object userObj = treeNode.getUserObject(); - if (userObj instanceof FileNode) { - FileNode node = (FileNode) userObj; - String lock = node.getLock(); - if (lock != null && !node.getUserID().equals(lock)) { - return true; - } - } - return false; - } - - public void resetSelectedPaths() { - CheckBoxTreeSelectionModel selectionModel = this.getCheckBoxTreeSelectionModel(); - selectionModel.clearSelection(); - } - - @Override - public void selectCheckBoxPaths(String[] paths) { - if (paths == null || paths.length == 0) { - return; - } - - DefaultTreeModel model = (DefaultTreeModel) this.getModel(); - ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) model.getRoot(); - List res = new ArrayList<>(); - for (String path : paths) { - TreePath treePath = getSelectedPath(treeNode, path); - if (treePath != null) { - res.add(treePath); - } - } - // 勾选中这些结点 - this.getCheckBoxTreeSelectionModel().setSelectionPaths(res.toArray(new TreePath[0])); - } - - private TreePath getSelectedPath(ExpandMutableTreeNode treeNode, String path) { - //可以只在选中的path中选择 - for (int i = 0, len = treeNode.getChildCount(); i < len; i++) { - ExpandMutableTreeNode childTreeNode = (ExpandMutableTreeNode) treeNode.getChildAt(i); - if (childTreeNode.getChildCount() > 0) { - loadPendingChildTreeNode(childTreeNode); - TreePath treePath = getSelectedPath(childTreeNode, path); - if (treePath != null) { - return treePath; - } - } - if (!(childTreeNode.getUserObject() instanceof FileNode)) { - continue; - } - FileNode fileNode = (FileNode) childTreeNode.getUserObject(); - if (ComparatorUtils.equals(path, fileNode.getEnvPath())) { - DefaultTreeModel model = (DefaultTreeModel) this.getModel(); - return new TreePath(model.getPathToRoot(childTreeNode)); - } - } - return null; - } - - public void removeSelectedPath(String path) { - if (path == null) { - return; - } - DefaultTreeModel model = (DefaultTreeModel) this.getModel(); - ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) model.getRoot(); - TreePath selectedPath = getSelectedPath(treeNode, path); - if (selectedPath != null) { - this.getCheckBoxTreeSelectionModel().removeSelectionPath(selectedPath); - - } - } - - - @Override - public FileNode[] listFile(String path) { - // 支持插件扩展, 先从env的filter拿, 再从插件拿 - Set supportTypes = new HashSet(); - for (String temp : this.filter.getSupportedTypes()) { - supportTypes.add(FileExtension.parse(temp)); - } - FileNode[] fileNodes = FRContext.getFileNodes().list( - path, - supportTypes.toArray(new FileExtension[supportTypes.size()]) - ); - return BatchTransformUtil.filterTransformedFile(fileNodes, transformedList); - } - - @Override - public boolean isCheckBoxEnabled(TreePath path) { - ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) path.getLastPathComponent(); - return !fileNodeLocked(treeNode); - } - - @Override - protected CheckBoxTreeCellRenderer createCellRenderer(TreeCellRenderer renderer) { - final CheckBoxTreeCellRenderer checkBoxTreeCellRenderer = new CheckBoxTreeCellRenderer(renderer) { - @Override - public void paint(Graphics g) { - if (!_checkBox.isEnabled()) { - AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, CHECKBOX_ENABLE_OPACITY); - ((Graphics2D) g).setComposite(composite); - } - super.paint(g); - } - }; - addPropertyChangeListener(CELL_RENDERER_PROPERTY, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - checkBoxTreeCellRenderer.setActualTreeRenderer((TreeCellRenderer) evt.getNewValue()); - } - }); - return checkBoxTreeCellRenderer; - } - - -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformPreparePane.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformPreparePane.java deleted file mode 100644 index efbded1b0..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformPreparePane.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.fr.nx.app.designer.transform.ui; - -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.file.filetree.FileNode; -import com.fr.locale.InterProviderFactory; -import com.fr.nx.app.designer.toolbar.TransformResultInfo; -import com.fr.nx.app.designer.transform.BatchTransformer; -import com.fr.nx.app.designer.transform.UpdateCallBack; - -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.DefaultListModel; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Dialog; -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * Created by kerry on 2020-01-13 - */ -public class TransformPreparePane extends JPanel { - private static final String INITIAL_DISPLAY_TEXT = "0"; - private PrepareTransformFileList fileList; - private List selectedFileNodes; - private UpdateProgressDialog dialog; - private BatchTransformer transformer; - private UpdateCallBack updateProgressPane; - private Dialog parentDialog; - private UILabel transCountLabel; - private BatchTransformPane batchTransformPane; - private UIButton startTransform; - - public TransformPreparePane(Dialog parentDialog, BatchTransformPane batchTransformPane) { - this.batchTransformPane = batchTransformPane; - this.parentDialog = parentDialog; - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - updateProgressPane = new UpdateProgressPane(this); - transformer = new BatchTransformer(updateProgressPane); - fileList = new PrepareTransformFileList(this); - selectedFileNodes = new ArrayList<>(); - initPane(); - } - - private void initPane() { - JPanel transformPane = FRGUIPaneFactory.createTitledBorderPaneCenter( - InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Template_To_Transform")); - transformPane.setPreferredSize(new Dimension(270, 501)); - startTransform = new UIButton(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Start")); - startTransform.setEnabled(false); - addStartTransformListener(startTransform); - transCountLabel = new UILabel(INITIAL_DISPLAY_TEXT); - JPanel northPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - northPane.add(startTransform); - northPane.add(Box.createHorizontalStrut(160)); - northPane.add(transCountLabel); - transformPane.add(northPane, BorderLayout.NORTH); - UIScrollPane scrollPane = new UIScrollPane(fileList); - scrollPane.setPreferredSize(new Dimension(260, 442)); - scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - transformPane.add(scrollPane, BorderLayout.CENTER); - this.add(transformPane, BorderLayout.CENTER); - } - - private void addStartTransformListener(UIButton startTransform) { - startTransform.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - //开始转换 - transformer.batchTransform(selectedFileNodes); - displayProgressPane(); - } - - - private void displayProgressPane() { - dialog = new UpdateProgressDialog(transformer, parentDialog, (JPanel) updateProgressPane); - dialog.setVisible(true); - } - }); - } - - public void addTransformNode(List fileNodeList) { - selectedFileNodes.addAll(fileNodeList); - buildFileList(); - - } - - public void removeTransformNode(List fileNodeList) { - selectedFileNodes.removeAll(fileNodeList); - buildFileList(); - } - - public void removeSelectedNode(FileNode fileNode) { - selectedFileNodes.remove(fileNode); - buildFileList(); - this.batchTransformPane.removeSelectedNode(fileNode); - } - - private void buildFileList() { - DefaultListModel listModel = new DefaultListModel(); - int count = selectedFileNodes.size(); - for (int i = count - 1; i >= 0; i--) { - listModel.addElement(selectedFileNodes.get(i)); - } - this.fileList.setModel(listModel); - startTransform.setEnabled(selectedFileNodes.size() > 0); - transCountLabel.setText(String.valueOf(selectedFileNodes.size())); - } - - public void complete() { - dialog.dialogExit(); - updateProgressPane.reset(); - Map resultMap = transformer.getResults(); - resetFileNodeList(); - this.batchTransformPane.resetFilePaths(resultMap); - } - - private void resetFileNodeList(){ - this.selectedFileNodes.clear(); - buildFileList(); - } - -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultList.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultList.java deleted file mode 100644 index 83eb53400..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultList.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.fr.nx.app.designer.transform.ui; - -import com.fr.base.BaseUtils; -import com.fr.design.constants.UIConstants; -import com.fr.design.gui.ilist.UIList; -import com.fr.design.gui.itree.filetree.FileTreeIcon; -import com.fr.file.filetree.FileNode; -import com.fr.nx.app.designer.toolbar.TransformResultInfo; - -import javax.swing.DefaultListModel; -import javax.swing.Icon; -import javax.swing.ListSelectionModel; -import java.util.Iterator; -import java.util.Map; - -/** - * Created by kerry on 2020-01-13 - */ -public class TransformResultList extends UIList { - private Map resultMap; - private static final Icon FAILED_ICON = BaseUtils.readIcon("/com/fr/nx/app/designer/transform/transform_failed.png"); - private static final Icon SUCCESS_ICON = BaseUtils.readIcon("/com/fr/nx/app/designer/transform/transform_success.png"); - private static final Icon UNSUPPORT_ICON = BaseUtils.readIcon("/com/fr/nx/app/designer/transform/transform_unsupport.png"); - - public TransformResultList() { - super(); - this.setBackground(UIConstants.TREE_BACKGROUND); - this.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); - DefaultListModel listModel = new DefaultListModel(); - this.setModel(listModel); - this.setCellRenderer(new UIListControlCellRenderer() { - @Override - protected Icon getLeftLabelIcon(Object value) { - if (value instanceof FileNode) { - return FileTreeIcon.getIcon((FileNode) value); - } - return null; - } - - @Override - protected Icon getRightLabelIcon(Object value) { - if (value != null) { - TransformResultInfo resultInfo = resultMap.get(value); - switch (resultInfo.getResult()) { - case FAILED: - return FAILED_ICON; - case SUCCESS: - return SUCCESS_ICON; - case UNSUPPORT: - return UNSUPPORT_ICON; - } - } - return null; - } - }); - } - - public void populate(Map resultMap) { - this.resultMap = resultMap; - DefaultListModel listModel = new DefaultListModel(); - Iterator> iterator = resultMap.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - FileNode key = entry.getKey(); - listModel.addElement(key); - } - this.setModel(listModel); - } - -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultPane.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultPane.java deleted file mode 100644 index 6bed5aafc..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformResultPane.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.fr.nx.app.designer.transform.ui; - -import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextarea.UITextArea; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.file.filetree.FileNode; -import com.fr.general.ComparatorUtils; -import com.fr.locale.InterProviderFactory; -import com.fr.nx.app.designer.toolbar.TransformResult; -import com.fr.nx.app.designer.toolbar.TransformResultInfo; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.util.Iterator; -import java.util.Map; - -/** - * Created by kerry on 2020-01-10 - */ -public class TransformResultPane extends JPanel { - private TransformResultList resultList; - private UITextArea resultInfo; - private Map resultMap; - private UILabel successTip; - - public TransformResultPane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - initPane(); - } - - private void initPane() { - JPanel resultPane = FRGUIPaneFactory.createTitledBorderPaneCenter( - InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Result")); - JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - resultList = new TransformResultList(); - addValueChangeListener(); - UIScrollPane scrollPane = new UIScrollPane(resultList); - scrollPane.setPreferredSize(new Dimension(260, 260)); - scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - successTip = new UILabel(""); - successTip.setBorder(BorderFactory.createEmptyBorder(5, 150, 5, 10)); - northPane.add(successTip, BorderLayout.NORTH); - northPane.add(scrollPane, BorderLayout.CENTER); - resultPane.add(northPane); - - JPanel resultInfoPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - resultInfoPane.setPreferredSize(new Dimension(270, 165)); - resultInfoPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 10, 5)); - UILabel transformLogLabel = new UILabel( - InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Logs")); - transformLogLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); - resultInfoPane.add(transformLogLabel, BorderLayout.NORTH); - resultInfo = new UITextArea(); - resultInfo.setBackground(Color.white); - resultInfo.setLineWrap(true); - resultInfo.setWrapStyleWord(true); - resultInfo.setEditable(false); - UIScrollPane resultScrollPane = new UIScrollPane(resultInfo); - resultInfoPane.add(resultScrollPane, BorderLayout.CENTER); - this.add(resultPane, BorderLayout.NORTH); - this.add(resultInfoPane, BorderLayout.CENTER); - } - - private void addValueChangeListener() { - resultList.addListSelectionListener(new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent e) { - FileNode selectedValue = (FileNode) resultList.getSelectedValue(); - if (resultInfo != null && selectedValue != null) { - TransformResultInfo result = resultMap.get(selectedValue); - resultInfo.setText(result.getTransformLog()); - } - } - }); - } - - public void populate(Map resultMap) { - int count = getSuccessCount(resultMap); - String tip = InterProviderFactory.getProvider().getLocText( - "Fine-Plugin_Engine_Transform_Result_Tip", String.valueOf(count)); - successTip.setText(tip); - this.resultMap = resultMap; - resultList.populate(resultMap); - if (resultList.getModel().getSize() > 0) { - resultList.setSelectedIndex(0); - FileNode firstResult = (FileNode) resultList.getModel().getElementAt(0); - resultInfo.setText(resultMap.get(firstResult).getTransformLog()); - } - } - - private int getSuccessCount(Map resultMap) { - int count = 0; - Iterator> iterator = resultMap.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - TransformResultInfo resultInfo = entry.getValue(); - if (ComparatorUtils.equals(TransformResult.SUCCESS, resultInfo.getResult())) { - count++; - } - } - return count; - } - -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UIListControlCellRenderer.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UIListControlCellRenderer.java deleted file mode 100644 index 47f677238..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UIListControlCellRenderer.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.fr.nx.app.designer.transform.ui; - -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.stable.StringUtils; -import sun.swing.DefaultLookup; - -import javax.swing.Icon; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.ListCellRenderer; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; - -/** - * Created by kerry on 2020-01-14 - */ -public class UIListControlCellRenderer extends JPanel implements ListCellRenderer { - private UILabel content; - private UILabel controlLabel; - private Color initialLabelForeground; - - public UIListControlCellRenderer() { - initPane(); - } - - private void initPane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - content = new UILabel(); - initialLabelForeground = content.getForeground(); - controlLabel = new UILabel(); - controlLabel.setPreferredSize(new Dimension(16, 20)); - this.add(content, BorderLayout.CENTER); - this.add(controlLabel, BorderLayout.EAST); - } - - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - setComponentOrientation(list.getComponentOrientation()); - Color bg = null; - Color fg = null; - - JList.DropLocation dropLocation = list.getDropLocation(); - if (dropLocation != null - && !dropLocation.isInsert() - && dropLocation.getIndex() == index) { - - bg = DefaultLookup.getColor(this, ui, "List.dropCellBackground"); - fg = DefaultLookup.getColor(this, ui, "List.dropCellForeground"); - - isSelected = true; - } - - if (isSelected) { - setBackground(bg == null ? list.getSelectionBackground() : bg); - setForeground(fg == null ? list.getSelectionForeground() : fg); - content.setForeground(Color.WHITE); - - } else { - setBackground(list.getBackground()); - setForeground(list.getForeground()); - content.setForeground(initialLabelForeground); - } - - content.setText((value == null) ? StringUtils.EMPTY : value.toString()); - Icon leftLabelIcon = getLeftLabelIcon(value); - if (leftLabelIcon != null) { - content.setIcon(leftLabelIcon); - } - Icon rightLabelIcon = getRightLabelIcon(value); - if (rightLabelIcon != null) { - controlLabel.setIcon(rightLabelIcon); - } - return this; - } - - protected Icon getLeftLabelIcon(Object value) { - return null; - } - - protected Icon getRightLabelIcon(Object value) { - return null; - } -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressDialog.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressDialog.java deleted file mode 100644 index 6d9bb009b..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressDialog.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.fr.nx.app.designer.transform.ui; - -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.locale.InterProviderFactory; -import com.fr.nx.app.designer.transform.BatchTransformer; - -import javax.swing.JDialog; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Dialog; -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -/** - * Created by kerry on 2019-12-19 - */ -public class UpdateProgressDialog extends JDialog implements ActionListener { - - private UIButton pauseBtn; - private BatchTransformer transformer; - - public UpdateProgressDialog(BatchTransformer transformer, Dialog parent, JPanel contentPane) { - super(parent, true); - this.transformer = transformer; - initPane(contentPane); - } - - private void initPane(JPanel contentPane) { - this.setTitle(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Format_Transform")); - this.setResizable(false); - JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - this.setContentPane(defaultPane); - - pauseBtn = new UIButton(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Suspend")); - pauseBtn.addActionListener(this); - JPanel buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); - buttonPanel.add(pauseBtn); - - defaultPane.add(contentPane, BorderLayout.CENTER); - defaultPane.add(buttonPanel, BorderLayout.SOUTH); - - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - transformer.shutDown(); - dialogExit(); - } - }); - - this.getRootPane().setDefaultButton(pauseBtn); - - this.setSize(new Dimension(262, 122)); - GUICoreUtils.centerWindow(this); - } - - @Override - public void actionPerformed(ActionEvent e) { - transformer.shutDown(); - dialogExit(); - } - - public void dialogExit() { - this.dispose(); - } -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressPane.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressPane.java deleted file mode 100644 index 5fb57c369..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/UpdateProgressPane.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.fr.nx.app.designer.transform.ui; - - -import com.fr.base.BaseUtils; -import com.fr.decision.update.data.UpdateConstants; -import com.fr.design.dialog.BasicPane; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.general.ComparatorUtils; -import com.fr.locale.InterProviderFactory; -import com.fr.nx.app.designer.transform.UpdateCallBack; -import com.sun.java.swing.plaf.motif.MotifProgressBarUI; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import javax.swing.JProgressBar; -import java.awt.BorderLayout; -import java.awt.Dimension; - - -/** - * Created by kerry on 2019-12-11 - */ -public class UpdateProgressPane extends BasicPane implements UpdateCallBack { - private TransformPreparePane contentPane; - private JProgressBar progressBar; - - public UpdateProgressPane(TransformPreparePane contentPane) { - this.contentPane = contentPane; - initPane(); - } - - private void initPane() { - this.setPreferredSize(new Dimension(262, 60)); - UILabel icon = new UILabel(BaseUtils.readIcon("/com/fr/nx/app/designer/transform/transforming.png")); - icon.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); - this.add(icon, BorderLayout.WEST); - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - UILabel title = new UILabel(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transforming")); - title.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0)); - centerPane.add(title, BorderLayout.NORTH); - progressBar = new JProgressBar(); - progressBar.setUI(new MotifProgressBarUI()); - progressBar.setForeground(UpdateConstants.BAR_COLOR); - centerPane.add(progressBar, BorderLayout.CENTER); - this.add(centerPane, BorderLayout.CENTER); - } - - - @Override - public void updateProgress(double progress) { - progressBar.setValue((int) (progress * 100)); - if (ComparatorUtils.equals(progress, 1D)) { - contentPane.complete(); - } - } - - @Override - public void shutDown() { - contentPane.complete(); - } - - @Override - public void reset() { - progressBar.setValue(0); - } - - @Override - protected String title4PopupWindow() { - return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Suspend"); - } -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CompileTransformUtil.java b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CompileTransformUtil.java deleted file mode 100644 index 3de788cd1..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CompileTransformUtil.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.fr.nx.app.designer.utils; - -import com.fr.design.mainframe.JTemplate; -import com.fr.file.FILE; -import com.fr.file.filetree.FileNode; -import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; -import com.fr.main.impl.WorkBook; -import com.fr.nx.app.designer.toolbar.TemplateTransformer; -import com.fr.nx.app.designer.toolbar.TransformResult; -import com.fr.nx.app.designer.toolbar.TransformResultInfo; -import com.fr.workspace.WorkContext; - -import java.io.InputStream; - -import static com.fr.base.extension.FileExtension.CPT; -import static com.fr.base.extension.FileExtension.CPTX; - -/** - * Created by kerry on 2019-12-04 - */ -public class CompileTransformUtil { - - - public static TransformResultInfo compileFile(FileNode fileNode) { - long start = System.currentTimeMillis(); - InputStream in = WorkContext.getWorkResource().openStream(fileNode.getEnvPath()); - WorkBook workBook = new WorkBook(); - TransformResultInfo result = null; - try { - workBook.readStream(in); - FILE file = TemplateTransformer.createOutputFile(fileNode.getEnvPath(), CPT.getSuffix(), CPTX.getSuffix()); - result = TemplateTransformer.compileCPTX(workBook, file); - } catch (Exception ignore) { - result = TransformResultInfo.generateResult(TransformResult.FAILED); - } - long end = System.currentTimeMillis(); - FineLoggerFactory.getLogger().debug(fileNode.getName() + " compile cost : " + (end - start) +" ms "); - return result; - } - - - public static FILE getTargetFile(JTemplate jTemplate, TemplateTransformer transformer) { - FILE file = null; - if (ComparatorUtils.equals(TemplateTransformer.TO_CPTX, transformer)) { - file = TemplateTransformer.createOutputFile(jTemplate.getEditingFILE().getPath(), - CPT.getSuffix(), CPTX.getSuffix()); - - } else if (ComparatorUtils.equals(TemplateTransformer.TO_CPT, transformer)) { - file = TemplateTransformer.createOutputFile(jTemplate.getEditingFILE().getPath(), - CPTX.getSuffix(), CPT.getSuffix()); - } - return file; - } -} diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/utils/DesignerCptxFileUtils.java b/designer-base/src/main/java/com/fr/nx/app/designer/utils/DesignerCptxFileUtils.java deleted file mode 100644 index a51e04768..000000000 --- a/designer-base/src/main/java/com/fr/nx/app/designer/utils/DesignerCptxFileUtils.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.fr.nx.app.designer.utils; - -import com.fr.file.FILE; -import com.fr.general.CommonIOUtils; -import com.fr.log.FineLoggerFactory; -import com.fr.main.impl.WorkBook; -import com.fr.nx.marshal.impl.xml.DefaultXMLObjectUnmarshaler; -import com.fr.nx.marshal.util.MarshalUtil; -import com.fr.nx.cptx.entry.metadata.CptxMetadata; -import com.fr.nx.cptx.io.handle.impl.OriginCptProvider; -import com.fr.nx.cptx.marshal.util.CptxMarshalUtil; -import com.fr.nx.cptx.utils.CptxFileUtils; -import com.fr.stable.EncodeConstants; -import com.fr.stable.StableUtils; -import com.fr.stable.xml.XMLableReader; -import com.fr.workspace.WorkContext; - -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.InputStreamReader; - -/** - * Created by loy on 2021/1/18. - * - *

用于设计器的cptx的一些工具类 - *

- */ -public class DesignerCptxFileUtils { - - /** - * 根据file来获取cptx中的cpt - * @param file - * @return - */ - public static WorkBook getWorkBook(final FILE file){ - try (InputStream input = file.asInputStream(); - ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { - CommonIOUtils.copyBinaryTo(input, outputStream); - OriginCptProvider provider = new OriginCptProvider(outputStream.toByteArray()); - return CptxFileUtils.getWorkBook(provider); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return null; - } - - /** - * 获取模板的元数据 - * @param file - * @return - */ - public static CptxMetadata getMetadata(FILE file){ - try { - String metadataPath = StableUtils.pathJoin(generateCompileDir(file), CptxMarshalUtil.NAME_METADATA); - if(!WorkContext.getWorkResource().exist(metadataPath)){ - return null; - } - InputStream metadataInput = WorkContext.getWorkResource().openStream(metadataPath); - XMLableReader reader = XMLableReader.createXMLableReader( - new InputStreamReader(metadataInput, EncodeConstants.ENCODING_UTF_8)); - CptxMetadata metadata = (CptxMetadata) new DefaultXMLObjectUnmarshaler().unmarshal( - MarshalUtil.createMarshalableExtra(CptxMetadata.class), reader); - return metadata; - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return null; - } - - /** - * 根据文件获取编译后的文件夹绝对路径,比如原文件位于reportlets/test/merge.cptx,转化后为evn://assets/engine/test/merge文件夹 - * @param file - * @return - */ - public static String generateCompileDir(FILE file){ - String filePath = file.getPath(); - return CptxFileUtils.generateCompileDir(filePath); - } -} diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/bbs_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/bbs_normal.svg index 4a9711e35..ae72bfa4d 100644 --- a/designer-base/src/main/resources/com/fr/design/images/bbs/bbs_normal.svg +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/bbs_normal.svg @@ -4,4 +4,4 @@ - \ No newline at end of file + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/prewidget_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/prewidget_normal.svg deleted file mode 100644 index 542c02c26..000000000 --- a/designer-base/src/main/resources/com/fr/design/images/buttonicon/prewidget_normal.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - icon_控件管理 有小箭头_normal - - - - - \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/files_up_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/files_up_normal.svg deleted file mode 100644 index 34cd6083a..000000000 --- a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/files_up_normal.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - icon_控件_文件控件_normal - - - - \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/control/addPopup_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/control/addPopup_disabled.svg deleted file mode 100644 index d48e1a27b..000000000 --- a/designer-base/src/main/resources/com/fr/design/images/control/addPopup_disabled.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - 编组 - - - - - - - - - - - - - \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/control/addPopup_normal.svg b/designer-base/src/main/resources/com/fr/design/images/control/addPopup_normal.svg deleted file mode 100644 index 8cec802fe..000000000 --- a/designer-base/src/main/resources/com/fr/design/images/control/addPopup_normal.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - 编组备份 - - - - - - - - - - - \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/control/batch_esd_off.png b/designer-base/src/main/resources/com/fr/design/images/control/batch_esd_off.png deleted file mode 100644 index 0e8dce8ef46af092cfcda164b98272aea1af7078..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1286 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6-PsS%!O zzP=1vKsE;hE29ttGmymygba*Q3?LOi7K0a~G@Kp8r~y^O#K6#=$-n|t69uF}zypXu zdLT5@0w%Z$fd$M6Hb`m5@+r|?L9&C18K8MsJ85o%Md%8G=SP1$CpY;w26xko2&z4?tDrjb!+u8zk-ZShX zTxyONgSQcUttTcK&$g{^ zEdH-`Mdpgd56(@>Pt@yXKS<3!`q}I0=c0tRg|Q0r&)YZDg>xKS!~1HhCI2CfS;qI( zCwxm>8M4cL>Pm*wPmB2Glxkk}T)WkqZ`0%KkBhrbgm|?IerA5OvS{ZUPp(zhU#m^@ zSo33_ZM)N7j!8})6MlHR8%@wWGNtu_dBX$kr&@nEm4N4GZW{cG!lvI6-PsS%!O zzP=1vKsE;hE29ttGmymygba*Q3?LOi7K0a~G@Kp8r~y^O#K6#=$-n|t69uF}zypXu zdLT5@0w%Z$fd$M6Hb`m5@+r|?L9&C18K8MsJ85o$hc)B=-SO~@jduIqcO5B@y_f3+}+O2^(J#SUJgrqWs z0;DfaesFN|H>D;yo2qW{rT4C6JFb^wt)8gG(InTZvbEA=3Y)&2##EQ3QSzRfPrf_z z7kNy*@QWTTX9d--h0wVHt-co^33XLT6yK8 zaL>ue8JRPFZ+xd{AGGiBXUS|=&3{XxYBw*rTfoC;H1kaCjp8}Q&YHdEF*E%Z=cIXf zs$AV$w6kXR1kM8<%P%vs%wCq+`*Yv@r3^m}*|OyY)pbu7P58`v`=i&=M>D5f$uV;^ zk&2xb7TselNAjzcHGJli^_=RQafJ*IA>Jl*Hqp4eF3nyVt4Z@%%n{`Q|sf$(QRxv+p!e-7=;IcQch z|E+GNW3kR7Ts*MV88g5;)r4uu}sgVTV{Kw1Y2%2dduDF z#MdKs_410VS@r@Ehi-2@CE&@(kRE7KFg?iTn@yR93|}LseH-^YZpHZ%f3V~RT)t73 zAo+do@tvMK+zfOtBzc`=cz7d{rVeTIxDPqJTO^6 zn@`rSk(I?*{(-{9`ESdrQ?txA72fnc!yVQ9_U!^`zVgcqm7KcQ4({pUDVb-)#Q1oz zUw9U`xa_;HRqK~6PhV!Uerww8b9rYKF6mG6Ka}WWbWES=g%v|GgR}Q*!)KLpQ$PJV z<&`L#zuEH~K`o$l - - icon_编辑_disable - - - - - \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/control/edit_normal.svg b/designer-base/src/main/resources/com/fr/design/images/control/edit_normal.svg deleted file mode 100644 index 291719452..000000000 --- a/designer-base/src/main/resources/com/fr/design/images/control/edit_normal.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - icon_编辑_normal - - - - - \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg deleted file mode 100644 index b57f9a853..000000000 --- a/designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - icon_删除_normal - - - - - - - - \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/control/remove_normal.svg b/designer-base/src/main/resources/com/fr/design/images/control/remove_normal.svg deleted file mode 100644 index b09268f45..000000000 --- a/designer-base/src/main/resources/com/fr/design/images/control/remove_normal.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - icon_删除_normal备份 - - - - - - \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg deleted file mode 100644 index 3edcffdc6..000000000 --- a/designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - icon_报表web属性_打印预览_normal - - - - - - - - \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/preview_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/preview_normal.svg deleted file mode 100644 index a29073712..000000000 --- a/designer-base/src/main/resources/com/fr/design/images/m_file/preview_normal.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - icon_报表web属性_打印预览_normal备份 - - - - - - \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerDebugTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerDebugTest.java deleted file mode 100644 index 6a8f8247b..000000000 --- a/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerDebugTest.java +++ /dev/null @@ -1,239 +0,0 @@ -package com.fr.nx.app.designer.toolbar; - -import com.fr.base.Parameter; -import com.fr.base.chart.BaseChartCollection; -import com.fr.base.io.XMLEncryptKey; -import com.fr.base.io.XMLEncryptUtils; -import com.fr.base.iofile.IOFileAttrMarkManager; -import com.fr.base.parameter.ParameterUI; -import com.fr.chart.chartattr.ChartCollection; -import com.fr.config.dao.DaoContext; -import com.fr.config.dao.impl.LocalClassHelperDao; -import com.fr.config.dao.impl.LocalEntityDao; -import com.fr.config.dao.impl.LocalXmlEntityDao; -import com.fr.file.MemFILE; -import com.fr.form.DefaultFormOperator; -import com.fr.form.FormOperator; -import com.fr.form.main.ExtraFormClassManager; -import com.fr.form.main.Form; -import com.fr.form.main.FormHyperlink; -import com.fr.form.main.parameter.FormParameterUI; -import com.fr.form.parameter.FormSubmitButton; -import com.fr.form.plugin.DefaultSwitcherImpl; -import com.fr.general.xml.GeneralXMLTools; -import com.fr.io.EncryptUtils; -import com.fr.js.FormHyperlinkProvider; -import com.fr.main.impl.WorkBook; -import com.fr.nx.calculable.Calculable; -import com.fr.nx.calculable.type.ConstantCalculable; -import com.fr.nx.cell.CellKey; -import com.fr.nx.cell.CellTemplate; -import com.fr.nx.cptx.cache.CptxTemplatePool; -import com.fr.nx.cptx.entry.CptxTemplate; -import com.fr.nx.cptx.resource.ImageResourceRef; -import com.fr.page.BaseSinglePagePrintable; -import com.fr.page.BaseSingleReportCache; -import com.fr.page.ClippedChartPage; -import com.fr.page.ClippedECPage; -import com.fr.page.ClippedPageProvider; -import com.fr.page.PDF2Painter; -import com.fr.page.PageGeneratorProvider; -import com.fr.page.PagePainter; -import com.fr.page.PagePainterProvider; -import com.fr.page.PageSetChainProvider; -import com.fr.page.PageSetProvider; -import com.fr.page.PageXmlOperator; -import com.fr.page.PageXmlProvider; -import com.fr.page.PaperSettingProvider; -import com.fr.page.ReportPage; -import com.fr.page.ReportPageAttrProvider; -import com.fr.page.ReportPageProvider; -import com.fr.page.SheetPage; -import com.fr.page.SinglePagePrintable; -import com.fr.page.SingleReportCache; -import com.fr.page.generator.PaginateReportPageGenerator; -import com.fr.page.generator.PolyReportPageGenerator; -import com.fr.page.generator.SheetPageGenerator; -import com.fr.page.pageset.ArrayPageSet; -import com.fr.page.pageset.PageSetChain; -import com.fr.page.stable.PaperSetting; -import com.fr.page.stable.ReportPageAttr; -import com.fr.plugin.attr.CalculatorAttrMark; -import com.fr.runtime.FineRuntime; -import com.fr.stable.EssentialUtils; -import com.fr.stable.bridge.BridgeMark; -import com.fr.stable.bridge.StableFactory; -import com.fr.stable.fun.WidgetSwitcher; -import com.fr.stable.module.Module; -import com.fr.stable.plugin.ExtraFormClassManagerProvider; -import com.fr.transaction.Configurations; -import com.fr.transaction.LocalConfigurationHelper; -import com.fr.xml.ReportXMLUtils; -import org.easymock.EasyMock; -import org.easymock.IArgumentMatcher; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.easymock.PowerMock; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; -import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.reflect.Whitebox; - -import java.io.InputStream; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({CptxTemplatePool.class, XMLEncryptUtils.class}) -@SuppressStaticInitializationFor({"com.fr.nx.cptx.cache.CptxTemplatePool", "com.fr.base.io.XMLEncryptUtils"}) -@PowerMockIgnore({"com.sun.tools.attach.*", "sun.tools.attach.*"}) -public class TemplateTransformerDebugTest { - - @BeforeClass - public static void beforeClass() { - System.setProperty("apple.awt.UIElement", "true"); - StableFactory.registerXMLDescription(ReportPageAttrProvider.XML_TAG, new ReportPageAttr()); - StableFactory.registerMarkedClass(ReportPageProvider.XML_TAG, ReportPage.class); - StableFactory.registerMarkedClass(PaperSettingProvider.XML_TAG, PaperSetting.class); - StableFactory.registerMarkedClass(ReportPageProvider.XML_TAG_4_SHEET, SheetPage.class); - StableFactory.registerMarkedClass(PagePainterProvider.XML_TAG, PagePainter.class); - StableFactory.registerMarkedClass(PageSetChainProvider.XML_TAG, PageSetChain.class); - StableFactory.registerMarkedClass(PageXmlProvider.XML_TAG, PageXmlOperator.class); - StableFactory.registerMarkedClass(BaseSinglePagePrintable.XML_TAG, SinglePagePrintable.class); - StableFactory.registerMarkedClass(BaseSingleReportCache.XML_TAG, SingleReportCache.class); - StableFactory.registerMarkedClass(PageSetProvider.XML_TAG_4_ARRAY, ArrayPageSet.class); - StableFactory.registerMarkedClass(ClippedPageProvider.XML_TAG_EC, ClippedECPage.class); - StableFactory.registerMarkedClass(ClippedPageProvider.XML_TAG_CHART, ClippedChartPage.class); - StableFactory.registerMarkedClass(PageGeneratorProvider.XML_TAG_PAGE, PaginateReportPageGenerator.class); - StableFactory.registerMarkedClass(PageGeneratorProvider.XML_TAG_POLY, PolyReportPageGenerator.class); - StableFactory.registerMarkedClass(PageGeneratorProvider.XML_TAG_SHEET, SheetPageGenerator.class); - StableFactory.registerMarkedClass(PagePainterProvider.XML_TAG_4_PDF, PDF2Painter.class); - StableFactory.registerMarkedClass(BridgeMark.SUBMIT_BUTTON, FormSubmitButton.class); - StableFactory.registerMarkedClass(FormOperator.MARK_STRING, DefaultFormOperator.class); - StableFactory.registerMarkedClass(Module.FORM_MODULE, Form.class); - StableFactory.registerMarkedClass(ParameterUI.FORM_XML_TAG, FormParameterUI.class); - StableFactory.registerMarkedClass(FormHyperlinkProvider.XML_TAG, FormHyperlink.class); - StableFactory.registerMarkedObject(WidgetSwitcher.XML_TAG, new DefaultSwitcherImpl()); - StableFactory.registerMarkedClass(ExtraFormClassManagerProvider.XML_TAG, ExtraFormClassManager.class); - StableFactory.registerXMLDescription(BaseChartCollection.XML_TAG, new ChartCollection()); - StableFactory.registerXMLDescription(Parameter.XML_TAG, new Parameter()); - FineRuntime.start(); - GeneralXMLTools.Object_Tokenizer = new ReportXMLUtils.ReportObjectTokenizer(); - GeneralXMLTools.Object_XML_Writer_Finder = new ReportXMLUtils.ReportObjectXMLWriterFinder(); - DaoContext.setEntityDao(new LocalEntityDao()); - DaoContext.setClassHelperDao(new LocalClassHelperDao()); - DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); - Configurations.setHelper(new LocalConfigurationHelper()); - - IOFileAttrMarkManager.register(new CalculatorAttrMark()); - } - - @Before - public void before() { - Whitebox.setInternalState(XMLEncryptUtils.class, "KEY", new XMLEncryptKey()); - } - - @Test - public void testUnsupportedCompile() { - WorkBook workbook = readCpt("read-write-expand-order.cpt"); - - CptxTemplatePool pool = EasyMock.mock(CptxTemplatePool.class); - PowerMock.mockStatic(CptxTemplatePool.class); - EasyMock.expect(CptxTemplatePool.getInstance()).andReturn(pool).anyTimes(); - - PowerMock.replay(CptxTemplatePool.class); - pool.addCptxTemplate(EasyMock.anyString(), matchUnsupportedWebPreviewCptxTemplate()); - EasyMock.expectLastCall().once(); - - EasyMock.replay(pool); - TemplateTransformer.compileCPTX(workbook, new MemFILE("read-write-expand-order.cpt")); - - EasyMock.verify(pool); - PowerMock.verify(CptxTemplatePool.class); - - } - - @Test - public void testImageRefCompile() { - WorkBook workbook = readCpt("read-write-image-ref.cpt"); - - CptxTemplatePool pool = EasyMock.mock(CptxTemplatePool.class); - PowerMock.mockStatic(CptxTemplatePool.class); - EasyMock.expect(CptxTemplatePool.getInstance()).andReturn(pool).anyTimes(); - - PowerMock.replay(CptxTemplatePool.class); - pool.addCptxTemplate(EasyMock.anyString(), matchImageRefWebPreviewCptxTemplate()); - EasyMock.expectLastCall().once(); - - EasyMock.replay(pool); - TemplateTransformer.compileCPTX(workbook, new MemFILE("read-write-image-ref.cpt")); - - EasyMock.verify(pool); - PowerMock.verify(CptxTemplatePool.class); - - } - - private CptxTemplate matchImageRefWebPreviewCptxTemplate() { - EasyMock.reportMatcher(new IArgumentMatcher() { - @Override - public boolean matches(Object argument) { - if (argument instanceof CptxTemplate) { - CptxTemplate cptxTemplate = (CptxTemplate) argument; - Assert.assertNotNull(cptxTemplate.getTemplate()); - Assert.assertNotNull(cptxTemplate.getTemplate().getCompileResult()); - Assert.assertEquals(1, cptxTemplate.getTemplate().getCompileResult().getCellBlocks().length); - Assert.assertNotNull(cptxTemplate.getTemplate().getCompileResult().getCellBlocks()[0].getDataStructure()); - Assert.assertNotNull(cptxTemplate.getTemplate().getCompileResult().getCellBlocks()[0].getDataStructure().getCells()); - CellTemplate cellTemplate = cptxTemplate.getTemplate().getCompileResult().getCellBlocks()[0].getDataStructure().getCells().get(CellKey.fromString("A2")); - Assert.assertNotNull(cellTemplate); - Calculable calculable = cellTemplate.getCalculable(); - ConstantCalculable constantCalculable = calculable.unWrap(ConstantCalculable.KEY); - Assert.assertNotNull(constantCalculable); - Assert.assertTrue(constantCalculable.get() instanceof ImageResourceRef); - return true; - } - return false; - } - - @Override - public void appendTo(StringBuffer buffer) { - buffer.append("cptx template should be previewed on the web side but not."); - } - }); - return null; - } - - private CptxTemplate matchUnsupportedWebPreviewCptxTemplate() { - EasyMock.reportMatcher(new IArgumentMatcher() { - @Override - public boolean matches(Object argument) { - if (argument instanceof CptxTemplate) { - CptxTemplate cptxTemplate = (CptxTemplate) argument; - Assert.assertEquals("unsupported feature: sort after expand", - cptxTemplate.getMetadata().getFailMessage()); - return true; - } - return false; - } - - @Override - public void appendTo(StringBuffer buffer) { - buffer.append("should find unsupported error message but not"); - } - }); - return null; - } - - private static WorkBook readCpt(String subPath) { - InputStream is = TemplateTransformerDebugTest.class.getClassLoader().getResourceAsStream("cpt/" + subPath); - WorkBook wb = new WorkBook(); - try { - wb.readStream(EncryptUtils.decodeInputStream(is)); - } catch (Exception e) { - throw new RuntimeException(e); - } - return wb; - } -} diff --git a/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerTest.java deleted file mode 100644 index e0afe9313..000000000 --- a/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TemplateTransformerTest.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.fr.nx.app.designer.toolbar; - -import com.fr.base.FRContext; -import com.fr.base.operator.common.CommonOperator; -import com.fr.file.FILE; -import com.fr.file.filetree.FileNodes; -import com.fr.invoke.Reflect; -import org.easymock.EasyMock; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.easymock.PowerMock; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import static com.fr.nx.app.designer.toolbar.TemplateTransformer.OTHER; -import static com.fr.nx.app.designer.toolbar.TemplateTransformer.TO_CPT; -import static com.fr.nx.app.designer.toolbar.TemplateTransformer.TO_CPTX; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({FRContext.class}) -@PowerMockIgnore({"sun.tools.attach.*", "com.sun.tools.*", "com.fr.license.*"}) -public class TemplateTransformerTest { - - @Test - public void testParse() { - assertEquals(TO_CPTX, TemplateTransformer.parse("/sdf/abc.cpt")); - assertEquals(TO_CPT, TemplateTransformer.parse("/sdf/abc.cptx")); - assertEquals(OTHER, TemplateTransformer.parse("/sdf/abc.frm")); - assertEquals(OTHER, TemplateTransformer.parse(null)); - assertEquals(OTHER, TemplateTransformer.parse("abc")); - } - - @Test - public void testCompileFailed() { - TransformResultInfo result = TemplateTransformer.compileCPTX(null, null); - assertEquals(result.getResult(), TransformResult.FAILED); - } - - @Test - public void testGenerateNewPath() { - assertEquals(generateNewPath("/abc/dd.cpt", ".cpt", ".cptx"), "/abc/dd.cptx"); - assertEquals(generateNewPath("/abc/dd.cptx", ".cpt", ".cptx"), "/abc/dd.cptx"); - assertEquals(generateNewPath("/abc/dd.cptx", ".cptx", ".cpt"), "/abc/dd.cpt"); - assertEquals(generateNewPath("/abc/dd.frm", ".cpt", ".cptx"), "/abc/dd.frm"); - assertNull(generateNewPath(null, null, null)); - assertEquals(generateNewPath("abc", null, null), "abc"); - } - - private String generateNewPath(String oldPath, String oldSuffix, String newSuffix) { - return Reflect.on(TemplateTransformer.class).call("generateNewPath", oldPath, oldSuffix, newSuffix).get(); - } - - @Test - public void testCreateOutputFile() { - CommonOperator commonOperator = EasyMock.mock(CommonOperator.class); - FileNodes fileNodes = EasyMock.mock(FileNodes.class); - EasyMock.expect(fileNodes.getSupportedTypes()).andReturn(new String[]{"cptx"}).anyTimes(); - PowerMock.mockStatic(FRContext.class); - EasyMock.expect(FRContext.getCommonOperator()).andReturn(commonOperator).anyTimes(); - EasyMock.expect(FRContext.getFileNodes()).andReturn(fileNodes).anyTimes(); - EasyMock.expect(commonOperator.getWebRootPath()).andReturn("/WebInf/").anyTimes(); - EasyMock.replay(commonOperator, fileNodes); - PowerMock.replayAll(); - FILE file1 = TemplateTransformer.createOutputFile("WorkBook1.cpt", ".cpt", ".cptx"); - FILE file2 = TemplateTransformer.createOutputFile("WorkBook1.cpt", ".cptx", ".cpt"); - assertEquals("WorkBook1.cptx", file1.getPath()); - assertEquals("WorkBook1.cpt", file2.getPath()); - } - - - @Test - public void testNeedDoAfterTransformed() { - Assert.assertTrue(needDoAfterTransformed(TransformResult.SUCCESS)); - Assert.assertTrue(needDoAfterTransformed(TransformResult.UNSUPPORT)); - Assert.assertFalse(needDoAfterTransformed(TransformResult.FAILED)); - } - - private boolean needDoAfterTransformed(TransformResult result) { - return Reflect.on(TemplateTransformer.class).call("needDoAfterTransformed", result).get(); - } -} diff --git a/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TransformResultInfoTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TransformResultInfoTest.java deleted file mode 100644 index 66a32b95f..000000000 --- a/designer-base/src/test/java/com/fr/nx/app/designer/toolbar/TransformResultInfoTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.fr.nx.app.designer.toolbar; - -import com.fr.locale.InterProviderFactory; -import org.junit.Assert; -import org.junit.Test; - -/** - * Created by kerry on 2020-01-15 - */ -public class TransformResultInfoTest { - @Test - public void testGetTransformLog() { - TransformResultInfo resultInfo1 = TransformResultInfo.generateResult(TransformResult.FAILED, "failed"); - Assert.assertEquals("failed\n" + - InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Failed_Tip"), - resultInfo1.getTransformLog()); - TransformResultInfo resultInfo2 = TransformResultInfo.generateResult(TransformResult.SUCCESS); - Assert.assertEquals(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Success_Tip"), - resultInfo2.getTransformLog()); - TransformResultInfo resultInfo3 = TransformResultInfo.generateResult(TransformResult.UNSUPPORT, "unsupport"); - Assert.assertEquals("unsupport\n" + - InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Transform_Unsupport_Tip"), - resultInfo3.getTransformLog()); - - } - - @Test - public void testSaved() { - TransformResultInfo resultInfo1 = TransformResultInfo.generateResult(TransformResult.FAILED, "failed").saved(false); - Assert.assertFalse(resultInfo1.isSaved()); - } -} diff --git a/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformProgressTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformProgressTest.java deleted file mode 100644 index c0b68c0ab..000000000 --- a/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformProgressTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fr.nx.app.designer.transform; - -import org.junit.Assert; -import org.junit.Test; - -/** - * Created by kerry on 2020-01-15 - */ -public class BatchTransformProgressTest { - @Test - public void testGetProgress(){ - BatchTransformProgress batchTransformProgress = new BatchTransformProgress(100); - Assert.assertEquals(0.0D, batchTransformProgress.getProgress(), 0.0D); - } - - @Test - public void testUpdateProgress(){ - BatchTransformProgress batchTransformProgress = new BatchTransformProgress(100); - for (int i = 0; i < 80; i++) { - batchTransformProgress.updateProgress(); - } - Assert.assertEquals(0.8D, batchTransformProgress.getProgress(), 0.0D); - batchTransformProgress.updateProgress(); - Assert.assertEquals(0.81D, batchTransformProgress.getProgress(), 0.0D); - - } -} diff --git a/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformUtilTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformUtilTest.java deleted file mode 100644 index b3adc1246..000000000 --- a/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformUtilTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.fr.nx.app.designer.transform; - -import com.fr.file.filetree.FileNode; -import org.junit.Assert; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by kerry on 2020-02-14 - */ -public class BatchTransformUtilTest { - @Test - public void testFilterTransformedFile(){ - FileNode[] fileNodes = new FileNode[]{ - new FileNode("test1", false), new FileNode("test2", false) - }; - List transformedFileNodes = new ArrayList(); - FileNode[] result1 = BatchTransformUtil.filterTransformedFile(fileNodes, transformedFileNodes); - Assert.assertEquals(2, result1.length); - - transformedFileNodes.add( new FileNode("test1", false)); - FileNode[] result2 = BatchTransformUtil.filterTransformedFile(fileNodes, transformedFileNodes); - Assert.assertEquals(1, result2.length); - - transformedFileNodes.add( new FileNode("test2", false)); - FileNode[] result3 = BatchTransformUtil.filterTransformedFile(fileNodes, transformedFileNodes); - Assert.assertEquals(0, result3.length); - - transformedFileNodes.add( new FileNode("test3", false)); - FileNode[] result4 = BatchTransformUtil.filterTransformedFile(fileNodes, transformedFileNodes); - Assert.assertEquals(0, result4.length); - } -} diff --git a/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformerTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformerTest.java deleted file mode 100644 index d29d3e742..000000000 --- a/designer-base/src/test/java/com/fr/nx/app/designer/transform/BatchTransformerTest.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.fr.nx.app.designer.transform; - -import org.junit.Before; -import org.junit.Test; - -import java.util.concurrent.CountDownLatch; - -/** - * Created by kerry on 2020-01-15 - */ -// FIXME @kerry 打包失败,暂时先注释 -//@RunWith(value = PowerMockRunner.class) -//@PrepareForTest({CompileTransformUtil.class, PluginContexts.class}) -//@PowerMockIgnore({"sun.tools.attach.*", "com.sun.tools.*"}) -public class BatchTransformerTest { - - private static final int MAXPOOLSIZE = 5; - private static final int COREPOOLSIZE = 3; - private static final String THREAD_NAME_TEMPLATE = "batchtransform-thread-%s"; - - @Before - public void setUp() { -// FineRuntime.start(); -// ExecutorService threadPoolExecutor = new ThreadPoolExecutor(COREPOOLSIZE, MAXPOOLSIZE, -// 0L, TimeUnit.MILLISECONDS, -// new LinkedBlockingQueue(), -// new ThreadFactoryBuilder().setNameFormat(THREAD_NAME_TEMPLATE).build()); -// PowerMock.mockStatic(PluginContexts.class); -// PluginContext pluginContext = EasyMock.mock(PluginContext.class); -// EasyMock.expect(pluginContext.newFixedThreadPool( -// EasyMock.anyInt(), EasyMock.anyObject(ThreadFactory.class))) -// .andReturn(threadPoolExecutor).anyTimes(); -// EasyMock.expect(PluginContexts.currentContext()).andReturn(pluginContext).anyTimes(); -// -// PowerMock.mockStatic(CompileTransformUtil.class); -// TransformResultInfo resultInfo = TransformResultInfo.generateResult(TransformResult.SUCCESS); -// EasyMock.expect(CompileTransformUtil.compileFile(EasyMock.anyObject(FileNode.class))) -// .andReturn(resultInfo).anyTimes(); -// EasyMock.replay(pluginContext); -// PowerMock.replayAll(); - } - - @Test - public void testBatchTransform() { -// final CountDownLatch countDownLatch = new CountDownLatch(2); -// BatchTransformer transformer = new BatchTransformer(new MockUpdateCallBack(countDownLatch)); -// List nodeList = new ArrayList<>(); -// FileNode test1 = new FileNode("path1", false); -// FileNode test2 = new FileNode("path2", false); -// nodeList.add(test1); -// nodeList.add(test2); -// transformer.batchTransform(nodeList); -// try { -// countDownLatch.await(5, TimeUnit.SECONDS); -// } catch (InterruptedException e) { -// Assert.fail(); -// } -// Map transformResults = transformer.getResults(); -// Assert.assertEquals(2, transformResults.size()); -// Assert.assertEquals(TransformResult.SUCCESS, transformResults.get(test1).getResult()); -// Assert.assertEquals(TransformResult.SUCCESS, transformResults.get(test2).getResult()); - - } - - @Test - public void testTransform() { -// final CountDownLatch countDownLatch = new CountDownLatch(1); -// BatchTransformer transformer = new BatchTransformer(new MockUpdateCallBack(countDownLatch)); -// FileNode test = new FileNode("path", false); -// Reflect.on(transformer).call("transform", test); -// try { -// countDownLatch.await(5, TimeUnit.SECONDS); -// } catch (InterruptedException e) { -// Assert.fail(); -// } -// Map transformResults = transformer.getResults(); -// Assert.assertEquals(1, transformResults.size()); -// Assert.assertEquals(TransformResult.SUCCESS, transformResults.get(test).getResult()); - } - - @Test - public void testShutDown() { -// final CountDownLatch countDownLatch = new CountDownLatch(1); -// BatchTransformer transformer = new BatchTransformer(new MockUpdateCallBack(countDownLatch)); -// List nodeList = new ArrayList<>(); -// FileNode test = new FileNode("path", false); -// nodeList.add(test); -// transformer.batchTransform(nodeList); -// transformer.shutDown(); -// try { -// countDownLatch.await(3, TimeUnit.SECONDS); -// } catch (InterruptedException e) { -// Assert.fail(); -// } -// Map transformResults = transformer.getResults(); -// Assert.assertEquals(1, transformResults.size()); -// Assert.assertEquals(TransformResult.SUCCESS, transformResults.get(test).getResult()); - } - - - private class MockUpdateCallBack implements UpdateCallBack { - private CountDownLatch countDownLatch; - - - public MockUpdateCallBack(CountDownLatch countDownLatch) { - this.countDownLatch = countDownLatch; - } - - @Override - public void updateProgress(double progress) { - countDownLatch.countDown(); - } - - @Override - public void shutDown() { - - } - - @Override - public void reset() { - - } - } -} diff --git a/designer-base/src/test/java/com/fr/nx/app/designer/utils/CompileTransformUtilTest.java b/designer-base/src/test/java/com/fr/nx/app/designer/utils/CompileTransformUtilTest.java deleted file mode 100644 index 653bbdef2..000000000 --- a/designer-base/src/test/java/com/fr/nx/app/designer/utils/CompileTransformUtilTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.fr.nx.app.designer.utils; - -import com.fr.base.FRContext; -import com.fr.base.operator.common.CommonOperator; -import com.fr.design.mainframe.JTemplate; -import com.fr.file.FILE; -import com.fr.file.filetree.FileNodes; -import com.fr.nx.app.designer.toolbar.TemplateTransformer; -import org.easymock.EasyMock; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.easymock.PowerMock; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -/** - * Created by kerry on 2019-12-04 - */ -@RunWith(PowerMockRunner.class) -@PrepareForTest({FRContext.class}) -@PowerMockIgnore({"sun.tools.attach.*", "com.sun.tools.*"}) -public class CompileTransformUtilTest { - @Test - public void testGetTargetFile() { - CommonOperator commonOperator = EasyMock.mock(CommonOperator.class); - FileNodes fileNodes = EasyMock.mock(FileNodes.class); - EasyMock.expect(fileNodes.getSupportedTypes()).andReturn(new String[]{"cptx"}).anyTimes(); - PowerMock.mockStatic(FRContext.class); - EasyMock.expect(FRContext.getCommonOperator()).andReturn(commonOperator).anyTimes(); - EasyMock.expect(FRContext.getFileNodes()).andReturn(fileNodes).anyTimes(); - EasyMock.expect(commonOperator.getWebRootPath()).andReturn("/WebInf/").anyTimes(); - EasyMock.replay(commonOperator, fileNodes); - PowerMock.replayAll(); - JTemplate jTemplate1 = EasyMock.mock(JTemplate.class); - FILE file1 = EasyMock.mock(FILE.class); - EasyMock.expect(jTemplate1.getEditingFILE()).andReturn(file1).anyTimes(); - EasyMock.expect(file1.getPath()).andReturn("WorkBook1.cpt").anyTimes(); - EasyMock.replay(jTemplate1, file1); - FILE targetFile = CompileTransformUtil.getTargetFile(jTemplate1, TemplateTransformer.TO_CPTX); - Assert.assertEquals("WorkBook1.cptx", targetFile.getPath()); - - targetFile = CompileTransformUtil.getTargetFile(jTemplate1, TemplateTransformer.TO_CPT); - Assert.assertEquals("WorkBook1.cpt", targetFile.getPath()); - - JTemplate jTemplate2 = EasyMock.mock(JTemplate.class); - FILE file2 = EasyMock.mock(FILE.class); - EasyMock.expect(jTemplate2.getEditingFILE()).andReturn(file2).anyTimes(); - EasyMock.expect(file2.getPath()).andReturn("WorkBook1.cpt").anyTimes(); - EasyMock.replay(jTemplate2, file2); - targetFile = CompileTransformUtil.getTargetFile(jTemplate2, TemplateTransformer.TO_CPTX); - Assert.assertEquals("WorkBook1.cptx", targetFile.getPath()); - - targetFile =CompileTransformUtil.getTargetFile(jTemplate2, TemplateTransformer.TO_CPT); - Assert.assertEquals("WorkBook1.cpt", targetFile.getPath()); - } -} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 3c4cbf70c..86086abdd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -47,6 +47,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -463,9 +464,15 @@ public class VanChartTooltipContentPane extends BasicBeanPane params) { List tableFieldNames = VanChartRichEditorPane.getFieldNames(); + List defaultParams = Arrays.asList(getRichTextFieldNames()); - if (tableFieldNames != null && params != null) { - for (String fieldName : tableFieldNames) { + if (tableFieldNames == null || params == null) { + return; + } + + for (String fieldName : tableFieldNames) { + // 富文本默认参数和数据集字段重名时,显示默认参数 + if (!defaultParams.contains(fieldName)) { params.put(fieldName, "${" + fieldName + "_" + fieldName.hashCode() + "}"); } } diff --git a/designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java deleted file mode 100644 index 2828abef2..000000000 --- a/designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.fr.design.actions; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.dialog.UIDialog; -import com.fr.design.fit.DesignerUIModeConfig; -import com.fr.design.fit.NewJForm; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.menu.MenuKeySet; -import com.fr.report.fit.FitProvider; -import com.fr.report.fit.ReportFitAttr; - -import javax.swing.KeyStroke; -import java.awt.event.ActionEvent; - -/** - * Created by Administrator on 2015/7/6 0006. - */ -public class FormFitAttrAction extends JTemplateAction { - private static final MenuKeySet REPORT_FIT_ATTR_ELEMENTCASE = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'T'; - } - - @Override - public String getMenuName() { - return DesignerUIModeConfig.getInstance().newUIMode() ? - com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_PC_Adaptive_Attr") : - com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); - } - - @Override - public KeyStroke getKeyStroke() { - return null; - } - }; - - public FormFitAttrAction(JTemplate jTemplate) { - super(jTemplate); - initMenuStyle(); - } - - private void initMenuStyle() { - this.setMenuKeySet(REPORT_FIT_ATTR_ELEMENTCASE); - this.setName(getMenuKeySet().getMenuKeySetName() + "..."); - this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(DesignerUIModeConfig.getInstance().newUIMode() ? - "/com/fr/design/images/reportfit/fit.png": - "/com/fr/design/images/reportfit/fit"); - } - - /** - * Action触发事件 - * - * @param e 事件 - */ - @Override - public void actionPerformed(ActionEvent e) { - final JTemplate jwb = getEditingComponent(); - if (jwb == null || !(jwb instanceof NewJForm)) { - return; - } - final FitProvider wbTpl = (FitProvider) jwb.getTarget(); - ReportFitAttr fitAttr = wbTpl.getReportFitAttr(); - NewJForm newJForm = (NewJForm) jwb; - BasicBeanPane attrPane = newJForm.getJFormType().obtainAttrPane(newJForm); - showFitDialog(fitAttr, jwb, wbTpl, attrPane); - } - - private void showFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane attrPane) { - attrPane.populateBean(fitAttr); - UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - @Override - public void doOk() { - wbTpl.setReportFitAttr(attrPane.updateBean()); - jwb.fireTargetModified(); - } - }); - dialog.setVisible(true); - } -} diff --git a/designer-form/src/main/java/com/fr/design/actions/NewFormMobileAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/NewFormMobileAttrAction.java deleted file mode 100644 index 17ec76b83..000000000 --- a/designer-form/src/main/java/com/fr/design/actions/NewFormMobileAttrAction.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.fr.design.actions; - - -import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWAbsoluteBodyLayout; -import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.fit.NewJForm; -import com.fr.design.fit.common.AdaptiveSwitchUtil; -import com.fr.design.fit.common.TemplateTool; -import com.fr.design.form.mobile.FormMobileAttrPane; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.FormArea; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.JForm; -import com.fr.design.mainframe.WidgetPropertyPane; -import com.fr.file.FILE; -import com.fr.form.main.Form; -import com.fr.form.main.mobile.FormMobileAttr; -import com.fr.record.analyzer.EnableMetrics; -import com.fr.stable.StringUtils; - -import java.awt.event.ActionEvent; - -/** - * Created by fanglei on 2016/11/14. - */ -@EnableMetrics -public class NewFormMobileAttrAction extends FormMobileAttrAction { - - public NewFormMobileAttrAction(JForm jf) { - super(jf); - } - - /** - * 执行动作 - * - * @return 是否执行成功 - */ - @Override - public void actionPerformed(ActionEvent e) { - final JForm jf = getEditingComponent(); - if (jf == null) { - return; - } - final Form formTpl = jf.getTarget(); - FormMobileAttr mobileAttr = formTpl.getFormMobileAttr(); - - final FormMobileAttrPane mobileAttrPane = new FormMobileAttrPane(); - mobileAttrPane.populateBean(mobileAttr); - - final boolean oldMobileOnly = mobileAttr.isMobileOnly(); - final boolean oldAdaptive = mobileAttr.isAdaptivePropertyAutoMatch(); - BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - @Override - public void doOk() { - FormMobileAttr formMobileAttr = mobileAttrPane.updateBean(); - if (formMobileAttr.isMobileOnly() && jf.getTarget().getAttrMark(MobileOnlyTemplateAttrMark.XML_TAG) == null) { - // 如果是老模板,选择手机专属之后需要另存为 - FILE editingFILE = jf.getEditingFILE(); - if (editingFILE != null && editingFILE.exists()) { - String fileName = editingFILE.getName().substring(0, editingFILE.getName().length() - jf.suffix().length()) + "_mobile"; - if (!jf.saveAsTemplate(true, fileName)) { - return; - } - } - // 放到后面。如果提前 return 了,则仍然处于未设置状态,不要添加 - jf.getTarget().addAttrMark(new MobileOnlyTemplateAttrMark()); - } - // 设置移动端属性并刷新界面 - formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 - boolean changeSize = (!oldMobileOnly && formMobileAttr.isMobileOnly()) || (oldMobileOnly && !formMobileAttr.isMobileOnly()); - if (changeSize) { - ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); - } - //改变布局为自适应布局,只在移动端属性设置保存后改变一次 - boolean changeLayout = !oldAdaptive && formMobileAttr.isAdaptivePropertyAutoMatch(); - if (changeLayout) { - jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); - doChangeBodyLayout(); - WidgetPropertyPane.getInstance().refreshDockingView(); - } - jf.fireTargetModified(); - FILE editingFILE = jf.getEditingFILE(); - if(editingFILE != null && editingFILE.exists()){ - JForm jForm = getEditingComponent(); - TemplateTool.saveForm(jForm); - if (jForm instanceof NewJForm) { - AdaptiveSwitchUtil.switch2OldUI(); - } - }else { - AdaptiveSwitchUtil.switch2OldUIMode(); - NewJForm mobileJForm = new NewJForm(jf.getTarget(), jf.getEditingFILE()); - //设置临时的id,和新建的模板区分 - mobileJForm.getTarget().setTemplateID(StringUtils.EMPTY); - TemplateTool.resetTabPaneEditingTemplate(mobileJForm); - TemplateTool.activeAndResizeTemplate(mobileJForm); - } - } - }); - dialog.setVisible(true); - } - - private void doChangeBodyLayout(){ - FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - XLayoutContainer rootLayout = formDesigner.getRootComponent(); - if (rootLayout.getComponentCount() == 1 && rootLayout.getXCreator(0).acceptType(XWAbsoluteBodyLayout.class)) { - rootLayout = (XWAbsoluteBodyLayout) rootLayout.getXCreator(0); - } - ((XWFitLayout)formDesigner.getRootComponent()).switch2FitBodyLayout(rootLayout); - } -} - diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java index f10b877e2..e2aa7f152 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java @@ -54,7 +54,7 @@ public interface LayoutAdapter { * @return 是否添加成功,成功返回true,否则false */ boolean addBean(XCreator creator, int x, int y, boolean accept); - + /** * 返回该布局管理适配器的Painter,为容器提供放置位置的标识。 */ 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 e316bf2b6..a6a29339e 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 @@ -267,9 +267,6 @@ public class XChartEditor extends XBorderStyleWidgetCreator { if (editingMouseListener.stopEditing()) { if (this != (XCreator) designer.getRootComponent()) { ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); - if (isEditing) { - EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); - } editingMouseListener.startEditing(this, isEditing ? adapter.getDesignerEditor() : null, adapter); if (isEditing) { EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); 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 86d9366de..da268b0e6 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 @@ -14,7 +14,6 @@ import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI; -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.form.layout.FRAbsoluteLayout; import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.XCreatorConstants; @@ -31,6 +30,7 @@ import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WLayout; +import com.fr.general.FRScreen; import com.fr.general.IOUtils; import com.fr.share.ShareConstants; @@ -111,7 +111,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { private void initPercent(WAbsoluteLayout widget) { Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension scrnsize = toolkit.getScreenSize(); - double screenValue = DesignerUIModeConfig.getInstance().getDesignScreenByDimension(scrnsize).getValue(); + double screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue(); if (!AssistUtils.equals(screenValue, FormArea.DEFAULT_SLIDER)) { this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); } @@ -247,7 +247,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { */ @Override public void updateChildBound(int minHeight) { - double prevContainerPercent = DesignerUIModeConfig.getInstance().getDesignScreenByDimension(toData().getDesigningResolution()).getValue() / FormArea.DEFAULT_SLIDER; + double prevContainerPercent = FRScreen.getDesignScreenByDimension(toData().getDesigningResolution()).getValue() / FormArea.DEFAULT_SLIDER; if (toData().getCompState() == 0 && !AssistUtils.equals(containerPercent, prevContainerPercent)) { for (int i = 0; i < this.getComponentCount(); i++) { XCreator creator = getXCreator(i); 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 450dfeae3..6d55c658f 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 @@ -6,7 +6,6 @@ import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.properties.mobile.BodyMobilePropertyUI; -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.form.layout.FRFitLayout; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.mainframe.FormArea; @@ -21,6 +20,7 @@ import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WLayout; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; +import com.fr.general.FRScreen; import com.fr.stable.ArrayUtils; import com.fr.stable.AssistUtils; import javax.swing.JOptionPane; @@ -72,7 +72,7 @@ public class XWFitLayout extends XLayoutContainer { private void initPercent(){ Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension scrnsize = toolkit.getScreenSize(); - double screenValue = DesignerUIModeConfig.getInstance().getDesignScreenByDimension(scrnsize).getValue(); + double screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue(); if (!AssistUtils.equals(FormArea.DEFAULT_SLIDER, screenValue)) { this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); } diff --git a/designer-form/src/main/java/com/fr/design/fit/DesignerUIModeConfig.java b/designer-form/src/main/java/com/fr/design/fit/DesignerUIModeConfig.java deleted file mode 100644 index 5e743d383..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/DesignerUIModeConfig.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.fr.design.fit; - -import com.fr.base.ScreenResolution; -import com.fr.design.fun.ReportLengthUNITProvider; -import com.fr.design.unit.UnitConvertUtil; -import com.fr.general.ComparatorUtils; -import com.fr.general.FRScreen; -import com.fr.stable.Constants; - -import java.awt.Dimension; - -/** - * Created by kerry on 2020-06-05 - */ -public class DesignerUIModeConfig { - private DesignerUIMode mode = DesignerUIMode.NEW_UI_MODE; - - private static class DesignerUIModeConfigHolder { - private static final DesignerUIModeConfig designerUIModeConfig = new DesignerUIModeConfig(); - } - - private DesignerUIModeConfig() { - - } - - public static DesignerUIModeConfig getInstance() { - return DesignerUIModeConfigHolder.designerUIModeConfig; - } - - - /** - * 判断是否是新ui模式 - * - * @return boolean - */ - public boolean newUIMode() { - return ComparatorUtils.equals(DesignerUIMode.NEW_UI_MODE, mode); - } - - /** - * 设置新ui模式 - */ - public void setNewUIMode() { - this.mode = DesignerUIMode.NEW_UI_MODE; - } - - /** - * 设置老ui模式 - */ - public void setOldUIMode() { - this.mode = DesignerUIMode.OLD_UI_MODE; - } - - /** - * 解析不同模式下的尺寸单位 - * - * @param unitType 尺寸类型 - * @return ReportLengthUNITProvider对象 - */ - public ReportLengthUNITProvider parseLengthUNIT(int unitType) { - return mode.parseLengthUNIT(unitType); - } - - /** - * 获取不同模式下的屏幕分辨率 - * - * @return 分辨率 - */ - public int getScreenResolution() { - return mode.getScreenResolution(); - } - - /** - * 根据屏幕尺寸获取设计时的FRScreen - * - * @param screen 屏幕尺寸 - * @return FRScreen - */ - public FRScreen getDesignScreenByDimension(Dimension screen) { - return mode.getDesignScreenByDimension(screen); - } - - private enum DesignerUIMode { - OLD_UI_MODE { - @Override - protected ReportLengthUNITProvider parseLengthUNIT(int unitType) { - return UnitConvertUtil.parseLengthUNIT(unitType); - } - - @Override - protected FRScreen getDesignScreenByDimension(Dimension screen) { - return FRScreen.getDesignScreenByDimension(screen); - } - - @Override - protected int getScreenResolution() { - return ScreenResolution.getScreenResolution(); - } - }, - NEW_UI_MODE { - @Override - protected ReportLengthUNITProvider parseLengthUNIT(int unitType) { - return new PXReportLengthUNIT(); - } - - @Override - protected FRScreen getDesignScreenByDimension(Dimension screen) { - return FRScreen.p1440; - } - - @Override - protected int getScreenResolution() { - return Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION; - } - }; - - protected abstract ReportLengthUNITProvider parseLengthUNIT(int unitType); - - protected abstract FRScreen getDesignScreenByDimension(Dimension screen); - - protected abstract int getScreenResolution(); - } - -} diff --git a/designer-form/src/main/java/com/fr/design/fit/FitStateCompatible.java b/designer-form/src/main/java/com/fr/design/fit/FitStateCompatible.java deleted file mode 100644 index 06934e98e..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/FitStateCompatible.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.fr.design.fit; - -/** - * Created by kerry on 2020-04-27 - */ -public enum FitStateCompatible { - DOUBLE_FIT(2, 0), - HOR_FIT(1, 1), - NO_FIT(3, 2); - - private final int newType; - private final int oldType; - - FitStateCompatible(int oldType, int newType) { - this.oldType = oldType; - this.newType = newType; - } - - public static int getNewTypeFromOld(int oldValue) { - for (FitStateCompatible compatible : values()) { - if (compatible.oldType == oldValue) { - return compatible.newType; - } - } - return DOUBLE_FIT.newType; - } - - public static int getOldTypeFromNew(int newValue) { - for (FitStateCompatible compatible : values()) { - if (compatible.newType == newValue) { - return compatible.oldType; - } - } - return DOUBLE_FIT.oldType; - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/JFormType.java b/designer-form/src/main/java/com/fr/design/fit/JFormType.java deleted file mode 100644 index 7fe795c6f..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/JFormType.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.fr.design.fit; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.fit.common.AdaptiveSwitchUtil; -import com.fr.form.fit.NewFormMarkAttr; -import com.fr.form.fit.config.FormFitConfig; -import com.fr.design.fit.menupane.FormFitAttrPane; -import com.fr.design.fun.PreviewProvider; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.preview.FormAdaptivePreview; -import com.fr.design.preview.FormPreview; -import com.fr.design.report.fit.menupane.ReportFitAttrPane; -import com.fr.form.main.Form; -import com.fr.report.fit.ReportFitAttr; - -public enum JFormType { - OLD_TYPE(0, new FormPreview()) { - @Override - public void switchUI() { - AdaptiveSwitchUtil.switch2OldUI(); - } - - @Override - public void switchUIMode() { - AdaptiveSwitchUtil.switch2OldUIMode(); - } - - @Override - public ReportFitAttr obtainFitAttr() { - return FormFitConfig.getInstance().getOldFitAttr(); - } - - @Override - public void updateFitAttr(ReportFitAttr attr) { - FormFitConfig.getInstance().setOldFitAttr(attr); - } - - @Override - public BasicBeanPane obtainAttrPane(NewJForm newJForm) { - return new ReportFitAttrPane(); - } - - }, - NEW_TYPE(1, new FormAdaptivePreview()) { - @Override - public void switchUI() { - AdaptiveSwitchUtil.switch2NewUI(); - } - - @Override - public void switchUIMode() { - AdaptiveSwitchUtil.switch2NewUIMode(); - } - - @Override - public ReportFitAttr obtainFitAttr() { - return FormFitConfig.getInstance().getNewFitAttr(); - } - - @Override - public void updateFitAttr(ReportFitAttr attr) { - FormFitConfig.getInstance().setNewFitAttr(attr); - } - - @Override - public BasicBeanPane obtainAttrPane(NewJForm newJForm) { - return new FormFitAttrPane(newJForm); - } - }; - private int type; - private boolean newType; - private PreviewProvider previewType; - - JFormType(int type, PreviewProvider previewType) { - this.type = type; - this.newType = (type == 1); - this.previewType = previewType; - } - - public int getType() { - return type; - } - - public boolean isNewType() { - return newType; - } - - public PreviewProvider getPreviewType() { - return previewType; - } - - public abstract void switchUI(); - - public abstract void switchUIMode(); - - public abstract ReportFitAttr obtainFitAttr(); - - public abstract void updateFitAttr(ReportFitAttr attr); - - public abstract BasicBeanPane obtainAttrPane(NewJForm newJForm); - - /** - * @Description: 更新模板的标志位 - * @param jTemplate - * @return: - * @Author: Henry.Wang - * @date: 2020/12/17 16:17 - */ - public void updateJFromTemplateType(JTemplate jTemplate) { - if (jTemplate instanceof NewJForm) { - NewJForm newJForm = (NewJForm) jTemplate; - Form form = newJForm.getTarget(); - NewFormMarkAttr newFormMarkAttr = form.getAttrMark(NewFormMarkAttr.XML_TAG); - if (newFormMarkAttr == null) { - newFormMarkAttr = new NewFormMarkAttr(this.getType()); - form.addAttrMark(newFormMarkAttr); - } - newFormMarkAttr.setType(this.getType()); - newJForm.setJFormType(this); - } - } - - /** - * @Description: 更新预览方式 - * @param jTemplate - * @return: - * @Author: Henry.Wang - * @date: 2020/12/17 16:17 - */ - public void updatePreviewType(JTemplate jTemplate) { - jTemplate.setPreviewType(this.getPreviewType()); - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java deleted file mode 100644 index 4df8b4386..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.fr.design.fit; - -import com.fr.base.DynamicUnitList; -import com.fr.design.actions.TemplateParameterAction; -import com.fr.design.designer.beans.AdapterBus; -import com.fr.design.designer.beans.LayoutAdapter; -import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter; -import com.fr.design.designer.beans.events.DesignerEditListener; -import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.creator.*; -import com.fr.design.fit.common.AdaptiveSwitchUtil; -import com.fr.design.fit.common.LayoutTool; -import com.fr.form.fit.NewFormMarkAttr; -import com.fr.design.fit.common.TemplateTool; -import com.fr.design.actions.FormFitAttrAction; -import com.fr.design.actions.NewFormMobileAttrAction; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.preview.DeveloperPreview; -import com.fr.design.preview.FormAdaptivePreview; -import com.fr.design.fit.toolbar.SwitchAction; -import com.fr.design.fun.PreviewProvider; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.JForm; -import com.fr.design.mainframe.WidgetPropertyPane; -import com.fr.design.menu.ShortCut; -import com.fr.design.preview.FormPreview; -import com.fr.design.preview.MobilePreview; -import com.fr.design.utils.ComponentUtils; -import com.fr.file.FILE; -import com.fr.form.FormElementCaseProvider; -import com.fr.form.main.Form; -import com.fr.form.main.mobile.FormMobileAttr; -import com.fr.form.ui.ElementCaseEditor; -import com.fr.stable.ArrayUtils; - -import javax.swing.JComponent; -import java.awt.Dimension; -import java.awt.Rectangle; - - -/** - * Created by kerry on 2020-05-31 - */ -public class NewJForm extends JForm { - private static final int FUZZY_EDGE = 10; - private static final int TITLE_HEIGHT = 36; - private JFormType jFormType; - - public NewJForm() { - super(); - init(); - changePaneSize(); - } - - public NewJForm(Form form, FILE file) { - super(form, file); - if (DesignerUIModeConfig.getInstance().newUIMode()) { - init(); - } - changePaneSize(); - } - - /** - * @Description:改变body的大小,主要针对新模式下打开老模板出现截断的情况 - * @param - * @return: - * @Author: Henry.Wang - * @date: 2020/9/13 23:23 - */ - private void changePaneSize() { - if (mobileForm()) - return; - NewFormMarkAttr newFormMarkAttr = this.getTarget().getAttrMark(NewFormMarkAttr.XML_TAG); - if (newFormMarkAttr.isNotSetOriginSize()) { - newFormMarkAttr.setBodyHeight(LayoutTool.getBodyHeight(this)); - newFormMarkAttr.setBodyWidth(LayoutTool.getBodyWidth(this)); - return; - } - //这种是针对body为绝对布局时,可能出现截断的情况 - if (LayoutTool.absoluteLayoutForm(this)) { - int bodyHeight = newFormMarkAttr.getBodyHeight(); - int bodyWidth = newFormMarkAttr.getBodyWidth(); - Rectangle rectangle = LayoutTool.getAbsoluteBodySize(this); - if (!isNewJFrom() && (rectangle.width != bodyWidth || rectangle.height != bodyHeight)) { - TemplateTool.onlyChangeAbsoluteBodySize(bodyHeight, bodyWidth, this); - } else if(isNewJFrom()){ - if (rectangle.width > bodyWidth && rectangle.height > bodyHeight) { - TemplateTool.onlyChangeAbsoluteBodySize(rectangle.height, rectangle.width, this); - } else if (rectangle.width > bodyWidth) { - TemplateTool.onlyChangeAbsoluteBodySize(bodyHeight, rectangle.width, this); - } else if (rectangle.height > bodyHeight) { - TemplateTool.onlyChangeAbsoluteBodySize(rectangle.height, bodyWidth, this); - } - } - } else if (AdaptiveSwitchUtil.isSwitchJFromIng()) { - //这种是针对body中有绝对画布块,导致截断的情况 - double scale = LayoutTool.getContainerPercent(); - if (isNewJFrom()) { - LayoutTool.scaleAbsoluteBlockComponentsBounds(this.getFormDesign().getRootComponent(), 1 / scale); - } else { - LayoutTool.scaleAbsoluteBlockComponentsBounds(this.getFormDesign().getRootComponent(), scale); - } - } - } - - public JFormType getJFormType() { - return this.jFormType; - } - - public void setJFormType(JFormType jFormType) { - this.jFormType = jFormType; - } - - - /** - * 模板菜单 - * - * @return 返回菜单 - */ - @Override - public ShortCut[] shortcut4TemplateMenu() { - if (this.index == FORM_TAB) { - return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), new FormFitAttrAction(this)}, new ShortCut[0]); - } else { - return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), new FormFitAttrAction(this)}, this.getElementCaseDesign().shortcut4TemplateMenu()); - } - } - - - private void init() { - this.getFormDesign().addDesignerEditListener(new DesignerEditListener() { - private Rectangle oldRec; - - @Override - public void fireCreatorModified(DesignerEvent evt) { - if (evt.getAffectedCreator() == null) { - return; - } - if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) { - XComponent affectedCreator = evt.getAffectedCreator(); - if (isElementCase((JComponent) affectedCreator)) { - processAbsorbingEffect((XWTitleLayout) affectedCreator); - } - } - if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { - XComponent affectedCreator = evt.getAffectedCreator(); - oldRec = new Rectangle(affectedCreator.getBounds()); - } - } - - private boolean isElementCase(JComponent component) { - return component.getComponents().length > 0 && component.getComponent(0) instanceof XElementCase; - } - - private void processAbsorbingEffect(XWTitleLayout xwTitleLayout) { - NewJForm.this.getFormDesign().repaint(); - Dimension bound = new Dimension(xwTitleLayout.getSize()); - ElementCaseEditor elementCaseEditor = (ElementCaseEditor) xwTitleLayout.toData().getBodyBoundsWidget().getWidget(); - FormElementCaseProvider elementCase = elementCaseEditor.getElementCase(); - if (oldRec.width != bound.width) { - processColumnAbsorbingEffect(xwTitleLayout, elementCase.getColumnWidthList_DEC(), bound); - oldRec.width = bound.width; - } - if (oldRec.height != bound.height) { - processRowAbsorbingEffect(xwTitleLayout, elementCase.getRowHeightList_DEC(), bound); - oldRec.height = bound.height; - } - NewJForm.this.getFormDesign().refreshDesignerUI(); - } - - private boolean hasTitle(XWTitleLayout xwTitleLayout) { - return xwTitleLayout.getComponentCount() > 1; - } - - private void processColumnAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList columnUnitList, Dimension bound) { - int temp = 0; - int resolution = DesignerUIModeConfig.getInstance().getScreenResolution();; - int difference = 0; - int i = 0; - while (true) { - if (i < columnUnitList.size()) { - temp += columnUnitList.get(i++).toPixI(resolution); - } else { - //在处理吸附效果时,columnUnitList数组长度可能比实际显示的列数少,所以用默认值来补充 - temp += columnUnitList.getDefaultUnit().toPixI(resolution); - } - if (bound.width - temp < 0) { - break; - } - if (bound.width - temp < FUZZY_EDGE) { - difference = bound.width - temp; - bound.width = temp; - break; - } - } - fixLayout(xwTitleLayout, bound, difference, 0); - } - - private void processRowAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList rowUnitList, Dimension bound) { - int temp = hasTitle(xwTitleLayout) ? TITLE_HEIGHT : 0; - int resolution =DesignerUIModeConfig.getInstance().getScreenResolution(); - int difference = 0; - int i = 0; - while (true) { - if (i < rowUnitList.size()) { - temp += rowUnitList.get(i++).toPixI(resolution); - } else { - //在处理吸附效果时,rowUnitList数组长度可能比实际显示的行数少,所以用默认值来补充 - temp += rowUnitList.getDefaultUnit().toPixI(resolution); - } - if (bound.height - temp < 0) { - break; - } - if (bound.height - temp < FUZZY_EDGE) { - difference = bound.height - temp; - bound.height = temp; - break; - } - } - fixLayout(xwTitleLayout, bound, difference, 1); - } - - - private void fixLayout(XWTitleLayout xwTitleLayout, Dimension bound, int difference, int row) { - Rectangle backupBounds = getBound(xwTitleLayout); - xwTitleLayout.setSize(bound); - FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - LayoutAdapter adapter = AdapterBus.searchLayoutAdapter(formDesigner, xwTitleLayout); - if (adapter instanceof FRFitLayoutAdapter) { - FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) adapter; - layoutAdapter.setEdit(true); - layoutAdapter.calculateBounds(backupBounds, xwTitleLayout.getBounds(), xwTitleLayout, row, difference); - } - XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xwTitleLayout); - if (parent != null && parent.toData() != null) { - parent.toData().setBounds(xwTitleLayout.toData(), xwTitleLayout.getBounds()); - } - - } - - }); - } - - - public Rectangle getBound(XWTitleLayout creator) { - Rectangle bounds = new Rectangle(creator.getBounds()); - if (creator.getParent() == null) { - return bounds; - } - Rectangle rec = ComponentUtils.getRelativeBounds(creator.getParent()); - bounds.x += rec.x; - bounds.y += rec.y; - return bounds; - - } - - @Override - public PreviewProvider[] supportPreview() { - if (isNewJFrom()) { - return new PreviewProvider[]{new FormAdaptivePreview(), new DeveloperPreview(), new MobilePreview()}; - } - return new PreviewProvider[]{new FormPreview(), new MobilePreview()}; - } - - public boolean mobileForm() { - FormMobileAttr mobileAttr = this.getTarget().getFormMobileAttr(); - if (mobileAttr.isMobileOnly() && mobileAttr.isAdaptivePropertyAutoMatch()) { - return true; - } - return false; - } - - private SwitchAction switchAction; - - public UIButton[] createExtraButtons() { - UIButton[] extraButtons = super.createExtraButtons(); - switchAction = new SwitchAction(); - return ArrayUtils.addAll(extraButtons, new UIButton[]{switchAction.getToolBarButton()}); - } - - - public boolean isNewJFrom() { - return jFormType == null || jFormType.isNewType(); - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/PX.java b/designer-form/src/main/java/com/fr/design/fit/PX.java deleted file mode 100644 index 720268ea6..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/PX.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fr.design.fit; - -import com.fr.stable.Constants; -import com.fr.stable.unit.LEN_UNIT; - -public class PX extends LEN_UNIT { - private static final long FU_SCALE = 36576L; - - public PX(float var1) { - super(var1); - } - - - public boolean equals(Object var1) { - return var1 instanceof PX && super.equals(var1); - } - - protected long getMoreFUScale() { - int dpi = DesignerUIModeConfig.getInstance().getScreenResolution(); - return FU_SCALE / dpi; - } - - public static double toPixWithResolution(double value, int resolution) { - return value * resolution / Constants.FR_PAINT_RESOLUTION; - } - -} diff --git a/designer-form/src/main/java/com/fr/design/fit/PXReportLengthUNIT.java b/designer-form/src/main/java/com/fr/design/fit/PXReportLengthUNIT.java deleted file mode 100644 index 8d8f1de16..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/PXReportLengthUNIT.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.fr.design.fit; - -import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; -import com.fr.stable.unit.UNIT; - -/** - * Created by kerry on 2020-04-09 - */ -public class PXReportLengthUNIT extends AbstractReportLengthUNITProvider { - public static final short UNIT_TYPE = 4; - - @Override - public String unitText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Px"); - } - - @Override - public int unitType() { - return UNIT_TYPE; - } - - @Override - public float unit2Value4Scale(UNIT value) { - int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); - return value.toPixF(resolution); - } - - @Override - public UNIT float2UNIT(float value) { - return new PX(value); - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/ElementEditorExtendDefinePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/ElementEditorExtendDefinePane.java deleted file mode 100644 index 3d25590f4..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/attrpane/ElementEditorExtendDefinePane.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.fr.design.fit.attrpane; - -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.design.widget.ui.designer.layout.WTitleLayoutDefinePane; -import com.fr.form.ui.ElementCaseEditor; -import com.fr.form.web.FormToolBarManager; -import com.fr.general.ComparatorUtils; -import com.fr.report.fit.ReportFitAttr; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by kerry on 2020-04-09 - */ -public class ElementEditorExtendDefinePane extends WTitleLayoutDefinePane { - private PaddingBoundPane paddingBoundPane; - private AccessibleElementCaseToolBarEditor elementCaseToolBarEditor; - private PropertyGroupPane extraPropertyGroupPane; - private PcFitExpandablePane pcFitExpandablePane; - - private static final String FIT_STATE_PC = "fitStateInPC"; - - public ElementEditorExtendDefinePane(XCreator xCreator) { - super(xCreator); - } - - protected JPanel createCenterPane() { - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - paddingBoundPane = new PaddingBoundPane(); - elementCaseToolBarEditor = new AccessibleElementCaseToolBarEditor(); - Component[][] components = new Component[][]{ - new Component[]{paddingBoundPane, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_EC_Toolbar")), elementCaseToolBarEditor}, - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); - panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); - CRPropertyDescriptor[] extraTableEditor = removeOldFitEditor(((XElementCase) creator).getExtraTableEditor()); - extraPropertyGroupPane = new PropertyGroupPane(extraTableEditor, creator); - centerPane.add(panel, BorderLayout.NORTH); - if (extraTableEditor.length > 0) { - centerPane.add(extraPropertyGroupPane, BorderLayout.CENTER); - } - pcFitExpandablePane = new PcFitExpandablePane(this); - centerPane.add(pcFitExpandablePane, BorderLayout.SOUTH); - return centerPane; - } - - private CRPropertyDescriptor[] removeOldFitEditor(CRPropertyDescriptor[] extraTableEditor) { - List list = new ArrayList(); - for (CRPropertyDescriptor crPropertyDescriptor : extraTableEditor) { - if (!ComparatorUtils.equals(FIT_STATE_PC, crPropertyDescriptor.getName())) { - list.add(crPropertyDescriptor); - } - } - return list.toArray(new CRPropertyDescriptor[list.size()]); - } - - protected ElementCaseEditor updateSubBean() { - ElementCaseEditor elementCaseEditor = (ElementCaseEditor) creator.toData(); - if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate"))) { - paddingBoundPane.update(elementCaseEditor); - } - elementCaseEditor.setToolBars((FormToolBarManager[]) elementCaseToolBarEditor.getValue()); - ReportFitAttr fitAttr = pcFitExpandablePane.update(); - elementCaseEditor.setReportFitAttr(fitAttr); - return elementCaseEditor; - } - - - protected void populateSubBean(ElementCaseEditor ob) { - paddingBoundPane.populate(ob); - elementCaseToolBarEditor.setValue(ob.getToolBars()); - extraPropertyGroupPane.populate(ob); - pcFitExpandablePane.populate(ob.getReportFitAttr()); - - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteBodyLayoutExtendDefinePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteBodyLayoutExtendDefinePane.java deleted file mode 100644 index 69781e7a6..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteBodyLayoutExtendDefinePane.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.fr.design.fit.attrpane; - -import com.fr.base.io.IOFile; -import com.fr.base.iofile.attr.WatermarkAttr; -import com.fr.design.data.DataCreatorUI; -import com.fr.design.designer.IntervalConstants; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.designer.properties.items.FRLayoutTypeItems; -import com.fr.design.designer.properties.items.Item; -import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.WidgetPropertyPane; -import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor; -import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor; -import com.fr.design.utils.gui.UIComponentUtils; -import com.fr.design.widget.FRWidgetFactory; -import com.fr.design.widget.ui.designer.layout.FRAbsoluteLayoutDefinePane; -import com.fr.form.ui.LayoutBorderStyle; -import com.fr.form.ui.container.WAbsoluteBodyLayout; -import com.fr.form.ui.container.WAbsoluteLayout; -import com.fr.form.ui.container.WBodyLayoutType; -import com.fr.report.core.ReportUtils; - -import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; - -/** - * Created by kerry on 2020-04-22 - */ -public class FRAbsoluteBodyLayoutExtendDefinePane extends FRAbsoluteLayoutDefinePane { - private static final int MAX_LABEL_WIDTH = 80; - - private AccessibleWLayoutBorderStyleEditor borderStyleEditor; - private AccessibleBodyWatermarkEditor watermarkEditor; - - private UIComboBox layoutCombox; - private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE; - - public FRAbsoluteBodyLayoutExtendDefinePane(XCreator xCreator) { - super(xCreator); - } - - - public void initComponent() { - initCenterPane(); - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - borderStyleEditor = new AccessibleWLayoutBorderStyleEditor(); - watermarkEditor = new AccessibleBodyWatermarkEditor(); - JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane( - new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style")), borderStyleEditor}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), watermarkEditor} - }, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); - JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - borderPane.add(jPanel, BorderLayout.CENTER); - UIExpandablePane advancedPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, borderPane); - centerPane.add(advancedPane, BorderLayout.NORTH); - this.add(centerPane, BorderLayout.NORTH); - } - - private void initCenterPane(){ - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - initUIComboBox(); - JPanel thirdPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JPanel jPanel = createThirdPane(); - jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - thirdPane.add(jPanel, BorderLayout.CENTER); - UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, thirdPane); - this.add(layoutExpandablePane, BorderLayout.CENTER); - - } - - public JPanel createThirdPane() { - initLayoutComboBox(); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] rowSize = {p}; - double[] colSize = {p, f}; - - UILabel layoutTypeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type")); - JPanel northPane = TableLayoutHelper.createGapTableLayoutPane( - new Component[][]{ - new Component[]{layoutTypeLabel, UIComponentUtils.wrapWithBorderLayoutPane(layoutCombox)}}, - rowSize, colSize, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - jPanel.add(northPane, BorderLayout.NORTH); - return jPanel; - - } - - public void initLayoutComboBox() { - Item[] items = FRLayoutTypeItems.ITEMS; - DefaultComboBoxModel model = new DefaultComboBoxModel(); - for (Item item : items) { - model.addElement(item); - } - layoutCombox = new UIComboBox(model); - layoutCombox.setSelectedIndex(1); - } - - @Override - public String title4PopupWindow() { - return "absoluteBodyLayout"; - } - - public void populateSubPane(WAbsoluteLayout ob) { - layoutCombox.setSelectedIndex(1); - borderStyleEditor.setValue(ob.getBorderStyle()); - watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile())); - } - - public WAbsoluteBodyLayout updateSubPane() { - WAbsoluteBodyLayout layout = (WAbsoluteBodyLayout) creator.toData(); - Item item = (Item) layoutCombox.getSelectedItem(); - Object value = item.getValue(); - int state = 0; - if (value instanceof Integer) { - state = (Integer) value; - } - - if (layoutType == WBodyLayoutType.ABSOLUTE) { - ((XWFitLayout) creator.getBackupParent()).toData().resetStyle(); - if (state == WBodyLayoutType.FIT.getTypeValue()) { - XWFitLayout xwFitLayout = ((XWFitLayout)creator.getBackupParent()); - xwFitLayout.switch2FitBodyLayout(creator); - copyLayoutAttr(layout, xwFitLayout.toData()); - } - } - layout.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue()); - updateWatermark(); - return layout; - } - - private void updateWatermark() { - WatermarkAttr watermark = (WatermarkAttr) watermarkEditor.getValue(); - if (watermark != null) { - IOFile ioFile = getCurrentIOFile(); - ioFile.addAttrMark(watermark); - } - } - - private IOFile getCurrentIOFile() { - return WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget(); - } - - @Override - public DataCreatorUI dataUI() { - return null; - } - - -} diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteLayoutExtendDefinePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteLayoutExtendDefinePane.java deleted file mode 100644 index 60ffae3eb..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteLayoutExtendDefinePane.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fr.design.fit.attrpane; - -import com.fr.design.designer.creator.XCreator; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.widget.ui.designer.layout.AbstractFRLayoutDefinePane; -import com.fr.form.ui.container.WAbsoluteLayout; - -/** - * Created by kerry on 2020-04-22 - */ -public class FRAbsoluteLayoutExtendDefinePane extends AbstractFRLayoutDefinePane { - - public FRAbsoluteLayoutExtendDefinePane(XCreator xCreator) { - super(xCreator); - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - } - - @Override - public void populateBean(WAbsoluteLayout ob) { - } - - @Override - public WAbsoluteLayout updateBean() { - WAbsoluteLayout wAbsoluteLayout = (WAbsoluteLayout) creator.toData(); - return wAbsoluteLayout; - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/FRFitLayoutExtendDefinePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/FRFitLayoutExtendDefinePane.java deleted file mode 100644 index 3dd0f1c48..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/attrpane/FRFitLayoutExtendDefinePane.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.fr.design.fit.attrpane; - -import com.fr.base.io.IOFile; -import com.fr.base.iofile.attr.WatermarkAttr; -import com.fr.design.data.DataCreatorUI; -import com.fr.design.designer.IntervalConstants; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWAbsoluteBodyLayout; -import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.designer.creator.XWScaleLayout; -import com.fr.design.designer.properties.items.FRLayoutTypeItems; -import com.fr.design.designer.properties.items.Item; -import com.fr.design.foldablepane.UIExpandablePane; -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.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.FormSelectionUtils; -import com.fr.design.mainframe.WidgetPropertyPane; -import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor; -import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor; -import com.fr.design.utils.gui.UIComponentUtils; -import com.fr.design.widget.FRWidgetFactory; -import com.fr.design.widget.ui.designer.component.PaddingBoundPane; -import com.fr.design.widget.ui.designer.layout.AbstractFRLayoutDefinePane; -import com.fr.form.ui.LayoutBorderStyle; -import com.fr.form.ui.Widget; -import com.fr.form.ui.container.WAbsoluteBodyLayout; -import com.fr.form.ui.container.WAbsoluteLayout; -import com.fr.form.ui.container.WBodyLayoutType; -import com.fr.form.ui.container.WFitLayout; -import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; -import com.fr.report.core.ReportUtils; - -import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; - -/** - * Created by kerry on 2020-04-22 - */ -public class FRFitLayoutExtendDefinePane extends AbstractFRLayoutDefinePane { - private static final int ADAPT_LABEL_MAX_WIDTH = 80; - private XWFitLayout xWFitLayout; - private WFitLayout wFitLayout; - private UIComboBox layoutComboBox; - private UISpinner componentIntervel; - private PaddingBoundPane paddingBound; - private AccessibleWLayoutBorderStyleEditor stylePane; - private AccessibleBodyWatermarkEditor watermarkEditor; - - public FRFitLayoutExtendDefinePane(XCreator xCreator) { - super(xCreator); - this.xWFitLayout = (XWFitLayout) xCreator; - wFitLayout = xWFitLayout.toData(); - initComponent(); - } - - - public void initComponent() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel advancePane = createAdvancePane(); - UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, advancePane); - this.add(advanceExpandablePane, BorderLayout.NORTH); - UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, createLayoutPane()); - this.add(layoutExpandablePane, BorderLayout.CENTER); - } - - public JPanel createAdvancePane() { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - stylePane = new AccessibleWLayoutBorderStyleEditor(); - watermarkEditor = new AccessibleBodyWatermarkEditor(); - paddingBound = new PaddingBoundPane(); - JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane( - new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style")), stylePane}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), watermarkEditor} - }, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); - jp2.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - jPanel.add(paddingBound, BorderLayout.CENTER); - jPanel.add(jp2, BorderLayout.NORTH); - return jPanel; - } - - public JPanel createLayoutPane() { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - layoutComboBox = initUIComboBox(FRLayoutTypeItems.ITEMS); - componentIntervel = new UISpinner(0, Integer.MAX_VALUE, 1, 0); - JPanel componentIntervelPane = UIComponentUtils.wrapWithBorderLayoutPane(componentIntervel); - - UILabel intervalLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Interval")); - - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}}; - - - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type")), layoutComboBox}, - 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, 0, 0, 0)); - jPanel.add(centerPane, BorderLayout.CENTER); - return jPanel; - } - - - public UIComboBox initUIComboBox(Item[] items) { - DefaultComboBoxModel model = new DefaultComboBoxModel(); - for (Item item : items) { - model.addElement(item); - } - return new UIComboBox(model); - } - - - @Override - public String title4PopupWindow() { - return "fitLayout"; - } - - @Override - public void populateBean(WFitLayout ob) { - FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - XLayoutContainer rootLayout = selectedBodyLayout(formDesigner); - if (rootLayout != formDesigner.getRootComponent() - && formDesigner.getSelectionModel().getSelection().getSelectedCreator() == formDesigner.getRootComponent()) { - formDesigner.getSelectionModel().setSelectedCreators( - FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()})); - - } - paddingBound.populate(ob); - layoutComboBox.setSelectedIndex(ob.getBodyLayoutType().getTypeValue()); - componentIntervel.setValue(ob.getCompInterval()); - stylePane.setValue(ob.getBorderStyle()); - watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile())); - } - - private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) { - XLayoutContainer rootLayout = formDesigner.getRootComponent(); - if (rootLayout.getComponentCount() == 1 && rootLayout.getXCreator(0).acceptType(XWAbsoluteBodyLayout.class)) { - rootLayout = (XWAbsoluteBodyLayout) rootLayout.getXCreator(0); - } - return rootLayout; - } - - - @Override - public WFitLayout updateBean() { - WFitLayout layout = (WFitLayout) creator.toData(); - if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate"))) { - paddingBound.update(layout); - } - LayoutBorderStyle borderStyle = (LayoutBorderStyle) stylePane.getValue(); - if (borderStyle != null) { - layout.setBorderStyle(borderStyle); - } - updateWatermark(); - Item item = (Item) layoutComboBox.getSelectedItem(); - Object value = item.getValue(); - int state = 0; - if (value instanceof Integer) { - state = (Integer) value; - } - //todo 验证下 - layout.setLayoutType(WBodyLayoutType.parse(state)); - try { - if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) { - WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body"); - wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); - Component[] components = xWFitLayout.getComponents(); - xWFitLayout.removeAll(); - layout.resetStyle(); - XWAbsoluteBodyLayout xwAbsoluteBodyLayout = xWFitLayout.getBackupParent() == null ? new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)) : (XWAbsoluteBodyLayout) xWFitLayout.getBackupParent(); - xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); - for (Component component : components) { - XCreator xCreator = (XCreator) component; - //部分控件被ScaleLayout包裹着,绝对布局里面要放出来 - if (xCreator.acceptType(XWScaleLayout.class)) { - if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { - component = xCreator.getComponent(0); - component.setBounds(xCreator.getBounds()); - } - } - xwAbsoluteBodyLayout.add(component); - } - copyLayoutAttr(wFitLayout, wAbsoluteBodyLayout); - xWFitLayout.setBackupParent(xwAbsoluteBodyLayout); - FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - formDesigner.getSelectionModel().setSelectedCreators( - FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout})); - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - - } - - int intervelValue = (int) componentIntervel.getValue(); - if (xWFitLayout.canAddInterval(intervelValue)) { -// 设置完间隔后,要同步处理界面组件,容器刷新后显示出对应效果 - setLayoutGap(intervelValue); - } - - return layout; - } - - private void updateWatermark() { - WatermarkAttr watermark = (WatermarkAttr) watermarkEditor.getValue(); - if (watermark != null) { - IOFile ioFile = getCurrentIOFile(); - ioFile.addAttrMark(watermark); - } - } - - private IOFile getCurrentIOFile() { - return WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget(); - } - - private void setLayoutGap(int value) { - int interval = wFitLayout.getCompInterval(); - if (value != interval) { - xWFitLayout.moveContainerMargin(); - xWFitLayout.moveCompInterval(xWFitLayout.getAcualInterval()); - wFitLayout.setCompInterval(value); - xWFitLayout.addCompInterval(xWFitLayout.getAcualInterval()); - } - } - - @Override - public DataCreatorUI dataUI() { - return null; - } - -} diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/PcFitExpandablePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/PcFitExpandablePane.java deleted file mode 100644 index 0bd1e2bd2..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/attrpane/PcFitExpandablePane.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.fr.design.fit.attrpane; - -import com.fr.design.designer.IntervalConstants; -import com.fr.design.fit.FitStateCompatible; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.widget.DataModify; -import com.fr.report.fit.FitAttrState; -import com.fr.report.fit.ReportFitAttr; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; - - -/** - * Created by kerry on 2020-04-22 - */ -public class PcFitExpandablePane extends JPanel { - UIComboBox comboBox = new UIComboBox( - new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_Double_Fit"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_Hor_Fit"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_No_Fit")}); - UILabel tipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_No_Fit_Tip")); - - public PcFitExpandablePane(DataModify attrPane) { - init(attrPane); - } - - public void init(final DataModify attrPane) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel pcFitPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - final JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - borderPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); - tipLabel.setForeground(Color.gray); - comboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - tipLabel.setText(ScaleTipType.getScaleTip(comboBox.getSelectedIndex()).getTip()); - } - }); - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_Content_Display_Type")), comboBox}, - new Component[]{tipLabel, null}, - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_W0); - panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); - - borderPane.add(panel, BorderLayout.CENTER); - borderPane.add(tipLabel, BorderLayout.SOUTH); - pcFitPane.add(borderPane, BorderLayout.CENTER); - this.add(pcFitPane, BorderLayout.CENTER); - } - - public ReportFitAttr update() { - ReportFitAttr fitAttr = getReportFitAttr(); - fitAttr.setFitStateInPC(FitStateCompatible.getOldTypeFromNew(comboBox.getSelectedIndex())); - return fitAttr; - } - - public void populate(ReportFitAttr fitAttr) { - if (fitAttr == null) { - fitAttr = getReportFitAttr(); - } - int selectIndex = FitStateCompatible.getNewTypeFromOld(fitAttr.fitStateInPC()); - comboBox.setSelectedIndex(selectIndex); - tipLabel.setText(ScaleTipType.getScaleTip(selectIndex).getTip()); - } - - private ReportFitAttr getReportFitAttr() { - ReportFitAttr fitAttr = new ReportFitAttr(); - fitAttr.setFitStateInPC(FitAttrState.NOT_FIT.getState()); - return fitAttr; - } - - private enum ScaleTipType { - EC_DOUBLE_FIT(0, com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_Double_Fit_Tip")), - EC_HOR_FIT(1, com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_Hor_Fit_Tip")), - EC_NO_FIT(2, com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Ec_No_Fit_Tip")); - private int index; - private String tip; - - ScaleTipType(int index, String tip) { - this.index = index; - this.tip = tip; - } - - public String getTip() { - return tip; - } - - public static ScaleTipType getScaleTip(int selectIndex) { - for (ScaleTipType tipType : values()) { - if (selectIndex == tipType.index) { - return tipType; - } - } - return EC_NO_FIT; - } - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/RootDesignExtendDefinePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/RootDesignExtendDefinePane.java deleted file mode 100644 index 8a8aa404a..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/attrpane/RootDesignExtendDefinePane.java +++ /dev/null @@ -1,303 +0,0 @@ -package com.fr.design.fit.attrpane; - -import com.fr.base.BaseUtils; -import com.fr.design.ExtraDesignClassManager; -import com.fr.design.data.DataCreatorUI; -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.XWParameterLayout; -import com.fr.design.designer.properties.PropertyTab; -import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.fit.DesignerUIModeConfig; -import com.fr.design.fit.common.TemplateTool; -import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.fun.ParameterExpandablePaneUIProvider; -import com.fr.design.gui.ibutton.UIButtonGroup; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; -import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.FormSelection; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor; -import com.fr.design.utils.gui.LayoutUtils; -import com.fr.design.utils.gui.UIComponentUtils; -import com.fr.design.widget.ui.designer.AbstractDataModify; -import com.fr.design.widget.ui.designer.component.UIBoundSpinner; -import com.fr.form.ui.container.WParameterLayout; -import com.fr.general.Background; -import com.fr.report.stable.FormConstants; - -import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Rectangle; -import java.util.Set; - -public class RootDesignExtendDefinePane extends AbstractDataModify { - private XWParameterLayout root; - private UISpinner designerWidth; - private UISpinner paraHeight; - private UICheckBox displayReport; - private UICheckBox useParamsTemplate; - private AccessibleBackgroundEditor background; - private UIButtonGroup hAlignmentPane; - private UITextField labelNameTextField; - //是否是新设计模式下决策报表 - private boolean newForm; - private PropertyGroupPane extraPropertyGroupPane; - - public RootDesignExtendDefinePane(XCreator xCreator) { - super(xCreator); - newForm = TemplateTool.getCurrentEditingNewJForm() != null && DesignerUIModeConfig.getInstance().newUIMode(); - this.root = (XWParameterLayout) xCreator; - initComponent(); - } - - - public void initComponent() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - if (newForm) { - paraHeight = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0); - } else { - designerWidth = new UIBoundSpinner(1, Integer.MAX_VALUE, 1); - } - JPanel advancePane = createAdvancePane(); - UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, advancePane); - this.add(advanceExpandablePane, BorderLayout.NORTH); - JPanel layoutPane = createBoundsPane(); - UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Size"), 280, 20, layoutPane); - this.add(layoutExpandablePane, BorderLayout.CENTER); - this.addExtraUIExpandablePaneFromPlugin(); - } - - private void addExtraUIExpandablePaneFromPlugin() { - Set pluginCreators = ExtraDesignClassManager.getInstance().getArray(ParameterExpandablePaneUIProvider.XML_TAG); - JPanel panel = FRGUIPaneFactory.createYBoxEmptyBorderPane(); - for (ParameterExpandablePaneUIProvider provider : pluginCreators) { - UIExpandablePane uiExpandablePane = provider.createUIExpandablePane(); - PropertyTab propertyTab = provider.addToWhichPropertyTab(); - if (uiExpandablePane != null && propertyTab == PropertyTab.ATTR) { - panel.add(uiExpandablePane); - } - } - this.add(panel, BorderLayout.SOUTH); - } - - public JPanel createBoundsPane() { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}}; - Component[] component = newForm ? new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Design_Height")), paraHeight} : - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Desin_Width")), designerWidth}; - Component[][] components = new Component[][]{component}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - jPanel.add(panel); - return jPanel; - } - - public JPanel createAdvancePane() { - if (newForm) { - return getNewFormAdvancePane(); - } else { - return getTemplateAdvancePane(); - } - } - - /** - * @Description: 获取的非新决策报表AdvancePane - * @param - * @return: - * @Author: Henry.Wang - * @date: 2020/11/05 15:36 - */ - private JPanel getTemplateAdvancePane() { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - labelNameTextField = new UITextField(); - displayReport = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Display_Nothing_Before_Query")); - UIComponentUtils.setLineWrap(displayReport); - useParamsTemplate = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Use_Params_Template")); - background = new AccessibleBackgroundEditor(); - Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),}; - Integer[] hAlignment = new Integer[]{FormConstants.LEFTPOSITION, FormConstants.CENTERPOSITION, FormConstants.RIGHTPOSITION}; - hAlignmentPane = new UIButtonGroup(hAlignmentIconArray, hAlignment); - hAlignmentPane.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")}); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background}, - new Component[]{displayReport, null}, - new Component[]{useParamsTemplate, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Display_Position")), hAlignmentPane} - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); - panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); - CRPropertyDescriptor[] extraTableEditor = new CRPropertyDescriptor[0]; - extraTableEditor = root.getExtraTableEditor(); - extraPropertyGroupPane = new PropertyGroupPane(extraTableEditor, root); - - jPanel.add(panel, BorderLayout.NORTH); - jPanel.add(extraPropertyGroupPane, BorderLayout.CENTER); - return jPanel; - } - - /** - * @Description: 获取新决策报表的AdvancePane - * @param - * @return: - * @Author: Henry.Wang - * @date: 2020/11/05 15:36 - */ - private JPanel getNewFormAdvancePane() { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - labelNameTextField = new UITextField(); - displayReport = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Display_Nothing_Before_Query")); - UIComponentUtils.setLineWrap(displayReport); - useParamsTemplate = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Use_Params_Template")); - background = new AccessibleBackgroundEditor(); - - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background}, - new Component[]{displayReport, null}, - new Component[]{useParamsTemplate, null} - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); - panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); - - jPanel.add(panel, BorderLayout.NORTH); - - return jPanel; - } - - @Override - public String title4PopupWindow() { - return "parameter"; - } - - @Override - public void populateBean(WParameterLayout ob) { - labelNameTextField.setText(ob.getLabelName()); - background.setValue(ob.getBackground()); - displayReport.setSelected(ob.isDelayDisplayContent()); - useParamsTemplate.setSelected(ob.isUseParamsTemplate()); - if (newForm) { - FormDesigner designer = TemplateTool.getCurrentEditingNewJForm().getFormDesign(); - paraHeight.setValue(designer.getParaHeight()); - } else { - designerWidth.setValue(ob.getDesignWidth()); - hAlignmentPane.setSelectedItem(ob.getPosition()); - - if (extraPropertyGroupPane != null) { - extraPropertyGroupPane.populate(ob); - } - } - } - - - @Override - public WParameterLayout updateBean() { - if (newForm) { - return updateNewFormBean(); - } else { - return updateTemplateBean(); - } - } - - /** - * @Description: 更新非新决策报表的bean - * @param - * @return: - * @Author: Henry.Wang - * @date: 2020/11/05 15:36 - */ - private WParameterLayout updateTemplateBean() { - WParameterLayout wParameterLayout = (WParameterLayout) creator.toData(); - wParameterLayout.setLabelName(labelNameTextField.getText()); - if (isCompsOutOfDesignerWidth((int) designerWidth.getValue())) { - designerWidth.setValue(wParameterLayout.getDesignWidth()); - } else { - wParameterLayout.setDesignWidth((int) designerWidth.getValue()); - } - wParameterLayout.setDelayDisplayContent(displayReport.isSelected()); - wParameterLayout.setUseParamsTemplate(useParamsTemplate.isSelected()); - JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); - wParameterLayout.setBackground((Background) background.getValue()); - wParameterLayout.setPosition((Integer) hAlignmentPane.getSelectedItem()); - return wParameterLayout; - } - - /** - * @Description: 更新新决策报表的bean - * @param - * @return: - * @Author: Henry.Wang - * @date: 2020/11/05 15:36 - */ - private WParameterLayout updateNewFormBean() { - WParameterLayout wParameterLayout = (WParameterLayout) creator.toData(); - wParameterLayout.setLabelName(labelNameTextField.getText()); - - wParameterLayout.setDelayDisplayContent(displayReport.isSelected()); - wParameterLayout.setUseParamsTemplate(useParamsTemplate.isSelected()); - JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); - wParameterLayout.setBackground((Background) background.getValue()); - //设置参数模板面板的高度 - int height = (int) paraHeight.getTextField().getValue(); - FormDesigner designer = TemplateTool.getCurrentEditingNewJForm().getFormDesign(); - FormSelection selection = designer.getSelectionModel().getSelection(); - XCreator creator = designer.getParaComponent(); - Rectangle rectangle = creator.getBounds(); - Rectangle newRectangle = new Rectangle(rectangle.x, rectangle.y, rectangle.width, height); - creator.setBounds(newRectangle); - if (paraHeight.getValue() != newRectangle.height) - paraHeight.setValue(newRectangle.height); - designer.setParaHeight(newRectangle.height); - designer.getArea().doLayout(); - LayoutUtils.layoutContainer(creator); - selection.fixCreator(designer); - designer.repaint(); - return wParameterLayout; - } - - private boolean isCompsOutOfDesignerWidth(int designerWidth) { - for (int i = 0; i < root.getComponentCount(); i++) { - Component comp = root.getComponent(i); - if (comp.getX() + comp.getWidth() > designerWidth) { - return true; - } - } - return false; - } - - @Override - public DataCreatorUI dataUI() { - return null; - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java b/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java deleted file mode 100644 index 5d9c9463c..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.fr.design.fit.common; - -import com.fr.design.data.DesignTableDataManager; -import com.fr.design.fit.DesignerUIModeConfig; -import com.fr.design.fit.NewJForm; -import com.fr.design.fit.attrpane.ElementEditorExtendDefinePane; -import com.fr.design.fit.attrpane.FRAbsoluteBodyLayoutExtendDefinePane; -import com.fr.design.fit.attrpane.FRAbsoluteLayoutExtendDefinePane; -import com.fr.design.fit.attrpane.FRFitLayoutExtendDefinePane; -import com.fr.design.fit.attrpane.RootDesignExtendDefinePane; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JForm; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.JTemplateFactory; -import com.fr.design.parameter.RootDesignDefinePane; -import com.fr.design.preview.FormAdaptivePreview; -import com.fr.design.preview.FormPreview; -import com.fr.design.widget.Appearance; -import com.fr.design.widget.FormWidgetDefinePaneFactoryBase; -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; -import com.fr.design.widget.ui.designer.layout.FRFitLayoutDefinePane; -import com.fr.file.FILE; -import com.fr.file.MemFILE; -import com.fr.form.ui.ElementCaseEditor; -import com.fr.form.ui.Widget; -import com.fr.form.ui.container.WAbsoluteBodyLayout; -import com.fr.form.ui.container.WAbsoluteLayout; -import com.fr.form.ui.container.WFitLayout; -import com.fr.form.ui.container.WParameterLayout; -import com.fr.form.ui.widget.CRBoundsWidget; -import com.fr.log.FineLoggerFactory; -import com.fr.report.fit.ReportFitAttr; - -import javax.swing.SwingUtilities; - -/** - * Created by kerry on 2020-06-02 - */ -public class AdaptiveSwitchUtil { - - private static int switchJFromIng = 0; - - private AdaptiveSwitchUtil() { - - } - - public static void switch2NewUI() { - switch2NewUIMode(); - reload(); - } - - public static void switch2NewUIMode() { - DesignerUIModeConfig.getInstance().setNewUIMode(); - FormWidgetDefinePaneFactoryBase.registerDefinePane(ElementCaseEditor.class, - new Appearance(ElementEditorExtendDefinePane.class, "elementCaseEditor")); - FormWidgetDefinePaneFactoryBase.registerDefinePane(WFitLayout.class, - new Appearance(FRFitLayoutExtendDefinePane.class, "wFitLayout")); - FormWidgetDefinePaneFactoryBase.registerDefinePane(WAbsoluteBodyLayout.class, - new Appearance(FRAbsoluteBodyLayoutExtendDefinePane.class, "wAbsoluteBodyLayout")); - FormWidgetDefinePaneFactoryBase.registerDefinePane(WAbsoluteLayout.class, - new Appearance(FRAbsoluteLayoutExtendDefinePane.class, "wAbsoluteLayout")); - FormWidgetDefinePaneFactoryBase.registerDefinePane(WParameterLayout.class, - new Appearance(RootDesignExtendDefinePane.class, "wParameterLayout")); - } - - public static void switch2OldUI() { - switch2OldUIMode(); - reload(); - } - - public static void switch2OldUIMode() { - DesignerUIModeConfig.getInstance().setOldUIMode(); - FormWidgetDefinePaneFactoryBase.registerDefinePane(WAbsoluteLayout.class, - new Appearance(FRAbsoluteLayoutDefinePane.class, "wAbsoluteLayout")); - FormWidgetDefinePaneFactoryBase.registerDefinePane(ElementCaseEditor.class, - new Appearance(ElementEditorDefinePane.class, "elementCaseEditor")); - FormWidgetDefinePaneFactoryBase.registerDefinePane(WAbsoluteBodyLayout.class, - new Appearance(FRAbsoluteBodyLayoutDefinePane.class, "wAbsoluteBodyLayout")); - FormWidgetDefinePaneFactoryBase.registerDefinePane(WFitLayout.class, - new Appearance(FRFitLayoutDefinePane.class, "wFitLayout")); - FormWidgetDefinePaneFactoryBase.registerDefinePane(WParameterLayout.class, - new Appearance(RootDesignDefinePane.class, "wParameterLayout")); - } - - public static void reload() { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - synchronized (AdaptiveSwitchUtil.class) { - try { - if (DesignerContext.getDesignerFrame() == null) { - return; - } - JTemplate old = TemplateTool.getCurrentEditingTemplate(); - if (old == null || !(old instanceof JForm)) { - return; - } - JTemplate template = createNewJTemplate(old); - if (template != null) { - DesignTableDataManager.closeTemplate(old); - TemplateTool.resetTabPaneEditingTemplate(template); - TemplateTool.activeAndResizeTemplate(template); - setPreviewType(); - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } finally { - switchJFromIng = 0; - } - } - } - }); - } - - /** - * @Description: 设置预览方式 - * @return: 新创建的模板 - * @Author: Henry.Wang - * @date: 2020/10/13 14:08 - */ - private static void setPreviewType() { - JTemplate jTemplate = TemplateTool.getCurrentEditingTemplate(); - if (jTemplate != null) { - if (DesignerUIModeConfig.getInstance().newUIMode()) { - jTemplate.setPreviewType(new FormAdaptivePreview()); - } else { - jTemplate.setPreviewType(new FormPreview()); - } - } - } - - /** - * @Description: 创建模板 - * @param old 以前的模板 - * @return: 新创建的模板 - * @Author: Henry.Wang - * @date: 2020/9/6 14:08 - */ - public static JTemplate createNewJTemplate(JTemplate old) { - JTemplate template; - template = createNewJTemplateInternal(old); - if (template instanceof NewJForm) { - NewJForm jForm = ((NewJForm) template); - //如果是从旧的设计模板转化为新的设计模式,并且不是全局配置的模板。则更新新模板的Pc端自适应属性 - if (DesignerUIModeConfig.getInstance().newUIMode() && jForm.getTarget().getReportFitAttr() != null && isSwitchJFromIng()) { - jForm.getTarget().setReportFitAttr(shiftReportFitAttr(old, jForm.getTarget().getReportFitAttr().isFitFont())); - } - TemplateTool.saveForm(jForm); - } - return template; - } - - /** - * @Description: 创建模板核心方法 - * @param old 以前的方法 - * @return: 新创建的模板 - * @Author: Henry.Wang - * @date: 2020/9/6 14:09 - */ - private static JTemplate createNewJTemplateInternal(JTemplate old) { - FILE file = old.getEditingFILE(); - if ((file instanceof MemFILE) || !old.isSaved()) { - if (old instanceof NewJForm) { - TemplateTool.resetAbsoluteBodySize((NewJForm) old); - } - TemplateTool.saveForm(old); - } - return JTemplateFactory.createJTemplate(old.getEditingFILE()); - } - - /** - * @Description: 老模板切换到新模板的属性配置转换( - * 1、绝对布局-适应区域--》双向自适应 - * 2、自适应布局-双向自适应--》双向自适应 - * 3、自适应布局-横向自适应--》横向自适应 - * 4、绝对布局-固定大小--》不自适应 - * ) - * @param old - * @param fitFont 字体是否自适应 - * @return: - * @Author: Henry.Wang - * @date: 2020/9/6 14:01 - */ - private static ReportFitAttr shiftReportFitAttr(JTemplate old, boolean fitFont) { - if (old instanceof JForm && DesignerUIModeConfig.getInstance().newUIMode()) { - JForm jForm = (JForm) old; - try { - int layoutType = LayoutTool.getFormLayoutType(jForm); - int compState = -1; - //自适应布局 - if (layoutType == 0) { - compState = ((WFitLayout) jForm.getFormDesign().getRootComponent().toData()).getCompState(); - if (compState == WFitLayout.STATE_FULL) { - return new ReportFitAttr(2, fitFont); - } else if (compState == WFitLayout.STATE_ORIGIN) { - return new ReportFitAttr(1, fitFont); - } - } else if (layoutType == 1) {//绝对布局 - Widget widget = ((CRBoundsWidget) jForm.getFormDesign().getRootComponent().toData().getWidget(0)).getWidget(); - if (widget instanceof WAbsoluteLayout) { - compState = ((WAbsoluteLayout) widget).getCompState(); - } - if (compState == WAbsoluteLayout.STATE_FIT) { - return new ReportFitAttr(2, fitFont); - } else if (compState == WAbsoluteLayout.STATE_FIXED) { - return new ReportFitAttr(3, fitFont); - } - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - return null; - } - - public static void setSwitchJFromIng(int switchJFromIng) { - AdaptiveSwitchUtil.switchJFromIng = switchJFromIng; - } - - public static boolean isSwitchJFromIng() { - return switchJFromIng == 1; - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/common/BaseUtils.java b/designer-form/src/main/java/com/fr/design/fit/common/BaseUtils.java deleted file mode 100644 index 829d320e8..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/common/BaseUtils.java +++ /dev/null @@ -1,1266 +0,0 @@ -package com.fr.design.fit.common; - -import com.fr.base.AutoChangeLineAndDrawManager; -import com.fr.base.FRContext; -import com.fr.base.GraphHelper; -import com.fr.base.Style; -import com.fr.base.SynchronizedLiveDataModelUtils; -import com.fr.base.TableData; -import com.fr.base.regist.LicenseConfigManager; -import com.fr.config.ServerPreferenceConfig; -import com.fr.data.api.TableDataAssist; -import com.fr.design.fit.PX; -import com.fr.general.ComparatorUtils; -import com.fr.general.FArray; -import com.fr.general.FRFont; -import com.fr.general.GeneralContext; -import com.fr.general.GeneralUtils; -import com.fr.general.IOUtils; -import com.fr.general.data.DataModel; -import com.fr.general.data.TableDataException; -import com.fr.general.xml.GeneralXMLTools; -import com.fr.json.JSONArray; -import com.fr.json.JSONException; -import com.fr.json.JSONObject; -import com.fr.json.JSONUtils; -import com.fr.json.revise.EmbedJson; -import com.fr.locale.InterProviderFactory; -import com.fr.log.FineLoggerFactory; -import com.fr.plugin.injectable.PluginModule; -import com.fr.report.fun.VerticalTextProcessor; -import com.fr.report.fun.impl.DefaultVerticalTextProcessor; -import com.fr.script.Calculator; -import com.fr.stable.ColumnRow; -import com.fr.stable.Constants; -import com.fr.stable.GraphDrawHelper; -import com.fr.stable.ListSet; -import com.fr.stable.StableUtils; -import com.fr.stable.StringUtils; -import com.fr.stable.bridge.ObjectHolder; -import com.fr.stable.fun.AutoChangeLineAndDrawProcess; -import com.fr.stable.fun.FontProcessor; -import com.fr.stable.plugin.ExtraClassManagerProvider; -import com.fr.stable.project.ProjectConstants; -import com.fr.stable.script.CalculatorProvider; -import com.fr.stable.unit.FU; -import com.fr.stable.unit.UNIT; -import com.fr.workspace.WorkContext; - -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JFrame; -import java.awt.Color; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.Paint; -import java.awt.geom.AffineTransform; -import java.awt.geom.Dimension2D; -import java.awt.image.BufferedImage; -import java.awt.image.CropImageFilter; -import java.awt.image.FilteredImageSource; -import java.io.IOException; -import java.io.InputStream; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; - - -/** - * 基本的工具类 - */ -public class BaseUtils { - - private BaseUtils() { - } - - /** - * 从缓存中读取图片(如果缓存中存在的话则直接从缓存中读取,如果不存在则从磁盘读取并将读取的结果缓存起来) - * - * @param resource 图片的路径 - * @return 图片 - * @see IOUtils#readImageWithCache(String) - * @deprecated - */ - public static BufferedImage readImageWithCache(String resource) { - return IOUtils.readImageWithCache(resource); - } - - /** - * 从缓存中读取图片,如果缓存中不存在则返回null - * - * @param resource 图片路径 - * @return 图片,缓存中没有则返回null - * @see IOUtils#readCacheImage(String) - * @deprecated - */ - public static BufferedImage readCacheImage(String resource) { - return IOUtils.readCacheImage(resource); - } - - /** - * 直接从磁盘中读取图片,这种方法效率稍低但每次图片更改了也能即时反应出来 - * - * @param resource 图片的路径 - * @return 图片 - * @see IOUtils#readImage(String) - * @deprecated - */ - public static BufferedImage readImage(String resource) { - //daniel bug 5400 图片读取 默认关闭缓存 - return IOUtils.readImage(resource); - } - - /** - * 读取图标,该方法启用了缓存 - * - * @param resource 图标文件的存放路径 - * @return 图标 - * @see IOUtils#readIcon(String) - * @deprecated - */ - public static Icon readIcon(String resource) { - return IOUtils.readIcon(resource); - } - - /** - * 从输入流中读取图片 - * - * @param input 输入流 - * @return 图片 - * @throws IOException - * @see IOUtils#readImage(InputStream) - * @deprecated - */ - public static BufferedImage readImage(InputStream input) throws IOException { - return IOUtils.readImage(input); - } - - /** - * 将行列对象转换成其字符串的表示形式 - * 转换后的字符串将像A2,B4,C45这样的 - *

- * 将A1单元格转化成字符串"A1": - *

- * BaseUtils.convertColumnRowToCellString(ColumnRow.valueOf(0,0)); - * - * @param columnRow 要转换的行列对象 - * @return 表示行列位置的字符串 - */ - public static String convertColumnRowToCellString(ColumnRow columnRow) { - if (columnRow == null) { - return ""; - } - - return columnRow.toString(); - } - - /** - * 将表示行列位置的字符串转换成行列对象 - * 如果转换失败,将会返回{@link ColumnRow} - * - * @param columnRowString 表示行列位置的字符串对象 - * @return 行列对象 - * @see ColumnRow#valueOf(String) - * @deprecated - */ - public static ColumnRow convertCellStringToColumnRow(String columnRowString) { - return ColumnRow.valueOf(columnRowString); - } - - /** - * 读取jar的版本号 - * - * @return 版本号 - * @see GeneralUtils#readBuildNO() - * @deprecated - */ - public static String readBuildNO() { - return GeneralUtils.readBuildNO(); - } - - /** - * 把指定位置的资源以默认的GBK编码的形式读取成字符串 - * - * @param path 资源存放的路径 - * @return 表示资源内容的字符串 - * @see IOUtils#readResourceAsString(String) - * @deprecated - */ - public static String readResourceAsString(String path) { - return IOUtils.readResourceAsString(path); - } - - /** - * 将指定位置的资源以指定的编码形式读取成字符串 - * - * @param path 资源存放的路径 - * @param encode 读取资源所用的编码 - * @return 表示资源内容的字符串 - * @see IOUtils#readResourceAsString(String, String) - * @deprecated - */ - public static String readResourceAsString(String path, String encode) { - return IOUtils.readResourceAsString(path, encode); - } - - @Deprecated - public static String[] getDependence(Object value, CalculatorProvider c) { - - try { - return (String[]) StableUtils.invokeMethod("com.fr.form.FormUtils", "getDependence", new Class[]{Object.class, CalculatorProvider.class}, new Object[]{value, c}); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return null; - } - - /** - * 读取资源 - * - * @param path 资源存放的路径,可以是一个URL - * @return 返回资源的输入流 - * @see IOUtils#readResource(String) - * @deprecated - */ - public static InputStream readResource(String path) { - return IOUtils.readResource(path); - } - - /** - * 截取图片的指定区域作为一个图标 - * - * @param image 原始的图片 - * @param startx 截取的横向起始位置 - * @param starty 截取的纵向起始位置 - * @param width 截取的图标的宽度 - * @param height 截取的图标的高度 - * @return 图标 - */ - public static ImageIcon createIcon(Image image, int startx, int starty, int width, int height) { - JFrame jc = new JFrame(); - Image cropImage = jc.createImage(new FilteredImageSource(image.getSource(), new CropImageFilter(startx, starty, width, height))); - return new ImageIcon(cropImage); - } - - /** - * 将一个长整形数组以指定的分隔符转化成一个字符串 - * - * @param array 数组 - * @param decimal 分隔符 - * @return 表示数组的字符串 - */ - public static String toLongArrayString(long[] array, char decimal) { - StringBuffer sb = new StringBuffer(); - if (array != null) { - for (int i = 0; i < array.length; i++) { - if (i != 0) { - sb.append(decimal); - } - sb.append(array[i]); - } - } - return sb.toString(); - } - - /** - * 将一个有规则的字符串按指定的分隔符分割并转化成一个长整型数组 - * - * @param str 有规则的字符串 - * @param decimal 分隔符 - * @return 长整型数组 - */ - public static long[] toLongArrayFromStr(String str, char decimal) { - List list = new ArrayList(); - if (str == null) { - return new long[0]; - } - String[] strarray = StableUtils.splitString(str, String.valueOf(decimal)); - for (int i = 0; i < strarray.length; i++) { - String text = strarray[i].trim(); - list.add(Long.valueOf(text)); - } - - long[] res = new long[list.size()]; - for (int i = 0; i < res.length; i++) { - res[i] = ((Long) list.get(i)).longValue(); - } - - return res; - } - - - /** - * 获取样式中字体的类型 - * - * @param g2d 图形上下文 - * @param style 样式 - * @param resolution 屏幕分辨率 - * @return 字体 - */ - public static Font getStyleFont(Graphics2D g2d, Style style, int resolution) { - FRFont font = style.getFRFont(); - Font rfont = initFontWithLocaleAndG2d(g2d, font, resolution); - if (!ComparatorUtils.equals(rfont, g2d.getFont())) { - g2d.setFont(rfont); - } - Color foreground = font.getForeground(); - if (!ComparatorUtils.equals(foreground, g2d.getPaint())) { - g2d.setPaint(foreground); - } - - return rfont; - } - - - private static Font initFontWithLocaleAndG2d(Graphics2D g2d, FRFont font, int resolution) { - Locale locale = GeneralContext.getLocale(); - Font rfont; - if (ComparatorUtils.equals(Locale.ENGLISH, locale)) { - rfont = FRFont.getInstance("Dialog", font.getStyle(), font.getSize()); - } - - rfont = font.applyResolutionNP(resolution); - //itext的bug 用SimSun导出无法实现粗体斜体, 其作者解释是使用basefont是不支持这些style的, 要转成itext的亚洲字体 - //这边不用instance of的原因就是不想把itext包引到applet包里面去. - if (g2d.toString().indexOf("PdfGraphics2D") != -1 && ComparatorUtils.equals(FRFont.DEFAULT_FONTNAME, font.getName())) { - //不要把这边的'宋体'改成'Simsun', 就这么设定的 - rfont = FRFont.getInstance(InterProviderFactory.getProvider().getLocText("Fine-Core_Base_Song_TypeFace"), rfont.getStyle(), rfont.getSize(), - font.getForeground(), font.getUnderline(), font.isStrikethrough(), font.isShadow(), - font.isSuperscript(), font.isSubscript()); - } - - return rfont; - } - - /** - * 获取样式中关于水平方向上的对齐类型 - * - * @param style 样式 - * @return 水平方向上的对齐类型 - */ - public static int getAlignment4Horizontal(Style style) { - return getAlignment4Horizontal(style, null); - } - - /** - * 获取DataMoodel中第columnIndex列的数据. - * - * @param model 取数的数据来源 - * @param columnIndex 取数的数据列序号 - * @return 返回数据数组Object[] - */ - public static Object[] getDistinctValues(DataModel model, int columnIndex) throws TableDataException { - ListSet list = new ListSet(); - if (columnIndex != DataModel.COLUMN_NAME_NOT_FOUND) { - for (int i = 0, len = model.getRowCount(); i < len; i++) { - list.add(model.getValueAt(i, columnIndex)); - } - } - - return list.toArray(); - } - - /** - * 获取水平方向上的对齐样式 - * - * @param style 样式 - * @param value 单元格的值,默认情况下,当不设置对齐类型时,如果单元格的值是数字则靠右对齐,字符串则靠左对齐 - * @return 水平方向上的对齐样式 - */ - public static int getAlignment4Horizontal(Style style, Object value) { - int horizontalAlignment = style.getHorizontalAlignment(); - //若是默认值:判断 bug5188 数字居右 - if (value != null && horizontalAlignment == Constants.NULL) { - if (value instanceof String) { - if (style.getFormat() instanceof NumberFormat || StableUtils.isNumber((String) value)) { - horizontalAlignment = Constants.RIGHT; - } else { - //字符串:靠左 - horizontalAlignment = Constants.LEFT; - } - } else if (value instanceof Number) { - horizontalAlignment = Constants.RIGHT; - } - } - return horizontalAlignment; - } - - /** - * 基本的画文本的方法,只考虑样式中的字体和对齐方式 - * - * @param g2d 图形上下文 - * @param width 画文本的区域的宽度 - * @param height 画文本的区域的高度 - * @param text 要画的文本 - * @param style 样式 - * @param resolution 屏幕分辨率 - */ - public static void drawStringStyleInRotation(Graphics2D g2d, int width, int height, String text, Style style, int resolution) { - if (StringUtils.isBlank(text)) { - return; - } - - Paint oldPaint = g2d.getPaint(); - Font oldFont = g2d.getFont(); - - if (style == null) { - style = Style.DEFAULT_STYLE; - } - - Font font = getStyleFont(g2d, style, resolution); - font = readExtraFont(g2d, font); - int horizontalAlignment = BaseUtils.getAlignment4Horizontal(style, text); - - if (style.getRotation() != 0 && style.getVerticalText() == Style.HORIZONTALTEXT) { - drawHorizontalText(g2d, text, font, style, width, height, horizontalAlignment); - } else { - drawRotationText(g2d, text, style, font, width, height, horizontalAlignment, resolution); - } - - g2d.setFont(oldFont); - g2d.setPaint(oldPaint); - } - - private static Font readExtraFont(Graphics2D g2d, Font font) { - ExtraClassManagerProvider pluginProvider = PluginModule.getAgent(PluginModule.ExtraCore); - if (pluginProvider != null) { - FontProcessor processor = pluginProvider.getSingle(FontProcessor.MARK_STRING); - if (processor != null) { - font = processor.readExtraFont(font); - g2d.setFont(font); - } - } - return font; - } - - private static void drawHorizontalText(Graphics2D g2d, String text, Font rfont, Style style, double width, double height, int horizontalAlignment) { - AffineTransform trans = new AffineTransform(); - trans.rotate(-Math.toRadians(style.getRotation())); - - double textX = width / 2.0; - double textY = height / 2.0; - - Dimension2D textDimension = GraphHelper.stringDimensionWithRotation(text, rfont, -style.getRotation(), g2d.getFontRenderContext()); - - if (textDimension.getWidth() < width) { - if (horizontalAlignment == Constants.LEFT) { - textX = textDimension.getWidth() / 2.0; - } else if (horizontalAlignment == Constants.RIGHT) { - textX = width - textDimension.getWidth() / 2.0 - style.getPaddingLeft() * - Math.cos(Math.toRadians(style.getRotation())); - } else { - } - } - - // adjust y, height. - if (textDimension.getHeight() < height) { - if (style.getVerticalAlignment() == Constants.TOP) { - textY = textDimension.getHeight() / 2.0; - } else if (style.getVerticalAlignment() == Constants.BOTTOM) { - textY = height - textDimension.getHeight() / 2.0 - style.getPaddingLeft() * Math.sin(Math.toRadians(style.getRotation())); - } else { - } - } - - GraphHelper.drawRotatedString(g2d, text, textX, textY, -style.getRotation()); - } - - private static void drawRotationText(Graphics2D g2d, String text, Style style, Font rfont, int width, int height, int horizontalAlignment, int resolution) { - AutoChangeLineAndDrawProcess process = AutoChangeLineAndDrawManager.getProcess(); - if (process != null) { - process.drawRotationText(g2d, text, new ObjectHolder(style), rfont, width, height, horizontalAlignment, resolution); - return; - } - - FontMetrics cellFM = GraphHelper.getFontMetrics(rfont); - List lineTextList = BaseUtils.getLineTextList(text, style, rfont, height, width, resolution); - - if (width <= 0 || lineTextList.isEmpty()) { - return; - } - - int textAscent = cellFM.getAscent(); - int textHeight = cellFM.getHeight(); - - int textY = calculateTextY(style, height, textHeight, textAscent, lineTextList, resolution); - - int maxWidth = 0; - for (int i = 0; i < lineTextList.size(); i++) { - String paint_str = (String) lineTextList.get(i); - int textWidth = cellFM.stringWidth(paint_str); - if (textWidth > maxWidth) { - maxWidth = textWidth; - } - } - for (int i = 0; i < lineTextList.size(); i++) { - String paint_str = (String) lineTextList.get(i); - //把自定义角度为0的横排和竖排区分开来 - if (style.getRotation() == 0 && style.getVerticalText() == style.HORIZONTALTEXT) { - maxWidth = cellFM.stringWidth(paint_str); - } - boolean textLonger = false;//KevinWang: 标志一下:是否串长大于列宽 - if (maxWidth > width - style.getPaddingLeft() - style.getPaddingRight()) { - textLonger = true;//added by KevinWang <处理分散对齐时使用> - } //待会串长大于列宽时需要特别处理:只从中抽取合适长度的串值显示 - - int textX = (int) calculateTextX(style, width, maxWidth, horizontalAlignment, resolution); - int textWidth = width - style.getPaddingRight(); - if (isAutomaticLine(style, horizontalAlignment, textLonger)) {//自动换行时 - GraphHelper.drawString2(g2d, paint_str, textX, textY, textWidth); - } else if (isDistributeAlign(style, horizontalAlignment, textLonger)) { - drawTextWihenDistributeAlign(g2d, paint_str, cellFM, textWidth, textX, textY); - } else { //这里不能删除 - GraphHelper.drawString(g2d, paint_str, textX, textY); - } - textY += textHeight;// TODO 只增加了Y. - textY += PX.toPixWithResolution(style.getLineSpacing(), resolution); - } - } - - public static int calculateTextY(Style style, int height, int textHeight, int textAscent, List lineTextList, int resolution) { - return calculateTextY(style, height, textHeight, textAscent, lineTextList, resolution, 1); - } - - /** - * 计算Y的高度 - * - * @param style 样式 - * @param height 总高度 - * @param textHeight 文本高度 - * @param textAscent 字体的基线到大多数字母数字字符顶部的距离 - * @param lineTextList 文本列 - * @param resolution 分辨率 - * @return Y高度 - */ - public static int calculateTextY(Style style, int height, int textHeight, int textAscent, List lineTextList, int resolution, int scale) { - // 计算Y的高度. - int textY = 0; - int textAllHeight = textHeight * lineTextList.size(); - double spacingBefore = PX.toPixWithResolution(style.getSpacingBefore() * scale, resolution); - double spacingAfter = PX.toPixWithResolution(style.getSpacingAfter() * scale, resolution); - double lineSpacing = PX.toPixWithResolution(style.getLineSpacing() * scale, resolution); - textAllHeight += spacingBefore + spacingAfter + lineSpacing * lineTextList.size(); - if (style.getVerticalAlignment() == Constants.TOP) { - } else if (style.getVerticalAlignment() == Constants.CENTER) { - if (height > textAllHeight) {// 如果所有文本的高度小于当前可以绘区域的高度,就从0开始画字符. - textY = (height - textAllHeight) / 2; - } - } else if (style.getVerticalAlignment() == Constants.BOTTOM) { - if (height > textAllHeight) { - textY = height - textAllHeight; - } - } - textY += textAscent;// 在绘画的时候,必须添加Ascent的高度. - textY += spacingBefore + lineSpacing;//james:加上"段前间距"+“行间距” - return textY; - } - - - public static int calculateTextX(Style style, Font rfont, String paint_str, int width, int textWidth, int horizontalAlignment) { - return calculateTextX(style, rfont, paint_str, width, textWidth, horizontalAlignment, 1); - } - - /** - * 计算X宽度 - * - * @param style 样式 - * @param rfont 字体 - * @param paint_str 字符串 - * @param width 宽度 - * @param textWidth 文本宽度 - * @param horizontalAlignment 垂向对齐 - * @return X宽度 - */ - public static int calculateTextX(Style style, Font rfont, String paint_str, int width, int textWidth, int horizontalAlignment, int scale) { - int textX = style.getPaddingLeft() * scale; - if (horizontalAlignment == Constants.CENTER) { - textX += (width - textWidth - textX) / 2; - } else if (horizontalAlignment == Constants.RIGHT) { - textX = width - style.getPaddingRight() * scale - textWidth; -//// // TODO alex:just for flash print && for font.Tahoma -// if (Boolean.TRUE == FRCoreContext.TMAP.get() -// && ComparatorUtils.equals(rfont.getFontName(), "Tahoma")) { -// textX -= paint_str.length() / 3; -// } - } - return textX; - } - - /** - * 计算X宽度 - * - * @param style 样式 - * @param width 宽度 - * @param textWidth 文本宽度 - * @param horizontalAlignment 垂向对齐 - * @param resolution 分辨率 - * @return X宽度 - */ - public static double calculateTextX(Style style, int width, int textWidth, int horizontalAlignment, int resolution) { - return calculateTextX(style, width, textWidth, horizontalAlignment, resolution, 1); - } - - /** - * 计算文本X位置 - * - * @param style 样式 - * @param width 宽度 - * @param textWidth 文本宽度 - * @param horizontalAlignment 水平对齐 - * @return X宽度 - */ - public static double calculateTextX(Style style, int width, int textWidth, int horizontalAlignment, int resolution, int scale) { - double textX = padding2PixExcludeRight(style.getPaddingLeft(), resolution); - if (horizontalAlignment == Constants.CENTER) { - textX += (width - textWidth - textX) / 2f; - } else if (horizontalAlignment == Constants.RIGHT) { - textX = width - style.getPaddingRight() * scale - textWidth; - } - return textX; - } - - /** - * 将缩减、段间距转为对应dpi下的pix Ps:除了右缩进 - * - * @param padding - * @param resolution - * @return - */ - public static double padding2PixExcludeRight(int padding, int resolution) { - return PX.toPixWithResolution(padding, resolution); - } - - /** - * 将右缩进转为对应dpi下的pix - * - * @param paddingRight - * @param resolution - * @return - */ - public static double paddingRight2Pix(int paddingRight, int resolution) { - if (paddingRight == Style.DEFAULT_PADDING) { - return 0; - } - return paddingRight; - } - - public static boolean isAutomaticLine(Style style, int horizontalAlignment, boolean textLonger) { - return horizontalAlignment == Constants.DISTRIBUTED - && style.getTextStyle() == Style.TEXTSTYLE_WRAPTEXT - || horizontalAlignment == Constants.DISTRIBUTED - && style.getTextStyle() == Style.TEXTSTYLE_SINGLELINE - && !textLonger; - } - - public static boolean isDistributeAlign(Style style, int horizontalAlignment, boolean textLonger) { - return horizontalAlignment == Constants.DISTRIBUTED - && style.getTextStyle() == Style.TEXTSTYLE_SINGLELINE - && textLonger; - } - - public static void drawTextWihenDistributeAlign(Graphics2D g2d, String paint_str, FontMetrics cellFM, int width, int textX, int textY) { - drawTextWihenDistributeAlign(g2d, paint_str, cellFM, width, textX, textY, 1f); - } - - /** - * 画字符串:分散对齐 - * @param scale 缩放比例,主目前要用于删除线、下划线及阴影的绘制 - */ - public static void drawTextWihenDistributeAlign(Graphics2D g2d, String paint_str, FontMetrics cellFM, int width, int textX, int textY, float scale) { - String lineText = getSingleLineText(paint_str, cellFM, width); - if (StringUtils.isNotEmpty(lineText)) { - GraphDrawHelper.drawString4DistributeAlign(g2d, lineText, textX, textY, width, scale); - } - } - - /** - * 获取用于单行显示的text - * - * @param lineText 分行显示时第i行的内容,但是也可能单行 - * @param cellFM 字体 - * @param width 宽度 - * @return 拆分后的字符串 - */ - private static String getSingleLineText(String lineText, FontMetrics cellFM, int width) { - // 单行显示时的分散对齐实现e - // 串长大于列宽时需要特别处理:只从中抽取合适长度的串值显示 - StringBuffer strBuff = new StringBuffer(); - for (int charIndex = 0; charIndex < lineText.length(); charIndex++) { - strBuff.append(lineText.charAt(charIndex)); - int buffWidth = cellFM.stringWidth(new String(strBuff)); - if (buffWidth > width) { //长度足够了,开始显示 - return strBuff.substring(0, 0 == charIndex ? 0 : charIndex - 1);//只画一行 - } - } - //上面的width没有减去padding-left,可能啥也没画 - return strBuff.toString(); - } - - /** - * 将输入字符串转换为实际字符,\代表转义字符。 - * - * @param text 字符串 - * @return the real value 实际字符 - */ - public static String textToString(String text) { - //跟这里的drawText算法是一致的,这样"所见即所得", - //如果把drawText的参数text先用此方法转换也行的,但是会遍历俩次,所以先留着 - if (text == null) { - return ""; - } - - int len = text.length(); - StringBuffer sb = new StringBuffer(len); - - for (int i = 0; i < len; i++) { - char c = text.charAt(i); - if (c == '\\' && i + 1 < len) { - char next = text.charAt(i + 1); - if (next == 'n') { - i++; - c = '\n'; - } else if (next == '\\') { - i++; - } - - } - sb.append(c); - } - return sb.toString(); - } - - /** - * daniel: 自动换行算法, 这个算法要求跟DHTML中Table的自动换行表现结果一样 - * 所以统一72dpi进行处理 - * - * @param text - * @param style - * @param paintWidth - * @return - */ - public static List getLineTextList(String text, Style style, Font font, double paintWidth, int resolution) { - List lineTextList = new ArrayList(); - if (text == null || text.length() <= 0) { - return lineTextList; - } - - style = style == null ? Style.DEFAULT_STYLE : style; - - if (style.getRotation() != 0) { - lineTextList.add(text); - return lineTextList; - } - - if (style.getTextStyle() != Style.TEXTSTYLE_WRAPTEXT) { - return lineTextListNotChangeLine(lineTextList, text); - } - // 自动换行 - else { - UNIT width = FU.valueOfPix((int) paintWidth, resolution); - return lineTextListAutoChangeLine(lineTextList, text, font, style, width, resolution); - } - } - - private static List lineTextListNotChangeLine(List lineTextList, String text) { - char tmpChar; - StringBuffer tmpTextBuf = new StringBuffer(); - for (int t = 0; t < text.length(); t++) { - tmpChar = text.charAt(t); - if (tmpChar == '\\') {// 判断是否是 "\n" - if (t + 1 < text.length() && text.charAt(t + 1) == 'n') { - // 是"\n"字符串,但不是换行符. - t++; - lineTextList.add(tmpTextBuf.toString()); - tmpTextBuf.delete(0, tmpTextBuf.length()); - } else { - tmpTextBuf.append(tmpChar); - } - } else { - tmpTextBuf.append(tmpChar); - } - } - - // 最后一个 - if (tmpTextBuf.length() > 0) { - lineTextList.add(tmpTextBuf.toString()); - tmpTextBuf.delete(0, tmpTextBuf.length()); - } - - return lineTextList; - } - - /** - * 这里需要用resolution 72的dpi进行分行,因为96dpi会导致font有小数导致获取的宽度不正确 - * - * @param lineTextList - * @param text - * @param style - * @return - */ - private static List lineTextListAutoChangeLine(List lineTextList, String text, Font font, Style style, UNIT unitWidth, int resolution) { - - AutoChangeLineAndDrawProcess process = AutoChangeLineAndDrawManager.getProcess(); - if (process != null) { - return process.autoChangeLine(text, new ObjectHolder(style), unitWidth); - } - if (font == null) { - font = style.getFRFont(); - } - FontMetrics fontMetrics = GraphHelper.getFontMetrics(font); - double paintWidth = unitWidth.toPixD(resolution); - double width = paintWidth - style.getPaddingLeft() - style.getPaddingRight() - style.getBorderLeftWidth(); - StringBuffer lineTextBuf = new StringBuffer(); - int lineTextWidth = 0; - - StringBuffer wordBuf = new StringBuffer(); - int wordWidth = 0; - int[] tmpWidth = new int[2]; - tmpWidth[0] = wordWidth; - tmpWidth[1] = lineTextWidth; - - lineTextListDealWithText(text, lineTextList, width, tmpWidth, wordBuf, lineTextBuf, fontMetrics); - - // 最后处理 - if (tmpWidth[1] + tmpWidth[0] > width && lineTextBuf.length() > 0) { - lineTextList.add(lineTextBuf.toString()); - lineTextList.add(wordBuf.toString()); - } else { - lineTextBuf.append(wordBuf); - lineTextList.add(lineTextBuf.toString()); - } - return lineTextList; - } - private static void lineTextListDealWithText(String text, List lineTextList, double width, int[] tmpWidth, - StringBuffer wordBuf, StringBuffer lineTextBuf, FontMetrics fontMetrics) { - for (int t = 0; t < text.length(); t++) { - if (t != 0 && isNumOrLetter(text.charAt(t)) && isNumOrLetter(text.charAt(t - 1))) { - dealWithTextNumOrLetter(text, t, lineTextList, width, tmpWidth, wordBuf, lineTextBuf, fontMetrics); - } else if (text.charAt(t) == '\n' || (text.charAt(t) == '\r' && t + 1 < text.length() - 1 && text.charAt(t + 1) != '\n')) { - dealWithTextChangeLineSymbol(text, t, lineTextList, width, tmpWidth, wordBuf, lineTextBuf, fontMetrics); - } else if (text.charAt(t) == '\\' && t + 1 < text.length() && text.charAt(t + 1) == 'n') {// 判断是否是 "\n" - // 是"\n"字符串,但不是换行符,依然需要换行. - dealWidthTextManualChangeLine(text, t, lineTextList, width, tmpWidth, wordBuf, lineTextBuf, fontMetrics); - // 需要跳过后面的n - t++; - } else { - int increaseStep = 0; - if (text.charAt(t) == '\\' && t + 1 < text.length() && text.charAt(t + 1) == '\\') {// 判断是否是转义字符'\' - // _denny: 增加了转义字符'\\'用来表示\,使"\n"可以输入 - t++; - increaseStep++; - } - if (tmpWidth[1] + tmpWidth[0] > width && lineTextBuf.length() > 0) { - if (isPunctuationAtLineHead(t, text)) { - for (int index = lineTextBuf.length(); index > 0; index--) { - char prec = lineTextBuf.charAt(index - 1); - lineTextBuf.deleteCharAt(index - 1); - if (!isPunctuation(prec)) { - break; - } - } - } - lineTextList.add(lineTextBuf.toString()); - lineTextBuf.delete(0, lineTextBuf.length()); - tmpWidth[1] = isPunctuationAtLineHead(t, text) ? dealWithPunctuationAtLinehead(t, fontMetrics, text, lineTextBuf, wordBuf.length(), increaseStep) : 0; - } - lineTextBuf.append(wordBuf); - tmpWidth[1] += tmpWidth[0]; - - wordBuf.delete(0, wordBuf.length()); - tmpWidth[0] = 0; - wordBuf.append(text.charAt(t)); - tmpWidth[0] = fontMetrics.charWidth(text.charAt(t)); - } - } - } - - - - /** - * 标点符号是否在换行后的行首 - */ - private static boolean isPunctuationAtLineHead(int t, String text) { - return t > 1 && BaseUtils.isPunctuation(text.charAt(t - 1)); - } - - private static int dealWithPunctuationAtLinehead(int t, FontMetrics fontMetrics, String text, StringBuffer lineTextBuf, int wordBufLength, int increaseStep) { - //lineTextBuf 最后一个字符下标 与 text当前字符下标 t 的距离 + 1 - int indexDistance = 1 + wordBufLength + increaseStep; - if (t < indexDistance) { - return 0; - } - int lineWidth = 0; - for (int index = t - indexDistance; index >= 0; index--) { - lineWidth += fontMetrics.charWidth(text.charAt(index)); - lineTextBuf.insert(0, text.charAt(index)); - if (!isPunctuation(text.charAt(index))) { - break; - } - } - return lineWidth; - } - - private static void dealWithTextNumOrLetter(String text, int t, List lineTextList, double width, int[] tmpWidth, - StringBuffer wordBuf, StringBuffer lineTextBuf, FontMetrics fontMetrics) { - if (tmpWidth[0] + fontMetrics.charWidth(text.charAt(t)) > width) { - if (tmpWidth[1] > 0) { - lineTextList.add(lineTextBuf.toString()); - lineTextBuf.delete(0, lineTextBuf.length()); - tmpWidth[1] = 0; - } - - lineTextList.add(wordBuf.toString()); - wordBuf.delete(0, wordBuf.length()); - tmpWidth[0] = 0; - } - - wordBuf.append(text.charAt(t)); - tmpWidth[0] += fontMetrics.charWidth(text.charAt(t)); - } - - private static void dealWithTextChangeLineSymbol(String text, int t, List lineTextList, double width, int[] tmpWidth, - StringBuffer wordBuf, StringBuffer lineTextBuf, FontMetrics fontMetrics) { - wordBuf.append('\n'); - if (tmpWidth[1] + tmpWidth[0] > width && lineTextBuf.length() > 0) { - lineTextList.add(lineTextBuf.toString()); - lineTextList.add(wordBuf.toString()); - } else { - lineTextBuf.append(wordBuf); - lineTextList.add(lineTextBuf.toString()); - } - lineTextBuf.delete(0, lineTextBuf.length()); - tmpWidth[1] = 0; - wordBuf.delete(0, wordBuf.length()); - tmpWidth[0] = 0; - } - - private static void dealWidthTextManualChangeLine(String text, int t, List lineTextList, double width, int[] tmpWidth, - StringBuffer wordBuf, StringBuffer lineTextBuf, FontMetrics fontMetrics) { - t++;// 忽略'n'字符. - wordBuf.append('\n'); - if (tmpWidth[1] + tmpWidth[0] > width && lineTextBuf.length() > 0) { - lineTextList.add(lineTextBuf.toString()); - lineTextList.add(wordBuf.toString()); - } else { - lineTextBuf.append(wordBuf); - lineTextList.add(lineTextBuf.toString()); - } - lineTextBuf.delete(0, lineTextBuf.length()); - tmpWidth[1] = 0; - wordBuf.delete(0, wordBuf.length()); - tmpWidth[0] = 0; - } - - - /** - * @param cuChar - * @return - * @see StableUtils - * @deprecated - */ - public static boolean isNum(char cuChar) { - return StableUtils.isNum(cuChar); - } - - - /** - * 判断字符是否为数字或字母 - * - * @param curChar 被检查的字符 - * @return 是否为数字或字母 - */ - public static boolean isNumOrLetter(char curChar) { - return GeneralUtils.isLetter(curChar) || StableUtils.isNum(curChar); - } - - public static boolean isPunctuation(char c) { - int type = Character.getType(c); - return type == Character.OTHER_PUNCTUATION - || type == Character.DASH_PUNCTUATION - || type == Character.START_PUNCTUATION - || type == Character.END_PUNCTUATION - || type == Character.CONNECTOR_PUNCTUATION; - } - - - public static List getLineTextList(String text, Style style, Font font, double paintHeight, double paintWidth) { - return getLineTextList(text, style, font, paintHeight, paintWidth, Constants.DEFAULT_PRINT_AND_EXPORT_RESOLUTION); - } - - /** - * james daniel 放一起 - * 同时含有height和width参数表示会根据style自动判断字体为竖排还是横排 - * TODO - */ - public static List getLineTextList(String text, Style style, Font font, double paintHeight, double paintWidth, int resolution) { - //正常文字 - if (style == null - || style.getVerticalText() != Style.VERTICALTEXT) {//james:正常的文字时 - return BaseUtils.getLineTextList(text, style, font, paintWidth, resolution); - } - ExtraClassManagerProvider pluginProvider = PluginModule.getAgent(PluginModule.ExtraCore); - if (pluginProvider != null) { - VerticalTextProcessor processor = pluginProvider.getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class); - String[] res = processor.process(text, style, font, paintHeight, paintWidth, resolution); - return Arrays.asList(res); - } - String[] res = new DefaultVerticalTextProcessor().process(text, style, font, paintHeight, paintWidth, resolution); - return Arrays.asList(res); - } - - /** - * 返回边框宽 - * - * @param borderType 边框类型 - * @return 宽度 - */ - public static int getBorderWidth(int borderType) { - switch (borderType) { - case Constants.LINE_NONE: - return 0; - case Constants.LINE_SLIM: - return 1; - case Constants.LINE_THIN: - return 1; - case Constants.LINE_DASH: - return 1; - case Constants.LINE_HAIR: - return 1; - case Constants.LINE_HAIR2: - return 1; - case Constants.LINE_THICK: - return 3; - case Constants.LINE_DOT: - return 1; - default: - return 2; - } - } - - /** - * 将边框转为对应的字符串描述 - * - * @param borderStyle 边框线型 - * @return web端对应的边框 - */ - public static String border2Style(int borderStyle) { - switch (borderStyle) { - case Constants.LINE_NONE: - return "none"; - case Constants.LINE_SLIM: - return "solid"; - case Constants.LINE_THIN: - return "solid"; - case Constants.LINE_MEDIUM: - return "solid"; - case Constants.LINE_THICK: - return "solid"; - case Constants.LINE_DOUBLE: - return "double"; - case Constants.LINE_DOT: - return "double"; - case Constants.LINE_DASH_DOT: - return "double"; - case Constants.LINE_DASH_DOT_DOT: - return "dotted"; - default: - return "dashed"; - } - } - - /** - * 克隆对象 - * - * @param object 对象 - * @return 克隆出的对象 - * @throws CloneNotSupportedException 不被支持的克隆异常 - * @see StableUtils#cloneObject(Object) - * @deprecated - */ - public static Object cloneObject(Object object) throws CloneNotSupportedException { - return StableUtils.cloneObject(object); - } - - - /** - * 把java.util.Map转成一段JSONObject的String与上面方法对应 - * - * @param map map对象 - * @return json对象 - * @throws JSONException json异常 - */ - public static JSONObject map2JSON(Map map) throws JSONException { - JSONObject jo = new JSONObject(); - Iterator iter = map.keySet().iterator(); - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry) iter.next(); - Object value = entry.getValue(); - if (value instanceof FArray) { - JSONArray ja = new JSONArray(); - FArray array = (FArray) value; - for (int i = 0; i < array.length(); i++) { - ja.put(array.elementAt(i)); - } - value = ja; - } - jo.put((String) entry.getKey(), value); - } - return jo; - } - - /** - * 将一个对象转化成json样式的字符串 - * - * @param o 待转化的对象 - * @return json样式的字符串 - * @throws JSONException json异常 - * @see EmbedJson#encode(Object) (Object) - * @deprecated - */ - public static String jsonEncode(Object o) throws JSONException { - return EmbedJson.encode(o); - } - - - /** - * 将一个字符串转化成JSON格式的对象 - * - * @param str 要转化的字符串 - * @return JSON格式的对象 - * @throws JSONException json异常 - * @see JSONUtils#jsonDecode(String) - * @deprecated - */ - public static Object jsonDecode(String str) throws JSONException { - return JSONUtils.jsonDecode(str); - } - - /** - * 检查图片1和2是否相同. - * - * @param img1 图片1 - * @param img2 图片2 - * @return 图片1和2是否相同 - */ - public static boolean imageEquals(Image img1, Image img2) { - if (img1 == img2) { - return true; - } - - if (img1 == null || img2 == null) {//null < not null - return img1 == null && img2 == null; - } - - //开始比较图片. - byte[] buf1 = GeneralXMLTools.imageEncode(img1); - byte[] buf2 = GeneralXMLTools.imageEncode(img2); - if (buf1.length != buf2.length) { - return false; - } - - for (int i = 0; i < buf1.length; i++) { - if (buf1[i] != buf2[i]) { - return false; - } - } - - return true; - } - - /** - * 根据数据集名获取数据模型 - * - * @param cal 算子 - * @param tdName 列表名 - * @return 数据模型 - */ - public static DataModel getDataModelFromTableDataName(Calculator cal, String tdName) { - String tableDataName = tdName; - //先看当前的报表中的私有数据源 - DataModel resultSet = SynchronizedLiveDataModelUtils.getSELiveDataModel4Share(cal, tableDataName); - if (resultSet == null) { - TableData td = TableDataAssist.getTableData(cal, tableDataName); - resultSet = td == null ? null : td.createDataModel(cal); - } - return resultSet; - } - - - /** - * kunsnat: List转化为二维表 - * - * @param list 列表 - * @return 二维数组 - */ - public static Object[][] list2Array2D(List list) { - int rowNum = list.size(); - int colNum = 0; - for (int i = 0; i < rowNum; i++) { - List row = (List) list.get(i); - if (row.size() > colNum) { - colNum = row.size(); - } - } - Object[][] result = new Object[rowNum][colNum]; - - for (int i = 0; i < rowNum; i++) { - List row = (List) list.get(i); - for (int j = 0; j < colNum; j++) { - if (j < row.size()) { - result[i][j] = row.get(j); - } else { - result[i][j] = null; - } - } - } - - return result; - } - - /** - * 判断当前Env下是否有lic文件 - * - * @return 判断当前Env下是否有lic文件 - */ - public static boolean checkLicExist() { - - if (ServerPreferenceConfig.getInstance().isLicUseLock()) { - return true;//加密狗 - } else if (!LicenseConfigManager.getInstance().isUseFile()) { - //不使用文件,说明用户配置了注册信息,一定是注册了 - return true; - } - - try { - String licName = FRContext.getCommonOperator().getLicenseName(); - byte[] bytes = WorkContext.getWorkResource().readFully(StableUtils.pathJoin(ProjectConstants.RESOURCES_NAME, licName)); - return bytes != null && bytes.length != 0; - } catch (Exception ignored) { - } - - return false; - } - - /** - * 判断是否内容为图表相关. - * - * @param cellOption 单元格属性 - * @return 返回是否为图表单元格相关. - */ - public static boolean isChartCell(JSONObject cellOption) { - if (cellOption != null) { - JSONObject value = cellOption.optJSONObject("value"); - if (value != null) { - return ComparatorUtils.equals("simplechart", value.optString("type")); - } - } - - return false; - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/common/FormDesignerUtil.java b/designer-form/src/main/java/com/fr/design/fit/common/FormDesignerUtil.java deleted file mode 100644 index 6e0739a01..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/common/FormDesignerUtil.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.fr.design.fit.common; - -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XElementCase; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.form.FormElementCaseProvider; -import com.fr.form.ui.ElementCaseEditor; - -import java.util.Iterator; -import java.util.List; - -/** - * Created by kerry on 2020-06-12 - */ -public class FormDesignerUtil { - private FormDesignerUtil(){ - - } - public static XElementCase getXelementCase(XLayoutContainer rootContainer, FormElementCaseProvider elementCaseProvider) { - for (int i = 0; i < rootContainer.getComponentCount(); i++) { - XCreator creator = rootContainer.getXCreator(i); - if (creator instanceof XElementCase && elementCaseProvider == ((ElementCaseEditor) creator.toData()).getElementCase()) { - return (XElementCase) creator; - } - if (creator instanceof XLayoutContainer) { - XElementCase temp = getXelementCase((XLayoutContainer) creator, elementCaseProvider); - if (temp != null) { - return temp; - } - } - } - return null; - } - - - public static void removeDeletedEC(List currentECList, List waitToProcessECList) { - Iterator iterator = waitToProcessECList.iterator(); - while (iterator.hasNext()) { - Object editor = iterator.next(); - if (!currentECList.contains(editor)) { - iterator.remove(); - } - } - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/common/LayoutTool.java b/designer-form/src/main/java/com/fr/design/fit/common/LayoutTool.java deleted file mode 100644 index 6bebbbbe8..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/common/LayoutTool.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.fr.design.fit.common; - -import com.fr.design.designer.creator.XCreator; -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.designer.creator.cardlayout.XWCardLayout; -import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; -import com.fr.design.fit.NewJForm; -import com.fr.design.mainframe.FormArea; -import com.fr.design.mainframe.JForm; -import com.fr.design.utils.gui.LayoutUtils; -import com.fr.form.ui.container.WAbsoluteBodyLayout; -import com.fr.form.ui.container.WFitLayout; -import com.fr.form.ui.container.WLayout; -import com.fr.form.ui.widget.CRBoundsWidget; -import com.fr.general.FRScreen; -import com.fr.log.FineLoggerFactory; - -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Rectangle; -import java.awt.Toolkit; - -/** - * @description:布局工具类 - * @author: Henry.Wang - * @create: 2020/09/03 14:18 - */ -public class LayoutTool { - /** - * @Description: 获取布局类型 - * @param jForm - * @return: - * @Author: Henry.Wang - * @date: 2020/9/6 14:31 - */ - public static int getFormLayoutType(JForm jForm) { - JForm tempJForm = jForm; - if (tempJForm == null) - tempJForm = TemplateTool.getCurrentEditingNewJForm(); - if (tempJForm == null || tempJForm.getFormDesign().getRootComponent() == null) - return -1; - return ((WFitLayout) tempJForm.getFormDesign().getRootComponent().toData()).getBodyLayoutType().getTypeValue(); - - } - - /** - * @Description: 是否为绝对布局 - * @param jForm - * @return: - * @Author: Henry.Wang - * @date: 2020/9/6 14:31 - */ - public static boolean absoluteLayoutForm(NewJForm jForm) { - if (getFormLayoutType(jForm) == 1) - return true; - return false; - } - - /** - * @Description: 如果为绝对布局则获取XWAbsoluteBodyLayout,否则返回null - * @param jForm - * @return: - * @Author: Henry.Wang - * @date: 2020/9/6 14:26 - */ - public static XWAbsoluteBodyLayout getXWAbsoluteBodyLayout(NewJForm jForm) { - NewJForm tempJForm = jForm; - if (tempJForm == null) - tempJForm = TemplateTool.getCurrentEditingNewJForm(); - if (tempJForm != null) { - if (absoluteLayoutForm(tempJForm)) { - XLayoutContainer xLayoutContainer = tempJForm.getFormDesign().getRootComponent(); - if (xLayoutContainer != null && xLayoutContainer.getComponentCount() > 0) { - Component component = xLayoutContainer.getComponent(0); - if (component instanceof XWAbsoluteBodyLayout) { - return (XWAbsoluteBodyLayout) component; - } - } - } - } - return null; - } - - /** - * @Description: 通过子组件的位置获取绝对布局body的尺寸。为什么不直接调用getRootComponent().toData().getContentHeight()呢?因为在截断的情况下就不不一致了 - * @param newJForm - * @return: - * @Author: Henry.Wang - * @date: 2020/9/11 15:24 - */ - public static Rectangle getAbsoluteBodySize(NewJForm newJForm) { - int width = 0; - int height = 0; - XWAbsoluteBodyLayout xwAbsoluteBodyLayout = LayoutTool.getXWAbsoluteBodyLayout(newJForm); - if (xwAbsoluteBodyLayout != null) { - WAbsoluteBodyLayout wAbsoluteBodyLayout = xwAbsoluteBodyLayout.toData(); - if (wAbsoluteBodyLayout.getWidgetCount() > 0) { - for (int i = 0; i < wAbsoluteBodyLayout.getWidgetCount(); i++) { - Rectangle rectangle = ((CRBoundsWidget) wAbsoluteBodyLayout.getWidget(i)).getBounds(); - if (rectangle.x + rectangle.width > width) - width = rectangle.x + rectangle.width; - if (rectangle.y + rectangle.height > height) - height = rectangle.y + rectangle.height; - } - } - } - return new Rectangle(0, 0, width, height); - } - - - public static int getBodyHeight(NewJForm newJForm) { - return newJForm.getFormDesign().getRootComponent().toData().getContentHeight(); - } - - public static int getBodyWidth(NewJForm newJForm) { - return newJForm.getFormDesign().getRootComponent().toData().getContentWidth(); - } - - /** - * @Description: 对绝对画布块里的组件进行缩放 - * @param xCreator - * @param scale 缩放比例 - * @return: - * @Author: Henry.Wang - * @date: 2020/10/26 20:39 - */ - public static void scaleAbsoluteBlockComponentsBounds(XCreator xCreator, Double scale) { - try { - Component[] components = xCreator.getComponents(); - for (Component component : components) { - if (component instanceof XWCardMainBorderLayout) { - XWCardLayout xwCardLayout = ((XWCardMainBorderLayout)component).getCardPart(); - for (Component tabComponent : xwCardLayout.getComponents()) { - scaleAbsoluteBlockComponentsBounds((XCreator) tabComponent, scale); - scaleAbsoluteBlockComponentsBoundsInternal((XCreator) tabComponent, scale); - } - } else if (component instanceof XWAbsoluteLayout) { - scaleAbsoluteBlockComponentsBounds((XCreator) component, scale); - scaleAbsoluteBlockComponentsBoundsInternal((XCreator) component, scale); - } - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } - - } - - public static void scaleAbsoluteBlockComponentsBoundsInternal(XCreator parentXCreator, Double scale) { - if (parentXCreator instanceof XWAbsoluteLayout) { - XWAbsoluteLayout xwAbsoluteLayout = (XWAbsoluteLayout) parentXCreator; - Component[] absoluteComponents = xwAbsoluteLayout.getComponents(); - for (Component absoluteComponent : absoluteComponents) { - XCreator xCreator = (XCreator) absoluteComponent; - Rectangle bounds = new Rectangle(absoluteComponent.getBounds()); - Rectangle newBounds = new Rectangle((int) (bounds.x * scale), (int) (bounds.y * scale), (int) (bounds.width * scale), (int) (bounds.height * scale)); - WLayout wAbsoluteLayout = xwAbsoluteLayout.toData(); - wAbsoluteLayout.setBounds(xCreator.toData(), newBounds); - xCreator.setBounds(newBounds); - LayoutUtils.layoutContainer(xCreator); - } - } - } - - /** - * @Description: 获取老预览时的缩放比例 - * @return: - * @Author: Henry.Wang - * @date: 2020/10/26 20:39 - */ - public static double getContainerPercent(){ - Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - double screenValue = FRScreen.getFRScreenByDimension(screen).getValue(); - return screenValue / FormArea.DEFAULT_SLIDER; - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/common/NewFormStyle.java b/designer-form/src/main/java/com/fr/design/fit/common/NewFormStyle.java deleted file mode 100644 index a937ba2d4..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/common/NewFormStyle.java +++ /dev/null @@ -1,2030 +0,0 @@ -/* - * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. - */ -package com.fr.design.fit.common; - -import com.fr.base.BaseFormula; -import com.fr.base.CoreDecimalFormat; -import com.fr.base.FRContext; -import com.fr.base.FormatRepository; -import com.fr.base.GraphHelper; -import com.fr.base.ImageProvider; -import com.fr.base.Painter; -import com.fr.base.Style; -import com.fr.base.Utils; -import com.fr.base.background.ImageBackground; -import com.fr.common.annotations.Open; -import com.fr.data.DataBaseUtils; -import com.fr.general.Background; -import com.fr.general.ComparatorUtils; -import com.fr.general.DateUtils; -import com.fr.general.DefaultValues; -import com.fr.general.FRFont; -import com.fr.general.GeneralUtils; -import com.fr.json.JSONException; -import com.fr.json.JSONObject; -import com.fr.stable.AssistUtils; -import com.fr.stable.Constants; -import com.fr.stable.CoreGraphHelper; -import com.fr.stable.StableUtils; -import com.fr.stable.StringUtils; -import com.fr.stable.unit.PT; -import com.fr.stable.web.Repository; -import com.fr.stable.web.ServletContext; -import com.fr.stable.web.ServletContextAdapter; -import org.jetbrains.annotations.Nullable; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.Paint; -import java.awt.Rectangle; -import java.awt.Shape; -import java.awt.geom.Rectangle2D; -import java.io.InvalidObjectException; -import java.io.Serializable; -import java.sql.Clob; -import java.text.DateFormat; -import java.text.Format; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * 用于表示样式的类,包括边框、颜色、字体、缩进、间距等 - * 注意:这是一个开放类,所有的修改都要注意保持兼容 - */ -@Open -public class NewFormStyle extends Style implements Serializable, Cloneable { - - // temp rectangle - private static Rectangle2D tempRectangle2D = new Rectangle2D.Double(0, 0, 0, 0); - - public static final int TEXTSTYLE_WRAPTEXT = 0; // 换行. - public static final int TEXTSTYLE_SINGLELINE = 1; // 单行,超出部分不显示. - public static final int TEXTSTYLE_SINGLELINEADJUSTFONT = 2; // 单行,调整字体来显示所有的字. - public static final int TEXTSTYLE_MULTILINEADJUSTFONT = 3; //多行,固定单元格高和宽,调整字体来显示所有的字 - - public static final int VERTICALTEXT = 1;// 竖排,与Excel中的设置值相同 - public static final int HORIZONTALTEXT = 0;// 横排 - - public static final int LEFT_TO_RIGHT = 1;// JAMES:垂直文字时,文字为从左向右顺序排列 - public static final int RIGHT_TO_LEFT = 0;// JAMES:垂直文字时,文字为从右向左顺序排列 - - //EXCEL 宋体11号字, 一个缩进单位对应96dpi下27px - public static final int PADDING_ARG = 27; - public static final int DEFAULT_PADDING = 2; - /** - * 细线透明度值 - */ - public static final double FACTORY_ALPHA = 0.4; - public static final NewFormStyle NULL_STYLE = null; - - /** - * Default Style - */ - public static final NewFormStyle DEFAULT_STYLE = new NewFormStyle(); - - /** - * Border Style - */ - public static final NewFormStyle BORDER_STYLE = new NewFormStyle(); - - private static final long serialVersionUID = -1675056857456167839L; - private static final int MAX_FONT_SIZE = 100; - private static final int N_SIZE = 9; - private static final int MIN_SIZE = 8; - private static final int MAX_SIZE = 26; - - private static final int LINE_HEIGHT_FIX = 4; - private static final int LINE_HEIGHT_FIX2 = 3; - - private static class ContentLineGroup { - Style style; - List newLineTextList; - int newTextHeight; - - public ContentLineGroup(Style style, List lineList, int textHeight) { - this.style = style; - this.newLineTextList = lineList; - this.newTextHeight = textHeight; - } - - public int totalHeight() { - return newTextHeight * newLineTextList.size(); - } - } - - private static Map clsFontFamily = null; - - // 全局Style的map - private static Map initializeStyle = new ConcurrentHashMap();// - - static { - ServletContext.addServletContextListener(new ServletContextAdapter() { - @Override - public void onServletStop() { - initializeStyle.clear(); - } - }); - } - - // format - private Format format = null; - - // element font. - private FRFont frFont = null; - - private Background background = null; - - // border. - private byte border_top = Constants.LINE_NONE; - private byte border_left = Constants.LINE_NONE; - private byte border_bottom = Constants.LINE_NONE; - private byte border_right = Constants.LINE_NONE; - private Color border_top_color = Color.BLACK; - private Color border_left_color = Color.BLACK; - private Color border_bottom_color = Color.BLACK; - private Color border_right_color = Color.BLACK; - - // alignment. - private int horizontal_alignment = Constants.NULL; - private int vertical_alignment = Constants.CENTER; - - // TextStyle - private int textStyle = NewFormStyle.TEXTSTYLE_WRAPTEXT; - - // james: verticalText - private int verticalText = NewFormStyle.HORIZONTALTEXT;// 默认为0,水平方向 - - // james: the direction of text when the text is vertical - private int textDirection = NewFormStyle.RIGHT_TO_LEFT;// 默认为从右向左的顺序 - - private int rotation = 0; - - private byte imageLayout = Constants.IMAGE_CENTER;//现在默认改为center了 - - //padding有两个计量单位, 一种是以前的pt, 一种是现在的, 为了兼容excel的 - //设计器中设置1个单位, 兼容为以前的27pt - // 左缩进 - private int paddingLeft = DEFAULT_PADDING; - // 右缩进 - private int paddingRight = DEFAULT_PADDING; - - // 段前间距 - private byte spacingBefore = 0; - // 段后间距 - private byte spacingAfter = 0; - // 行间距h - private byte lineSpacing = 0; - - private String contentClsCss = StringUtils.EMPTY; - private Map contentStyleCssMap = new HashMap(); - - private String borderClsCss = StringUtils.EMPTY; - private Map borderStyleCssMap = new HashMap(); - - /** - * Constructor. - */ - protected NewFormStyle() { - //peter:这里主动从Context, 获得默认的FRFont的值. - DefaultValues defaultValues = FRContext.getDefaultValues(); - this.frFont = defaultValues.getFRFont(); - - // HTML输出 CSS初始化 - this.contentClsCss = this.contentStyle2class(this.contentStyleCssMap); - this.borderClsCss = this.border2Class(this.borderStyleCssMap); - } - - private NewFormStyle(Background background, Format format, FRFont frFont, - int border_top, Color border_top_color, int border_bottom, Color border_bottom_color, - int border_left, Color border_left_color, int border_right, Color border_right_color, - int horizontal_alignment, int vertical_alignment, int textStyle, - int verticalText, int textDirection, int rotation, int imageLayout, - int paddingLeft, int paddingRight, int spacingBefore, int spacingAfter, int lineSpacing) { - this.background = background; - this.format = format; - this.frFont = frFont; - - this.border_top = (byte) border_top; - this.border_top_color = border_top_color; - this.border_bottom = (byte) border_bottom; - this.border_bottom_color = border_bottom_color; - this.border_left = (byte) border_left; - this.border_left_color = border_left_color; - this.border_right = (byte) border_right; - this.border_right_color = border_right_color; - - this.horizontal_alignment = (byte) horizontal_alignment; - this.vertical_alignment = (byte) vertical_alignment; - this.textStyle = (byte) textStyle; - - this.verticalText = (byte) verticalText; - this.textDirection = (byte) textDirection; - this.rotation = (short) rotation; - this.imageLayout = (byte) imageLayout; - - this.paddingLeft = paddingLeft; - this.paddingRight = paddingRight; - - this.spacingBefore = (byte) spacingBefore; - this.spacingAfter = (byte) spacingAfter; - this.lineSpacing = (byte) lineSpacing; - - // HTML输出 CSS初始化 - this.contentClsCss = this.contentStyle2class(this.contentStyleCssMap); - this.borderClsCss = this.border2Class(this.borderStyleCssMap); - } - - private static Map getclsFontFamily() { - if (clsFontFamily == null) { - clsFontFamily = new HashMap() { - { - put("Arial Black", "fnab"); - put("Basic Sans SF", "fnbs"); - put("Book Antiqua", "fnba"); - put("Calibri", "fnci"); - put("Comic Sans MS", "fncs"); - put("Courier New", "fncn"); - put("Elementary SF", "fnes"); - put("Garamond", "fngd"); - put("Georgia", "fnga"); - put("Letter Gothic", "fnlg"); - put("Lucida Console", "fnlc"); - put("Marigold", "fnmd"); - put("MS Sans Serif", "fnms"); - put("MS Gothic", "fnmg"); - put("MS PGothic", "fnmpg"); - put("MS Mincho", "fnmm"); - put("MS P Mincho", "fnmpm"); - put("MingLiU", "fnml"); - put("SimHei", "fnsh"); - put("System", "fnsm"); - put("Tahoma", "fnta"); - put("Times New Roman", "fntn"); - put("Trebuchet MS", "fntms"); - put("Verdana", "fnva"); - - put("SimSun", "fnss"); - put("Arial", "fnar"); - put("Microsoft YaHei", "fnyh"); - put("KaiTi", "fnkt"); - } - }; - } - - return clsFontFamily; - } - - /** - * 设置样式 - * - * @param format 格式g - * @return 样式y - */ - public NewFormStyle deriveFormat(Format format) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 获取实例 - */ - public static NewFormStyle getInstance(Format format) { - return DEFAULT_STYLE.deriveFormat(format); - } - - /** - * 设置字体 - * - * @param frFont 字体 - * @return 样式 - */ - public NewFormStyle deriveFRFont(FRFont frFont) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * getInstance - */ - public static NewFormStyle getInstance() { - NewFormStyle style = new NewFormStyle(); - - Object valueStyle = initializeStyle.get(style); - if (valueStyle != null) { - return (NewFormStyle) valueStyle; - } else { - initializeStyle.put(style, style); - return style; - } - } - - /** - * getInstance - */ - private static NewFormStyle getInstance(Background background, Format format, FRFont frFont, - int border_top, Color border_top_color, int border_bottom, Color border_bottom_color, - int border_left, Color border_left_color, int border_right, Color border_right_color, - int horizontal_alignment, int vertical_alignment, int textStyle, - int verticalText, int textDirection, int rotation, int imageLayout, - int paddingLeft, int paddingRight, int spacingBefore, int spacingAfter, int lineSpacing) { - NewFormStyle style = new NewFormStyle(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - - Object valueStyle = initializeStyle.get(style); - if (valueStyle != null) { - return (NewFormStyle) valueStyle; - } else { - initializeStyle.put(style, style); - return style; - } - } - - /** - * getInstance - */ - public static NewFormStyle getInstance(FRFont frFont) { - if (frFont == null) { - return NewFormStyle.getInstance(); - } - return DEFAULT_STYLE.deriveFRFont(frFont); - } - - /** - * 设置背景 - * - * @param background 背景 b - * @return 样式 y - */ - public NewFormStyle deriveBackground(Background background) { - if (background instanceof ImageBackground) { - return new NewFormStyle(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * getInstance - */ - public static NewFormStyle getInstance(Background background) { - return DEFAULT_STYLE.deriveBackground(background); - } - - /** - * 去掉边框和单元格背景 - * - * @return 样式y - */ - public NewFormStyle deriveBorderBackgroundNone() { - return getInstance(null, format, frFont, - Constants.LINE_NONE, border_top_color, Constants.LINE_NONE, border_bottom_color, - Constants.LINE_NONE, border_left_color, Constants.LINE_NONE, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置边框 - * - * @param border_top 上边框像素 - * @param border_top_color 上边框颜色s - * @param border_bottom 下 x - * @param border_bottom_color 下 x - * @param border_left 左 z - * @param border_left_color 左z - * @param border_right 右y - * @param border_right_color 右y - * @return 样式y - */ - public NewFormStyle deriveBorder(int border_top, Color border_top_color, - int border_bottom, Color border_bottom_color, - int border_left, Color border_left_color, - int border_right, Color border_right_color) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置上边框 - * - * @param border_top 上边框尺寸s - * @param border_top_color 上边框颜色 s - * @return 样式 y - */ - public NewFormStyle deriveBorderTop(int border_top, Color border_top_color) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置下边框 - * - * @param border_bottom 下边框尺寸 x - * @param border_bottom_color 下颜色x - * @return 样式y - */ - public NewFormStyle deriveBorderBottom(int border_bottom, Color border_bottom_color) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置左边框 - * - * @param border_left 尺寸 z - * @param border_left_color 颜色y - * @return 样式y - */ - public NewFormStyle deriveBorderLeft(int border_left, Color border_left_color) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置右边框 - * - * @param border_right 尺寸 c - * @param border_right_color 颜色 y - * @return 样式 y - */ - public NewFormStyle deriveBorderRight(int border_right, Color border_right_color) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置水平方向 - * - * @param horizontal_alignment 水平方向s - * @return 样式 y - */ - public NewFormStyle deriveHorizontalAlignment(int horizontal_alignment) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置垂直方向 - * - * @param vertical_alignment 垂直方向c - * @return 样式 - * @see Constants#TOP - * @see Constants#CENTER - * @see Constants#BOTTOM - */ - public NewFormStyle deriveVerticalAlignment(int vertical_alignment) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置单元格展示样式(自动换行, 单行显示, 多行显示等) - * - * @param textStyle 文字样式 - * @return 样式 - * @see NewFormStyle#TEXTSTYLE_WRAPTEXT - * @see NewFormStyle#TEXTSTYLE_SINGLELINE - * @see NewFormStyle#TEXTSTYLE_SINGLELINEADJUSTFONT - * @see NewFormStyle#TEXTSTYLE_MULTILINEADJUSTFONT - */ - public NewFormStyle deriveTextStyle(int textStyle) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置单元格方向 - * - * @param textDirection 文本方向w - * @return 样式t - */ - public NewFormStyle deriveTextDirection(int textDirection) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置单元格垂直方向 - * - * @param verticalText 垂直方向c - * @return 样式 - */ - public NewFormStyle deriveVerticalText(int verticalText) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置旋转方向 - * - * @param rotation 旋转方向 the new rotation of cell (between -90 and 90 degrees). - * @return 样式 - */ - public NewFormStyle deriveRotation(int rotation) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置图片布局 - * - * @param imageLayout the new image layout 图片布局t - * @return 样式 - * @see Constants#IMAGE_TILED - * @see Constants#IMAGE_CENTER - * @see Constants#IMAGE_EXTEND - */ - public NewFormStyle deriveImageLayout(int imageLayout) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置缩进 - * - * @param paddingLeft 左缩进 - * @param paddingRight 右缩进 - * @return 样式 - */ - public NewFormStyle derivePadding(int paddingLeft, int paddingRight) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置左缩进 - * - * @param paddingLeft 左缩进 - * @return 样式 - */ - public NewFormStyle derivePaddingLeft(int paddingLeft) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置右缩进 - * - * @param paddingRight 右缩进 - * @return 样式 - */ - public NewFormStyle derivePaddingRight(int paddingRight) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置段前间距 - * - * @param spacingBefore 段前间距d - * @return 样式 y - */ - public NewFormStyle deriveSpacingBefore(int spacingBefore) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置段后间距 - * - * @param spacingAfter 段后间距d - * @return 样式y - */ - public NewFormStyle deriveSpacingAfter(int spacingAfter) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 设置行间距 - * - * @param lineSpacing 行间距h - * @return 样式y - */ - public NewFormStyle deriveLineSpacing(int lineSpacing) { - return getInstance(background, format, frFont, - border_top, border_top_color, border_bottom, border_bottom_color, - border_left, border_left_color, border_right, border_right_color, - horizontal_alignment, vertical_alignment, textStyle, - verticalText, textDirection, rotation, imageLayout, - paddingLeft, paddingRight, spacingBefore, spacingAfter, lineSpacing); - } - - /** - * 对象转为json格式 - * - * @param repo 浏览器上下文 - * @param size 单元格大小 - * @return json格式数据 - */ - public JSONObject toJSONObject(Repository repo, Dimension size) throws JSONException { - JSONObject jo = new JSONObject(); - if (background != null) { - jo.put("background", background.toJSONObject(repo, size)); - } - // 不是默认值才输出,节省流量 - if (frFont != null && !ComparatorUtils.equals(frFont, FRContext.getDefaultValues().getFRFont())) { - jo.put("font", frFont.toJSONObject(repo)); - } - - if (!checkLeftRightTopBottom4b0()) { - jo.put("border", border2JSONObject()); - jo.put("borderCss", borderClsCss); - } - - createAlignAndTextStyleConfig(jo); - if (rotation != 0) { - jo.put("ro", rotation); - } - if (imageLayout != Constants.IMAGE_CENTER) { - jo.put("il", imageLayout); - } - createSpacingAndPaddingConfig(jo); - - return jo; - } - - private void createAlignAndTextStyleConfig(JSONObject jo) throws JSONException { - if (horizontal_alignment != Constants.NULL) { - jo.put("ha", horizontal_alignment); - } - if (vertical_alignment != Constants.CENTER) { - jo.put("va", vertical_alignment); - } - if (textStyle != TEXTSTYLE_WRAPTEXT) { - jo.put("ts", textStyle); - } - if (verticalText != NewFormStyle.HORIZONTALTEXT) { - jo.put("vt", verticalText); - } - if (textDirection != RIGHT_TO_LEFT) { - jo.put("td", textDirection); - } - jo.put("contentCss", contentClsCss); - } - - private void createSpacingAndPaddingConfig(JSONObject jo) throws JSONException { - if (paddingLeft != DEFAULT_PADDING) { - jo.put("pl", paddingLeft); - } - if (paddingRight != DEFAULT_PADDING) { - jo.put("pr", paddingRight); - } - if (spacingBefore != 0) { - jo.put("sb", spacingBefore); - } - if (spacingAfter != 0) { - jo.put("sa", spacingAfter); - } - if (lineSpacing != 0) { - jo.put("ls", lineSpacing); - } - } - - /** - * 获取字体 - */ - public FRFont getFRFont() { - if (this.frFont == null) { - this.frFont = FRContext.getDefaultValues().getFRFont(); - } - return this.frFont; - } - - /** - * Gets cell format. - */ - public Format getFormat() { - return this.format; - } - - /** - * Gets background. - */ - public Background getBackground() { - return this.background; - } - - /** - * Gets the type of border to use for the top border of the cell. - * - * @see Constants#LINE_NONE - * @see Constants#LINE_THIN - * @see Constants#LINE_MEDIUM - * @see Constants#LINE_DASH - * @see Constants#LINE_HAIR - * @see Constants#LINE_HAIR2 - * @see Constants#LINE_THICK - * @see Constants#LINE_DOUBLE - * @see Constants#LINE_DOT - * @see Constants#LINE_MEDIUM_DASH - * @see Constants#LINE_DASH_DOT - * @see Constants#LINE_MEDIUM_DASH_DOT - * @see Constants#LINE_DASH_DOT_DOT - * @see Constants#LINE_MEDIUM_DASH_DOT_DOT - * @see Constants#LINE_SLANTED_DASH_DOT - */ - public int getBorderTop() { - return this.border_top; - } - - /** - * 获取上边框线的宽度 - */ - public int getBorderTopWidth() { - return GraphHelper.getLineStyleSize(this.getBorderTop()); - } - - /** - * Gets the type of border to use for the left border of the cell. - * - * @see Constants#LINE_NONE - * @see Constants#LINE_THIN - * @see Constants#LINE_MEDIUM - * @see Constants#LINE_DASH - * @see Constants#LINE_HAIR - * @see Constants#LINE_HAIR2 - * @see Constants#LINE_THICK - * @see Constants#LINE_DOUBLE - * @see Constants#LINE_DOT - * @see Constants#LINE_MEDIUM_DASH - * @see Constants#LINE_DASH_DOT - * @see Constants#LINE_MEDIUM_DASH_DOT - * @see Constants#LINE_DASH_DOT_DOT - * @see Constants#LINE_MEDIUM_DASH_DOT_DOT - * @see Constants#LINE_SLANTED_DASH_DOT - */ - public int getBorderLeft() { - return this.border_left; - } - - public int getBorderLeftWidth() { - return GraphHelper.getLineStyleSize(this.getBorderLeft()); - } - - public int getBorderRightWidth() { - return GraphHelper.getLineStyleSize(this.getBorderRight()); - } - - public int getBorderBottomWidth() { - return GraphHelper.getLineStyleSize(this.getBorderBottom()); - } - - /** - * Gets the type of border to use for the bottom border of the cell. - * - * @see Constants#LINE_NONE - * @see Constants#LINE_THIN - * @see Constants#LINE_MEDIUM - * @see Constants#LINE_DASH - * @see Constants#LINE_HAIR - * @see Constants#LINE_HAIR2 - * @see Constants#LINE_THICK - * @see Constants#LINE_DOUBLE - * @see Constants#LINE_DOT - * @see Constants#LINE_MEDIUM_DASH - * @see Constants#LINE_DASH_DOT - * @see Constants#LINE_MEDIUM_DASH_DOT - * @see Constants#LINE_DASH_DOT_DOT - * @see Constants#LINE_MEDIUM_DASH_DOT_DOT - * @see Constants#LINE_SLANTED_DASH_DOT - */ - public int getBorderBottom() { - return this.border_bottom; - } - - /** - * Gets the type of border to use for the right border of the cell. - * - * @see Constants#LINE_NONE - * @see Constants#LINE_THIN - * @see Constants#LINE_MEDIUM - * @see Constants#LINE_DASH - * @see Constants#LINE_HAIR - * @see Constants#LINE_HAIR2 - * @see Constants#LINE_THICK - * @see Constants#LINE_DOUBLE - * @see Constants#LINE_DOT - * @see Constants#LINE_MEDIUM_DASH - * @see Constants#LINE_DASH_DOT - * @see Constants#LINE_MEDIUM_DASH_DOT - * @see Constants#LINE_DASH_DOT_DOT - * @see Constants#LINE_MEDIUM_DASH_DOT_DOT - * @see Constants#LINE_SLANTED_DASH_DOT - */ - public int getBorderRight() { - return this.border_right; - } - - /** - * Gets the color of border to use for the top border of the cell. - */ - public Color getBorderTopColor() { - return this.border_top_color; - } - - /** - * Gets the color of border to use for the left border of the cell. - */ - public Color getBorderLeftColor() { - return this.border_left_color; - } - - /** - * Gets the color of border to use for the bottom border of the cell. - */ - public Color getBorderBottomColor() { - return this.border_bottom_color; - } - - /** - * Gets the color of border to use for the right border of the cell. - */ - public Color getBorderRightColor() { - return this.border_right_color; - } - - /** - * Gets the type of horizontal alignment for the cell - * - * @see BaseUtils#getAlignment4Horizontal(NewFormStyle style, Object value) - * @see BaseUtils#getAlignment4Horizontal(NewFormStyle style) - * @see Constants#LEFT - * @see Constants#CENTER - * @see Constants#RIGHT - * @deprecated suggest not directly use; - */ - public int getHorizontalAlignment() { - return this.horizontal_alignment; - } - - /** - * Gets the type of vertical alignment for the cell - * - * @see Constants#TOP - * @see Constants#CENTER - * @see Constants#BOTTOM - */ - public int getVerticalAlignment() { - return this.vertical_alignment; - } - - /** - * Gets the text style. - * - * @see NewFormStyle#TEXTSTYLE_WRAPTEXT - * @see NewFormStyle#TEXTSTYLE_SINGLELINE - * @see NewFormStyle#TEXTSTYLE_SINGLELINEADJUSTFONT - * @see NewFormStyle#TEXTSTYLE_MULTILINEADJUSTFONT - */ - public int getTextStyle() { - return textStyle; - } - - /** - * Gets the value of verticalText - */ - public int getVerticalText() { - return this.verticalText; - } - - /** - * Gets the value of textDirection - */ - public int getTextDirection() { - return this.textDirection; - } - - /** - * Gets the degree of rotation for the text in the cell - * (between -90 and 90 degrees). - */ - public int getRotation() { - return this.rotation; - } - - /** - * Gets the image layout - * - * @return the image layout - * @see Constants#IMAGE_TILED - * @see Constants#IMAGE_CENTER - * @see Constants#IMAGE_EXTEND - */ - public int getImageLayout() { - return imageLayout; - } - - /** - * get indentation value - */ - public int getPaddingLeft() { - return this.paddingLeft; - } - - /** - * get indentation value - */ - public int getPaddingRight() { - return this.paddingRight; - } - - /** - * @return the spacingBefore - */ - public byte getSpacingBefore() { - return spacingBefore; - } - - /** - * @return the spacingAfter - */ - public byte getSpacingAfter() { - return spacingAfter; - } - - /** - * @return the lineSpacing - */ - public byte getLineSpacing() { - return lineSpacing; - } - - - /** - * 如果单元格内容不为数字或者字符串的时候使用静态数据 - * - * @return - */ - public String getContentClsCss() { - return contentClsCss; - } - - /** - * 若value为数字或字符串需要判断一下是否可以转换为数字显示 - * - * @param value - * @return - */ - public String getContentClsCss(Object value) { - return this.contentStyle2class(this.contentStyleCssMap, value); - } - - /** - * getContentStyleCssMap - */ - public Map getContentStyleCssMap() { - return contentStyleCssMap; - } - - /** - * getBorderClsCss - */ - public String getBorderClsCss() { - return borderClsCss; - } - - /** - * getBorderStyleCssMap - */ - public Map getBorderStyleCssMap() { - return borderStyleCssMap; - } - - /** - * contentStyle2class - */ - private String contentStyle2class(Map contentCssMap) { - return contentStyle2class(contentCssMap, null); - } - - protected String contentStyle2class(Map contentCssMap, Object value) { - StringBuilder sb = new StringBuilder(); - sb.append("fh"); - int horizontal_alignment = BaseUtils.getAlignment4Horizontal(this, value); - switch (horizontal_alignment) { - case Constants.CENTER: - sb.append(" tac"); - break; - case Constants.RIGHT: - sb.append(" tar"); - break; - } - switch (this.vertical_alignment) { - case Constants.BOTTOM: - sb.append(" vab"); - break; - case Constants.TOP: - sb.append(" vat"); - break; - } - - if (this.textStyle != NewFormStyle.TEXTSTYLE_WRAPTEXT - && this.textStyle != NewFormStyle.TEXTSTYLE_MULTILINEADJUSTFONT) { - sb.append(" nw"); - } else { - sb.append(" bw"); // alex:只可以用于ie,英文的长单词会被换行分开 - } - - FRFont font = this.getFRFont(); - if (font != null) { - sb.append(font2Class(font, contentCssMap, lineSpacing)); - } - - int lit = this.paddingLeft; - int rit = this.paddingRight; - int tit = this.spacingBefore; - int bit = this.spacingAfter; - //这边的<= 包括下面<>修改的话, 都要做好兼容的 - if (lit <= DEFAULT_PADDING) { - sb.append(" pl" + lit); - } else { - contentCssMap.put("padding-left", lit + "pt"); - } - - if (rit < DEFAULT_PADDING) { - sb.append(" pr" + rit); - } else if (rit > DEFAULT_PADDING) { - contentCssMap.put("padding-right", rit + "pt"); - } - - if (0 < tit && tit <= DEFAULT_PADDING) { - sb.append(" pt" + tit); - } else if (tit > DEFAULT_PADDING) { - contentCssMap.put("padding-top", tit + "pt"); - } - - if (0 < bit && bit <= DEFAULT_PADDING) { - sb.append(" pb" + bit); - } else if (bit > DEFAULT_PADDING) { - contentCssMap.put("padding-bottom", bit + "pt"); - } - - return sb.toString().trim(); - } - - public JSONObject border2JSONObject() throws JSONException { - JSONObject borderJSON = new JSONObject(); - if (checkLeftRightTopBottom4b1()) { - borderJSON.put("b1", true); - } else { - border2JSONObject(borderJSON, border_top, border_top_color, "t"); - border2JSONObject(borderJSON, border_left, border_left_color, "l"); - border2JSONObject(borderJSON, border_bottom, border_bottom_color, "b"); - border2JSONObject(borderJSON, border_right, border_right_color, "r"); - } - return borderJSON; - } - - private void border2JSONObject(JSONObject jo, byte borderStyle, Color borderColor, String position) throws JSONException { - if (borderStyle == Constants.LINE_THIN - && ComparatorUtils.equals(borderColor, Color.black)) { - jo.put(position, new JSONObject().put("w", 1)); - } else { - int bw = BaseUtils.getBorderWidth(borderStyle); - if (bw > 0) { - JSONObject extra = new JSONObject(); - extra.put("w", bw); - if (!ComparatorUtils.equals(borderColor, Color.black)) { - extra.put("c", StableUtils.javaColorToCSSColor(borderColor)); - } - // 留着保持兼容老的app - extra.put("s", borderLine2String(borderStyle)); - // MOBILE-21527 报表设计器设置不同的border后台返回具体的border类型 - extra.put("type", borderStyle); - jo.put(position, extra); - } - } - } - - private String borderLine2String(int borderStyle) { - switch (borderStyle) { - case Constants.LINE_THIN: - case Constants.LINE_SLIM: - return "t"; - case Constants.LINE_MEDIUM: - return "m"; - case Constants.LINE_THICK: - return "tk"; - case Constants.LINE_DOUBLE: - return "de"; - case Constants.LINE_DOT: - return "dt"; - case Constants.LINE_DASH_DOT: - return "dadt"; - case Constants.LINE_DASH_DOT_DOT: - return "ddd"; - default: - return "dash"; - } - } - - /* - * 返回classBuf与styleBuf - */ - private String border2Class(Map borderCssMap) { - StringBuilder sb = new StringBuilder(); - // 简化class - if (checkLeftRightTopBottom4b0()) { - sb.append(" b0"); - return sb.toString().trim(); - } else if (checkLeftRightTopBottom4b1()) { - sb.append(" b1"); - return sb.toString().trim(); - } - - // right - visible_border_css(this.border_right, this.border_right_color, sb, borderCssMap, "r"); - // bottom - visible_border_css(this.border_bottom, this.border_bottom_color, sb, borderCssMap, "b"); - // left - visible_border_css(this.border_left, this.border_left_color, sb, borderCssMap, "l"); - // top - visible_border_css(this.border_top, this.border_top_color, sb, borderCssMap, "t"); - - return sb.toString().trim(); - } - - private boolean checkLeftRightTopBottom4b0() { - return this.border_left == Constants.LINE_NONE && this.border_right == Constants.LINE_NONE - && this.border_top == Constants.LINE_NONE && this.border_bottom == Constants.LINE_NONE; - } - - private boolean checkLeftRightTopBottom4b1() { - return this.border_left == Constants.LINE_THIN && this.border_right == Constants.LINE_THIN - && this.border_top == Constants.LINE_THIN && this.border_bottom == Constants.LINE_THIN - && ComparatorUtils.equals(this.border_left_color, Color.black) - && ComparatorUtils.equals(this.border_right_color, Color.black) - && ComparatorUtils.equals(this.border_top_color, Color.black) - && ComparatorUtils.equals(this.border_bottom_color, Color.black); - } - - private static void visible_border_css( - byte border_style, Color border_color, StringBuilder classBuf, Map borderCssMap, String border_position - ) {// right - if (border_style == Constants.LINE_THIN - && ComparatorUtils.equals(border_color, Color.black)) { - classBuf.append(" b" + border_position + "1"); - } - - int bw = BaseUtils.getBorderWidth(border_style); - if (bw > 0) { - // width - classBuf.append(" b" + border_position + "w" + bw); - - // style - classBuf.append(" " + __border2Class(border_style, border_position)); - - // color - // 细线需要另外处理为 rgba,rgba的边框在chrome上会出现渲染问题 - // 转为 rgb 显示 - if (border_style == Constants.LINE_SLIM) { - borderCssMap.put(_position2Colorcss(border_position), - StableUtils.javaColorToCSSColor(brighter(border_color))); - } else if (ComparatorUtils.equals(border_color, Color.black)) { - classBuf.append(" b" + border_position + "cb"); - } else { - borderCssMap.put(_position2Colorcss(border_position), StableUtils.javaColorToCSSColor(border_color)); - } - } else { - classBuf.append(" b" + border_position + "0"); - } - } - - private static Color brighter(Color ori) { - return new Color(Math.min((int) ((1 - FACTORY_ALPHA) * 255 + FACTORY_ALPHA * ori.getRed()), 255), - Math.min((int) ((1 - FACTORY_ALPHA) * 255 + FACTORY_ALPHA * ori.getGreen()), 255), - Math.min((int) ((1 - FACTORY_ALPHA) * 255 + FACTORY_ALPHA * ori.getBlue()), 255), - 255); - } - - private static String _position2Colorcss(String border_position) { - if (ComparatorUtils.equals(border_position, "r")) { - return "border-right-color"; - } else if (ComparatorUtils.equals(border_position, "b")) { - return "border-bottom-color"; - } else if (ComparatorUtils.equals(border_position, "l")) { - return "border-left-color"; - } else if (ComparatorUtils.equals(border_position, "t")) { - return "border-top-color"; - } else { - return "border-color"; - } - } - - private static String __border2Class(int borderStyle, String d) { - switch (borderStyle) { - case Constants.LINE_SLIM: - return "b" + d + "ss"; - case Constants.LINE_THIN: - return "b" + d + "ss"; - case Constants.LINE_MEDIUM: - return "b" + d + "ss"; - case Constants.LINE_THICK: - return "b" + d + "ss"; - case Constants.LINE_DOUBLE: - return "b" + d + "sd"; - case Constants.LINE_DOT: - return "b" + d + "sdo"; - case Constants.LINE_DASH_DOT: - return "b" + d + "sdo"; - case Constants.LINE_DASH_DOT_DOT: - return "b" + d + "sdo"; - default: - return "b" + d + "sda"; - } - } - - private static String font2Class(Font font, Map cssMap, byte lineSpacing) { - StringBuilder sb = new StringBuilder(); - if (font.isBold()) { - sb.append(" fwb"); - } - if (font.isItalic()) { - sb.append(" fsi"); - } - String fontName = font.getName(); - String cls = (String) getclsFontFamily().get(fontName); - if (cls == null) { - // REPORT-25741 部分字体需要加引号才能识别 - cssMap.put("font-family", "'" + fontName + "'"); - } else if (!ComparatorUtils.equals(cls, "fnss")) { // alex:font-family:SimSun写在fh里面了 - sb.append(" " + cls); - } - float size = font.getSize2D(); - if (AssistUtils.equals(size, N_SIZE)) { // alex:font-size:9pt写在fh里面 - } else if (size >= MIN_SIZE && size <= MAX_SIZE) { - size = Utils.round5(size); - sb.append(" f" + String.valueOf(size).replace('.', '-')); - } else { - cssMap.put("font-size", font.getSize2D() + "pt"); - } - - if (lineSpacing != 0) { - // carl:直接在这里添上line-height - //cellFM.getHeight() 不能简单的 *(4/3)进行转换,数值不对 - FontMetrics cellFM = GraphHelper.getFontMetrics(FRFont.getInstance(font).applyResolutionNP(Constants.FR_PAINT_RESOLUTION)); - cssMap.put("line-height", (int) (cellFM.getHeight() + lineSpacing * LINE_HEIGHT_FIX / LINE_HEIGHT_FIX2) + "px"); - } - - font2ClassOnFRFont(font, cssMap, sb); - - return sb.toString(); - } - - private static void font2ClassOnFRFont(Font font, Map cssMap, StringBuilder sb) { - if (font instanceof FRFont) { - if (((FRFont) font).isStrikethrough()) { - if (((FRFont) font).getUnderline() != Constants.LINE_NONE) { - sb.append(" tdstu"); - } else { - sb.append(" tdst"); - } - } else { - if (((FRFont) font).getUnderline() != Constants.LINE_NONE) { - sb.append(" tdu"); - } - } - if (((FRFont) font).isSubscript()) { - sb.append(" suber"); - } else if (((FRFont) font).isSuperscript()) { - sb.append(" super"); - } - if (((FRFont) font).isShadow()) { - sb.append(" shadow"); - } - Color color = ((FRFont) font).getForeground(); - if (!ComparatorUtils.equals(color, Color.black) && color != null) { - cssMap.put("color", StableUtils.javaColorToCSSColor(color)); - } - } - } - - - private transient int hashCode = -1; - - /** - * 哈希码 - * - * @return 哈希值h - */ - public int hashCode() { - - if (hashCode == -1) { - //因为format和非ColorBackground的Background并不是唯一的(也就是说即使equals但hashCode也会不一样),所以不放在hashCode的计算里面 - int code = this.border_top ^ this.border_bottom ^ this.border_left ^ this.border_right ^ - this.border_top_color.hashCode() ^ this.border_bottom_color.hashCode() ^ - this.border_left_color.hashCode() ^ this.border_right_color.hashCode() ^ - this.horizontal_alignment ^ this.imageLayout ^ this.verticalText ^ - this.paddingLeft ^ this.paddingRight ^ this.rotation ^ this.textDirection ^ this.textStyle ^ this.vertical_alignment; - - if (frFont != null) { - code ^= frFont.hashCode(); - } - if (background != null) { - code = background.fixHashCode(code); - } - hashCode = code; - } - return hashCode; - } - - /** - * Equals. - */ - public boolean equals(Object object) { - if (object == this) { - return true; - } - if (!(object instanceof NewFormStyle)) { - return false; - } - - NewFormStyle newStyle = (NewFormStyle) object; - - //由于java中所有的Format都实现了equals()方法,这里可以直接来比较. - return ComparatorUtils.equals(newStyle.getFormat(), this.getFormat()) && - ComparatorUtils.equals(newStyle.getFRFont(), this.getFRFont()) && - ComparatorUtils.equals(newStyle.getBackground(), this.getBackground()) && - - newStyle.getBorderTop() == this.getBorderTop() && - newStyle.getBorderLeft() == this.getBorderLeft() && - newStyle.getBorderBottom() == this.getBorderBottom() && - newStyle.getBorderRight() == this.getBorderRight() && - - ComparatorUtils.equals(newStyle.getBorderTopColor(), this.getBorderTopColor()) && - ComparatorUtils.equals(newStyle.getBorderLeftColor(), this.getBorderLeftColor()) && - ComparatorUtils.equals(newStyle.getBorderBottomColor(), this.getBorderBottomColor()) && - ComparatorUtils.equals(newStyle.getBorderRightColor(), this.getBorderRightColor()) && - - BaseUtils.getAlignment4Horizontal(newStyle) == BaseUtils.getAlignment4Horizontal(this) && - newStyle.getVerticalAlignment() == this.getVerticalAlignment() && - newStyle.getTextStyle() == this.getTextStyle() && - - //james verticalText - newStyle.getVerticalText() == this.getVerticalText() && - newStyle.getTextDirection() == this.getTextDirection() && - newStyle.getRotation() == this.getRotation() && - newStyle.getImageLayout() == this.getImageLayout() && - - // alex padding - newStyle.getPaddingLeft() == this.getPaddingLeft() && - newStyle.getPaddingRight() == this.getPaddingRight() && - - //间距 - newStyle.getSpacingBefore() == this.getSpacingBefore() && - newStyle.getSpacingAfter() == this.getSpacingAfter() && - newStyle.getLineSpacing() == this.getLineSpacing(); - } - - /** - * Clone. - */ - public Object clone() throws CloneNotSupportedException { - return this; - } - - protected Object readResolve() throws InvalidObjectException { - if (this.getClass() != NewFormStyle.class) { - throw new InvalidObjectException("subclass didn't correctly implement readResolve"); - } - - Object res = initializeStyle.get(this); - //alex:从ObjectInputStream生成的Object可能不存在于全局的map中,可能为null - if (res == null) { - res = this; - initializeStyle.put(this, res); - } - - return res; - } - - /** - * 画单元格的Value - *

- * 通过width, height方式画 - */ - public static void paintContent(Graphics2D g2d, Object value, NewFormStyle style, int width, int height, int resolution) { - // kunsnat: 添加判断width和height. 是否有必要继续paint, @bug0006854, 增加了混乱的字符. - if (value == null || width == 0 || height == 0) { - return; - } - - if (style == null) { - //peter:获取默认的Style. - style = NewFormStyle.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER); - } - - if (value instanceof BaseFormula) { - value = ((BaseFormula) value).getResult(); - } - - if (value instanceof Painter) { - // TODO 弹出界面然后 esc bug.. - ((Painter) value).paint(g2d, width, height, resolution, style); - } else if (value instanceof ImageProvider) { - paintImageContent(g2d, ((ImageProvider) value).getImage(), style, width, height, resolution); - } else if (value instanceof Image) { - paintImageContent(g2d, (Image) value, style, width, height, resolution); - } else { - //默认Paint String - String text = valueToText(value, style.getFormat()); - paintCellStyleString(g2d, width, height, text, style, resolution); - } - } - - public static void paintImageContent(Graphics2D g2d, Image value, NewFormStyle style, int width, int height, int resolution) { - int imageLayout = CoreGraphHelper.changeImageLayout4Draw(value, style.getImageLayout(), width, height); - - //这边做scale的目的是为了在导出图片以及以图片方式打印时,根据不同的resolution调整对应的dpi - int defaultResolution = Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION; - double scale = resolution * 1d / defaultResolution; - width = (int) (width / scale); - height = (int) (height / scale); - g2d.scale(scale, scale); - - GraphHelper.paintImage(g2d, width, height, value, imageLayout, - style.getHorizontalAlignment(), style.getVerticalAlignment(), -1, -1); - //最后把画板改回来 - g2d.scale(defaultResolution * 1d / resolution, defaultResolution * 1d / resolution); - } - - /** - * 画单元格的Value - *

- * 通过PaintRectangle + ClipRectangle画 - */ - public static void paintContent(Graphics2D g2d, Object value, int resolution, NewFormStyle style, Rectangle paintRectangle, Rectangle clipRectangle) { - Shape oldClip = g2d.getClip(); - g2d.translate(paintRectangle.getX(), paintRectangle.getY()); - g2d.clip(clipRectangle); // kunsnat: 这些clip 都没有考虑边框啊!!! 所有图表的边框压缩到里面去了. - - paintContent(g2d, value, style, paintRectangle.width, paintRectangle.height, resolution); - - g2d.translate(-paintRectangle.getX(), -paintRectangle.getY()); - g2d.setClip(oldClip); - } - - /** - * 画背景 - *

- * 通过width, height方式画 - */ - public static void paintBackground(Graphics2D g2d, NewFormStyle style, double width, double height) { - if (style == null) {// 还是需要检查一下的,假如DefaultCellStyle拥有Border就需要Paint了. - return; - } - - // paint background. - Background background = style.getBackground(); - if (background == null) { - return; - } - - background.layoutDidChange((int) width, (int) height); - synchronized (tempRectangle2D) { - tempRectangle2D.setRect(0, 0, width, height); - background.paint(g2d, tempRectangle2D); - } - } - - /** - * 画单元格的背景 - *

- * 通过PaintRectangle + ClipRectangle画 - */ - public static void paintBackground(Graphics2D g2d, NewFormStyle style, Rectangle paintRectangle, Rectangle clipRectangle) { - if (style == null) { - //peter:获取默认的Style. - style = NewFormStyle.DEFAULT_STYLE; - } - Shape oldClip = g2d.getClip(); - g2d.translate(paintRectangle.getX(), paintRectangle.getY()); - g2d.clip(clipRectangle); - Background background = style.getBackground(); - - if (background != null) { - // alex:根据paintRectangle和clipRectangle共同决定Background的PaintRectangle - background.paint(g2d, new Rectangle( - clipRectangle.x, clipRectangle.y, - clipRectangle.width, clipRectangle.height)); - } - g2d.translate(-paintRectangle.getX(), -paintRectangle.getY()); - g2d.setClip(oldClip); - } - - /** - * 画边框 - *

- * 通过width, height方式画 - */ - public static void paintBorder(Graphics2D g2d, NewFormStyle style, double width, double height) { - if (style == null) {// 还是需要检查一下的,假如DefaultCellStyle拥有Border就需要Paint了. - return; - } - - //peter:当是粗线的时候,需要计算尺寸 - double left = 0; - double right = 0; - if (style.getBorderLeft() != Constants.LINE_NONE) { - int borderLeftSize = GraphHelper.getLineStyleSize(style.getBorderLeft()); - left = borderLeftSize / 2; - } - if (style.getBorderRight() != Constants.LINE_NONE) { - int borderRightSize = GraphHelper.getLineStyleSize(style.getBorderRight()); - right = borderRightSize / 2; - } - - double top = 0; - double bottom = 0; - if (style.getBorderTop() != Constants.LINE_NONE) { - int bSize = GraphHelper.getLineStyleSize(style.getBorderTop()); - top = bSize / 2; - } - if (style.getBorderBottom() != Constants.LINE_NONE) { - int bSize = GraphHelper.getLineStyleSize(style.getBorderBottom()); - bottom = bSize / 2; - } - - // paint border - if (style.getBorderTop() != Constants.LINE_NONE) { - g2d.setPaint(style.getBorderTopColor()); - GraphHelper.drawLine(g2d, 0 - left, 0, width + right, 0, style.getBorderTop()); - } - if (style.getBorderLeft() != Constants.LINE_NONE) { - g2d.setPaint(style.getBorderLeftColor()); - GraphHelper.drawLine(g2d, 0, 0 - top, 0, height + bottom, style.getBorderLeft()); - } - if (style.getBorderBottom() != Constants.LINE_NONE) { - g2d.setPaint(style.getBorderBottomColor()); - GraphHelper.drawLine(g2d, 0 - left, height, width + right, height, style.getBorderBottom()); - } - if (style.getBorderRight() != Constants.LINE_NONE) { - g2d.setPaint(style.getBorderRightColor()); - GraphHelper.drawLine(g2d, width, 0 - top, width, height + bottom, style.getBorderRight()); - } - } - - /** - * 画单元格的边框 - *

- * 通过PaintRectangle + ClipRectangle画边框 - */ - public static void paintBorder(Graphics2D g2d, NewFormStyle style, Rectangle paintRectangle, Rectangle clipRectangle) { - //单元格行高列宽=0时, 不需要绘制边框 - if (paintRectangle.width == 0 || paintRectangle.height == 0) { - return; - } - g2d.translate(paintRectangle.getX(), paintRectangle.getY()); - - Rectangle realPaintRect = new Rectangle(0, 0, - paintRectangle.width, paintRectangle.height); - //peter:需要判断的因为clipRectangle极可能不是null. - if (clipRectangle != null) { - realPaintRect = realPaintRect.intersection(clipRectangle); - } - g2d.translate(realPaintRect.getX(), realPaintRect.getY()); - - if (style == null) {// 还是需要检查一下的,假如DefaultCellStyle拥有Border就需要Paint了. - //peter:获取默认的Style. - style = NewFormStyle.DEFAULT_STYLE; - } - - paintBorder(g2d, style, realPaintRect.getWidth(), realPaintRect.getHeight()); - - // 返回Translate - g2d.translate(-realPaintRect.getX(), -realPaintRect.getY()); - g2d.translate(-paintRectangle.getX(), -paintRectangle.getY()); - } - - /** - * 转化成文本 - * - * @param value 带转化的对象 - * @param format 格式g - * @return 字符串z - */ - public static String valueToText(Object value, Format format) { - //需要画的值,主要是把公式里面的值拿出来 - Object valueToPaint = value; - String text = null; - - String checkInfinity = StableUtils.checkInfinity(value); - if (StringUtils.isNotEmpty(checkInfinity)) { - return checkInfinity; - } - - if (value != null) { - if (value instanceof BaseFormula) { - BaseFormula formula = (BaseFormula) value; - if (StableUtils.isNull(formula.getResult())) { - return StringUtils.EMPTY;// BUG4788,应该显示空字符串 - } else { - valueToPaint = formula.getResult(); - } - } else if (value instanceof Clob) { - valueToPaint = DataBaseUtils.clob2String((Clob) value); - } - - if (format != null) { - format = FormatRepository.getInstance().getLocalFormat(format); - if (format instanceof DateFormat) {// Date. - text = valueInDateFormat((DateFormat) format, valueToPaint); - } else if (format instanceof NumberFormat) {// Number. - text = valueInNumberFormat(format, valueToPaint); - } else { - try { - text = format.format(valueToPaint); - } catch (Exception exp) { - text = Utils.objectToString(valueToPaint); - } - } - } else - text = Utils.objectToString(valueToPaint); - } else { - text = StringUtils.EMPTY; - } - - return text; - } - - protected static String valueInNumberFormat(Format format, Object valueToPaint) { - Number number = GeneralUtils.objectToNumberReturnNull(valueToPaint); - if (number != null) { - try { - if (format instanceof CoreDecimalFormat) { - //数字类型的要roundup一下, 默认会逢5奇进偶不进, 62.325->62.33 - return ((CoreDecimalFormat) format).formatRoundingModeUp(number); - } - //62.325->62.32 - return format.format(number); - } catch (Exception ignore) { - } - } - return Utils.objectToString(valueToPaint); - } - - private static String valueInDateFormat(DateFormat format, Object valueToPaint) { - - String result; - Date date2Format = tryGet(format, valueToPaint); - if (date2Format == null) { - date2Format = DateUtils.object2Date(valueToPaint, true); - } - if (date2Format != null) { - result = format.format(date2Format); - } - /* - * alex:如果date2Format为null,就是说valueToPaint不能转换成日期型,那么就直接画valueToPaint的字符串 - * 为什么必须要画valueToPaint的字符串呢?见bug0004566 - * 因为在Grid里面直接写=today(),并设置format为日期,如果不画,就一片空白,什么都看不到了 - */ - else { - result = Utils.objectToString(valueToPaint); - } - - return result; - } - - @Nullable - private static Date tryGet(DateFormat format, Object valueToPaint) { - - Date date2Format = null; - // 先用format来生成日期啊 - if (valueToPaint instanceof Date) { - date2Format = (Date) valueToPaint; - } else { - try { - date2Format = format.parse(GeneralUtils.objectToString(valueToPaint)); - } catch (Exception e) { - // nothing - } - } - return date2Format; - } - - /** - * Paint string according to Style. - */ - public static void paintCellStyleString2(Graphics2D g2d, int width, int height, String text, Style style, int resolution) { - if (StringUtils.isBlank(text)) { - return; - } - Paint oldPaint = g2d.getPaint(); - if (style == null) { - style = NewFormStyle.DEFAULT_STYLE; - } - Font rfont = BaseUtils.getStyleFont(g2d, style, resolution); - if (style.getRotation() != 0 && style.getVerticalText() == NewFormStyle.HORIZONTALTEXT) { - BaseUtils.drawStringStyleInRotation(g2d, width, height, text, style, resolution); - } else { - if (style.getTextStyle() == NewFormStyle.TEXTSTYLE_SINGLELINEADJUSTFONT - || style.getTextStyle() == NewFormStyle.TEXTSTYLE_MULTILINEADJUSTFONT) { - List lineTextList = BaseUtils.getLineTextList(text, style, rfont, height, width, resolution); - if (width <= 0 || lineTextList.isEmpty()) { - return; - } - int textAscent = g2d.getFontMetrics().getAscent(); - int textHeight = g2d.getFontMetrics().getHeight(); - - int textY = 0; - int textAllHeight = textHeight * lineTextList.size(); - double spacingBefore = PT.pt2pix(style.getSpacingBefore(), resolution); - double spacingAfter = PT.pt2pix(style.getSpacingAfter(), resolution); - double lineSpacing = PT.pt2pix(style.getLineSpacing(), resolution); - //james:加上间距,WORD中的行间距是从第一行文本的上面一行就算的,所以行间距形成的空隙与文本行数相同 - textAllHeight += spacingBefore + spacingAfter + lineSpacing * lineTextList.size(); - if (style.getVerticalAlignment() == Constants.CENTER) { - if (height > textAllHeight) {// 如果所有文本的高度小于当前可以绘区域的高度,就从0开始画字符. - textY = (height - textAllHeight) / 2; - } - } else if (style.getVerticalAlignment() == Constants.BOTTOM) { - textY = height - textAllHeight; - } - textY += textAscent;// 在绘画的时候,必须添加Ascent的高度. - textY += spacingBefore + lineSpacing;//james:加上"段前间距"+“行间距” - if (style.getTextStyle() == NewFormStyle.TEXTSTYLE_SINGLELINEADJUSTFONT) {// 通过自动调整字体显示所有的信息调整Font来显示所有的字符 - ContentLineGroup contentLineGroup = singleLineAdjustFont(style, lineTextList, width, height, g2d, resolution, true); - _drawContentLineGroup(contentLineGroup, g2d, textY, height, width, BaseUtils.getAlignment4Horizontal(style, text)); - } else if (style.getTextStyle() == NewFormStyle.TEXTSTYLE_MULTILINEADJUSTFONT) { - ContentLineGroup contentLineGroup = mulitiLineAdjustFont(style, lineTextList, width, height, g2d, resolution, true); - _drawContentLineGroup(contentLineGroup, g2d, textY, height, width, BaseUtils.getAlignment4Horizontal(style, text)); - } - } else { - BaseUtils.drawStringStyleInRotation(g2d, width, height, text, style, resolution); - } - } - g2d.setPaint(oldPaint); - } - - - - private static void _drawContentLineGroup( - ContentLineGroup contentLineGroup, Graphics2D g2d, - int textY, int height, int width, int horizontalAlignment - ) { - Style style = contentLineGroup.style; - - Font oldFRFont = g2d.getFont(); - g2d.setFont(style.getFRFont()); - if (style.getVerticalAlignment() == Constants.TOP) { - textY = 0; - } else if (style.getVerticalAlignment() == Constants.CENTER) { - if (height > contentLineGroup.totalHeight()) {// 如果所有文本的高度小于当前可以绘区域的高度,就从0开始画字符. - textY = (height - contentLineGroup.totalHeight()) / 2; - } else { - textY = 0; - } - } else if (style.getVerticalAlignment() == Constants.BOTTOM) { - textY = height - contentLineGroup.totalHeight(); - } - textY += g2d.getFontMetrics().getAscent();// 在绘画的时候,必须添加Ascent的高度. - - for (int i = 0; i < contentLineGroup.newLineTextList.size(); i++) { - double textX = style.getPaddingLeft(); - int textWidth = GraphHelper.getFontMetrics(style.getFRFont()).stringWidth((String) contentLineGroup.newLineTextList.get(i)); - if (horizontalAlignment == Constants.CENTER) { - textX = (width - textWidth - style.getPaddingRight()) / 2.0; - } else if (horizontalAlignment == Constants.RIGHT) { - textX = width - style.getPaddingRight() - textWidth; - } else if (horizontalAlignment == Constants.DISTRIBUTED) {// added by KevinWang - } - - if (horizontalAlignment == Constants.DISTRIBUTED) { - String lineText = (String) contentLineGroup.newLineTextList.get(i);// 分行显示时第i行的内容,但是也可能单行 - double charSpace = (width - style.getPaddingLeft() - style.getPaddingRight() - - g2d.getFontMetrics().charWidth(lineText.charAt(lineText.length() - 1))) - / (lineText.length() - 1); - for (int charIndex = 0; charIndex < lineText.length(); charIndex++) { - char tmpChar = lineText.charAt(charIndex);//取出一个字符待显示 - String tmpString = new String((new StringBuffer()).append(tmpChar));// 将其包装成string形式 - double charX = style.getPaddingLeft() + charIndex * charSpace; - GraphHelper.drawString(g2d, tmpString, charX, textY);//显示 - } - } else { - GraphHelper.drawString(g2d, (String) contentLineGroup.newLineTextList.get(i), textX, textY); - } - textY += contentLineGroup.newTextHeight; - } - g2d.setFont(oldFRFont); - } - - /* - * 通过自动调整字体显示所有的信息调整Font来显示所有的字符 - */ - private static ContentLineGroup singleLineAdjustFont(Style style, List lineTextList, int width, int height, Graphics2D g2d, int resolution, boolean fontScale) { - FRFont newFRFont = (FRFont) style.getFRFont().applyResolutionNP(resolution); - - int maxTextWidth = 0; - FontMetrics oriFontMetrics = GraphHelper.getFontMetrics(newFRFont); - int maxTextHeight = oriFontMetrics.getHeight() * lineTextList.size(); - String examle_text = ""; - for (int i = 0; i < lineTextList.size(); i++) { - if (oriFontMetrics.stringWidth((String) lineTextList.get(i)) > maxTextWidth) { - examle_text = (String) lineTextList.get(i); - maxTextWidth = oriFontMetrics.stringWidth((String) lineTextList.get(i)); - } - } - - if (maxTextWidth > 0 || maxTextHeight > 0) { // 只有当大于0时才改变字体大小 - // 调整宽度和高度 - if (maxTextWidth > (width - style.getPaddingLeft() - style.getPaddingRight()) || maxTextHeight > height) { - while (newFRFont.getSize() > 1) { - newFRFont = newFRFont.applySize((float) newFRFont.getSize() - 1); - maxTextWidth = GraphHelper.getFontMetrics(newFRFont).stringWidth(examle_text); - maxTextHeight = GraphHelper.getFontMetrics(newFRFont).getHeight() * lineTextList.size(); - - // 由于Font的变化单位是1, 所以必须这么找最适合的 Font - if (maxTextWidth <= (width - style.getPaddingLeft() - style.getPaddingRight()) && maxTextHeight <= height) { - break; - } - } - } - } - - FRFont returnFont = style.getFRFont().applySize(fontScale ? newFRFont.getSize2D() : FRFont.convResolution(newFRFont.getSize2D(), resolution)); - return new ContentLineGroup(style.deriveFRFont(returnFont), lineTextList, GraphHelper.getFontMetrics(newFRFont, g2d).getHeight()); - } - - /* - * 多行显示(调整字体大小),即固定单元格高和框,改变字体大小使适应。 - */ - private static ContentLineGroup mulitiLineAdjustFont(Style style, List lineTextList, int width, int height, Graphics2D g2d, int resolution, boolean fontScale) { - FRFont newFRFont = (FRFont) style.getFRFont().applyResolutionNP(resolution); - List newLineTextList; - NewFormStyle tmpStyle = NewFormStyle.DEFAULT_STYLE; - tmpStyle = tmpStyle.deriveTextStyle(NewFormStyle.TEXTSTYLE_WRAPTEXT); - int newTextHeight = GraphHelper.getFontMetrics(newFRFont, g2d).getHeight(); - - newLineTextList = resovleLineTextListByStyle(newFRFont, lineTextList, tmpStyle, width, resolution); - - if (newLineTextList.size() * newTextHeight > height) { - while (newFRFont.getSize() > 1) { - newFRFont = newFRFont.applySize((float) newFRFont.getSize() - 1); - newLineTextList = resovleLineTextListByStyle(newFRFont, lineTextList, tmpStyle, width, resolution); - - newTextHeight = GraphHelper.getFontMetrics(newFRFont, g2d).getHeight(); - if (newLineTextList.size() * newTextHeight <= height) { - break; - } - } - } else if (newLineTextList.size() * newTextHeight < height) { - while (newFRFont.getSize() < MAX_FONT_SIZE) { // _denny: 设定字体最大为100 - newFRFont = newFRFont.applySize((float) newFRFont.getSize() + 1); - - newLineTextList = resovleLineTextListByStyle(newFRFont, lineTextList, tmpStyle, width, resolution); - - newTextHeight = GraphHelper.getFontMetrics(newFRFont, g2d).getHeight(); - if (newLineTextList.size() * newTextHeight > height) { - newFRFont = newFRFont.applySize(newFRFont.getSize() - 1); - - newLineTextList = resovleLineTextListByStyle(newFRFont, lineTextList, tmpStyle, width, resolution); - - newTextHeight = GraphHelper.getFontMetrics(newFRFont, g2d).getHeight(); - break; - } - } - } - - FRFont returnFont = tmpStyle.getFRFont().applySize(fontScale ? newFRFont.getSize2D() : FRFont.convResolution(newFRFont.getSize2D(), resolution)); - tmpStyle.deriveFRFont(returnFont); - - return new ContentLineGroup(tmpStyle, newLineTextList, newTextHeight); - } - - private static List resovleLineTextListByStyle(Font font, List lineTextList, NewFormStyle tmpStyle, int width, int resolution) { - List newLineTextList = new ArrayList(); - - List tmpLineTextList; - for (int i = 0; i < lineTextList.size(); i++) { - tmpLineTextList = BaseUtils.getLineTextList((String) lineTextList.get(i), tmpStyle, font, width, resolution); - for (int j = 0; j < tmpLineTextList.size(); j++) { - newLineTextList.add((String) tmpLineTextList.get(j)); - } - } - - return newLineTextList; - } - - /** - * 修改格子样式 - * - * @param width 宽 k - * @param height 高g - * @param text 文本w - * @param style 样式y - * @param resolution 转化率z - * @return 样式 y - */ - public static Style modCellStyleString(int width, int height, String text, Style style, int resolution) { - List lineTextList = BaseUtils.getLineTextList(text, style, null, height, width, resolution); - if (style.getTextStyle() == NewFormStyle.TEXTSTYLE_SINGLELINEADJUSTFONT) { - style = singleLineAdjustFont(style, lineTextList, width, height, null, resolution, false).style; - } else if (style.getTextStyle() == NewFormStyle.TEXTSTYLE_MULTILINEADJUSTFONT) { - style = mulitiLineAdjustFont(style, lineTextList, width, height, null, resolution, false).style; - } - - return style; - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/common/PaintUtils.java b/designer-form/src/main/java/com/fr/design/fit/common/PaintUtils.java deleted file mode 100644 index 8f913a7aa..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/common/PaintUtils.java +++ /dev/null @@ -1,835 +0,0 @@ -/* - * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. - */ -package com.fr.design.fit.common; - -import com.fr.base.AutoChangeLineAndDrawManager; -import com.fr.base.BaseFormula; -import com.fr.base.BaseUtils; -import com.fr.base.GraphHelper; -import com.fr.base.ImageProvider; -import com.fr.base.Painter; -import com.fr.base.Style; -import com.fr.base.Utils; -import com.fr.base.background.ColorBackground; -import com.fr.base.chart.BaseChartCollection; -import com.fr.base.chart.result.WebChartIDInfo; -import com.fr.code.BarcodeImpl; -import com.fr.code.bar.BarcodeException; -import com.fr.code.bar.core.BarCodeUtils; -import com.fr.code.bar.core.BarcodeAttr; -import com.fr.data.DataUtils; -import com.fr.data.PresentationType; -import com.fr.data.condition.ListCondition; -import com.fr.file.ResultChangeWhenExport; -import com.fr.form.ui.Widget; -import com.fr.general.Background; -import com.fr.general.ComparatorUtils; -import com.fr.general.FRFont; -import com.fr.general.ImageWithSuffix; -import com.fr.log.FineLoggerFactory; -import com.fr.plugin.ExtraClassManager; -import com.fr.report.cell.CellElement; -import com.fr.report.cell.FloatElement; -import com.fr.report.cell.TemplateCellElement; -import com.fr.report.cell.cellattr.CellExpandAttr; -import com.fr.report.cell.cellattr.CellGUIAttr; -import com.fr.report.cell.cellattr.core.CellUtils; -import com.fr.report.cell.cellattr.core.ResultSubReport; -import com.fr.report.cell.cellattr.core.group.DSColumn; -import com.fr.report.core.Html2ImageUtils; -import com.fr.report.core.ReportUtils; -import com.fr.script.Calculator; -import com.fr.stable.Constants; -import com.fr.stable.CoreConstants; -import com.fr.stable.StringUtils; -import com.fr.stable.bridge.ObjectHolder; -import com.fr.stable.fun.AutoChangeLineAndDrawProcess; -import com.fr.stable.fun.FontProcessor; -import com.fr.stable.html.Tag; -import com.fr.stable.unit.FU; -import com.fr.stable.unit.PT; -import com.fr.stable.unit.UNIT; -import com.fr.stable.web.Repository; - -import javax.swing.ImageIcon; -import java.awt.AlphaComposite; -import java.awt.Color; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.Paint; -import java.awt.Rectangle; -import java.awt.font.TextAttribute; -import java.awt.geom.GeneralPath; -import java.awt.image.BufferedImage; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - -/** - * The util for paint. - */ -public class PaintUtils { - // Add by Denny - public static final int CELL_MARK_SIZE = 6; - public static final Color CELL_HIGHT_LIGHT_MARK_COLOR = new Color(255, 0, 55); - public static final Color CELL_PRESENT_MARK_COLOR = new Color(0, 255, 200); - public static final Color CELL_PAGINATION_MARK_COLOR = new Color(55, 255, 0); - public static final Color CELL_RESULT_MARK_COLOR = new Color(200, 0, 255); - public static final Color CELL_CONDITION_FILTER_MARK_COLOR = new Color(255, 200, 0); - public static final Color CELL_PARAMETER_FILTER_MARK_CONLR = new Color(0, 55, 255); - - public static final Color CELL_DIRECTION_MARK_COLOR = Color.gray; - private static final int UNIT_SIZE = 4; - - //原值是15,矩形线条会缺失,加1px绘制没问题。这地方有水印,但是貌似不是水印影响,未找到线条被挡住的原因 - private static final int WIDGET_WIDTH = 16; - private static final int WIDGET_HEIGHT = 16; - - // Suppresses default constructor, ensuring non-instantiability. - private PaintUtils() { - } - - // font attributes map cache - private static Hashtable fontAttributeMapCache = new Hashtable(); - - /* - * 用于在Grid里面画CellElement的Content + Background - * - * 不画Border,是因为在Grid里面先画所有单元格的Content + Background,再画所有单元格的Border(peter认为这可以提高速度) - */ - public static void paintGridCellContent(Graphics2D g2d, TemplateCellElement cell, int width, int height, int resolution) { - int cell_mark_size = CELL_MARK_SIZE; - // denny_Grid - // 左上角: 条件高亮, 形态 - int leftUpCount = 0; - int rightUpCount = 0; - int leftDownCount = 0; - GraphHelper.applyRenderingHints(g2d); - if (paintHighlightGroupMarkWhenExsit(g2d, cell, leftUpCount)) { - leftUpCount++; - } - if (paintPresentMarkWhenExsit(g2d, cell, leftUpCount)) { - leftUpCount++; - } - if (paintPaginationMarkWhenExsit(g2d, cell, width, rightUpCount)) { - rightUpCount++; - } - paintWidgetMarkWhenExsit(g2d, cell, width, height); - paintExpandMarkWhenExsit(g2d, cell); - Object value = cell.getValue(); - if (value == null) {// 先判断是否是空. - return; - } - if (paintResultMarkWhenExsit(g2d, value, width, rightUpCount)) { - rightUpCount++; - } - - if (paintDSColumnParametermarkWhenExsit(g2d, value, height, leftDownCount)) { - leftDownCount++; - } - - if (paintDSColumnConditionmarkWhenExsit(g2d, value, height, leftDownCount)) { - leftDownCount++; - } - // 画value,但因为是在Grid里面画,所以画Formula.content - if (value instanceof BaseFormula) { - value = ((BaseFormula) value).getContent(); - } - if (value instanceof ImageWithSuffix) { - value = ((ImageWithSuffix) value).getFineImage(); - } - if (value instanceof BaseChartCollection) { - value = ((BaseChartCollection) value).createResultChartPainterWithOutDealFormula(Calculator.createCalculator(), WebChartIDInfo.createEmptyDesignerInfo(), width, height); - } - // Carl:当是子报表时,在格子里画一个子报表的图 - /* - * alex:TODO 此处在Grid里面画ChartCollection和SubReport都只画一个图表,这种做法,很不雅 - */ - if (value instanceof ResultSubReport) { - value = BaseUtils.readImage("/com/fr/base/images/report/painter/subReport.png"); - GraphHelper.paintImage(g2d, width, height, (Image) value, Constants.IMAGE_CENTER, - BaseUtils.getAlignment4Horizontal(cell.getStyle(), value), cell.getStyle().getVerticalAlignment(), - width > 16 ? 16 : width, height > 16 ? 16 : height); - } else { - renderContent(g2d, value, cell.getStyle(), width, height, resolution); - } - } - - - private static void renderContent(Graphics2D g2d, Object value, Style style, int width, int height, int resolution) { - if (value != null && width != 0 && height != 0) { - if (style == null) { - style = Style.DEFAULT_STYLE.deriveImageLayout(1); - } - - if (value instanceof BaseFormula) { - value = ((BaseFormula) value).getResult(); - } - - if (value instanceof Painter) { - ((Painter)value).paint(g2d, width, height, resolution, style); - } else if (value instanceof ImageProvider) { - Style.paintImageContent(g2d, ((ImageProvider) value).getImage(), style, width, height, resolution); - } else if (value instanceof Image) { - Style.paintImageContent(g2d, (Image) value, style, width, height, resolution); - } else { - String var6 = Style.valueToText(value, style.getFormat()); - NewFormStyle.paintCellStyleString2(g2d, width, height, var6, style, resolution); - } - - } - } - - - private static boolean paintHighlightGroupMarkWhenExsit(Graphics2D g2d, TemplateCellElement cell, int left_up_count) { - if (cell.getHighlightGroup() != null && cell.getHighlightGroup().size() > 0) { - Paint oldPaint = g2d.getPaint(); - - g2d.setPaint(CELL_HIGHT_LIGHT_MARK_COLOR); - GeneralPath polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); - polyline.moveTo(0, 0); - polyline.lineTo(0, CELL_MARK_SIZE); - polyline.lineTo(CELL_MARK_SIZE, 0); - GraphHelper.fill(g2d, polyline); - - g2d.setPaint(oldPaint); - return true; - } - return false; - } - - private static boolean paintPresentMarkWhenExsit(Graphics2D g2d, TemplateCellElement cell, int left_up_count) { - if (cell.getPresent() != null) { - Paint oldPaint = g2d.getPaint(); - - g2d.setPaint(CELL_PRESENT_MARK_COLOR); - GeneralPath polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); - polyline.moveTo(0 + left_up_count * CELL_MARK_SIZE, 0); - polyline.lineTo(0 + left_up_count * CELL_MARK_SIZE, 6); - polyline.lineTo(CELL_MARK_SIZE + left_up_count * CELL_MARK_SIZE, 0); - GraphHelper.fill(g2d, polyline); - - g2d.setPaint(oldPaint); - return true; - } - return false; - } - - private static boolean paintPaginationMarkWhenExsit(Graphics2D g2d, TemplateCellElement cell, int width, int ringt_up_count) { - // 右上角: 标记是否有分页 - if (isRightTopMarker(cell)) { - Paint oldPaint = g2d.getPaint(); - - g2d.setPaint(CELL_PAGINATION_MARK_COLOR); - GeneralPath polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); - polyline.moveTo(width - 1 - ringt_up_count * CELL_MARK_SIZE, 0); - polyline.lineTo(width - 1 - ringt_up_count * CELL_MARK_SIZE, CELL_MARK_SIZE); - polyline.lineTo(width - 1 - (ringt_up_count + 1) * CELL_MARK_SIZE, 0); - GraphHelper.fill(g2d, polyline); - - g2d.setPaint(oldPaint); - return true; - } - return false; - } - - private static boolean isRightTopMarker(TemplateCellElement cell) { - return cell.getCellPageAttr() != null && (cell.getCellPageAttr().isPageAfterColumn() - || cell.getCellPageAttr().isPageBeforeColumn() - || cell.getCellPageAttr().isPageAfterRow() - || cell.getCellPageAttr().isPageBeforeRow()); - } - - private static boolean paintResultMarkWhenExsit(Graphics2D g2d, Object value, int width, int ringt_up_count) { - //右上角标记是否自定义显示 - if (value instanceof DSColumn && ((DSColumn) value).getResult() != null) { - if (!ComparatorUtils.equals(((DSColumn) value).getResult(), "$$$")) { - Paint oldPaint = g2d.getPaint(); - - g2d.setPaint(CELL_RESULT_MARK_COLOR); - GeneralPath polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); - polyline.moveTo(width - ringt_up_count * CELL_MARK_SIZE - 1, 0); - polyline.lineTo(width - ringt_up_count * CELL_MARK_SIZE - 1, CELL_MARK_SIZE); - polyline.lineTo(width - (ringt_up_count + 1) * CELL_MARK_SIZE - 1, 0); - GraphHelper.fill(g2d, polyline); - - g2d.setPaint(oldPaint); - return true; - } - } - - return false; - } - - private static void paintWidgetMarkWhenExsit(Graphics2D g2d, TemplateCellElement cell, int width, int height) { - // 右下角:是否填报, 设置为4时,三角太小了,不知何故,设置为6 - if (cell.getWidget() != null) { - Widget widget = cell.getWidget(); - Image img = ((ImageIcon) ReportUtils.createWidgetIcon(widget.getClass())).getImage(); - g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.67f)); - g2d.drawImage(img, width - 15, height - 15, WIDGET_WIDTH, WIDGET_HEIGHT, null); - g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); - } - } - - private static void paintExpandMarkWhenExsit(Graphics2D g2d, TemplateCellElement cell) { - CellExpandAttr cellExpandAttr = cell.getCellExpandAttr(); - if (cellExpandAttr != null) { - if (cellExpandAttr.getDirection() == Constants.TOP_TO_BOTTOM) { - Paint oldPaint = g2d.getPaint(); - g2d.setPaint(CELL_DIRECTION_MARK_COLOR); - GraphHelper.drawLine(g2d, 2, 0, 2, 5); - GraphHelper.drawLine(g2d, 2, 5, 0, 2); - GraphHelper.drawLine(g2d, 2, 5, 4, 2); - g2d.setPaint(oldPaint); - } else if (cellExpandAttr.getDirection() == Constants.LEFT_TO_RIGHT) { - Paint oldPaint = g2d.getPaint(); - g2d.setPaint(CELL_DIRECTION_MARK_COLOR); - GraphHelper.drawLine(g2d, 0, 2, 5, 2); - GraphHelper.drawLine(g2d, 5, 2, 2, 0); - GraphHelper.drawLine(g2d, 5, 2, 2, 4); - g2d.setPaint(oldPaint); - } - } - } - - private static boolean paintDSColumnConditionmarkWhenExsit(Graphics2D g2d, Object value, int height, int left_dowm_count) { - // 左下角:数据列(DSColumn)相关:比如条件过滤 - if (value instanceof DSColumn && ((DSColumn) value).getCondition() != null) { - if (((DSColumn) value).getCondition() instanceof ListCondition && - ((ListCondition) ((DSColumn) value).getCondition()).getJoinConditionCount() == 0) { - // do nothing - } else { - Paint oldPaint = g2d.getPaint(); - - g2d.setPaint(CELL_CONDITION_FILTER_MARK_COLOR); - GeneralPath polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); - polyline.moveTo(0 + left_dowm_count * CELL_MARK_SIZE, height - 1); - polyline.lineTo((left_dowm_count + 1) * CELL_MARK_SIZE + 1, height - 1); - polyline.lineTo(0 + left_dowm_count * CELL_MARK_SIZE, height - 2 - CELL_MARK_SIZE); - GraphHelper.fill(g2d, polyline); - - g2d.setPaint(oldPaint); - return true; - } - } - return false; - } - - private static boolean paintDSColumnParametermarkWhenExsit(Graphics2D g2d, Object value, int height, int left_dowm_count) { - // 左下角:动态注入参数 - if (value instanceof DSColumn && ((DSColumn) value).getParameters() != null) { - if (((DSColumn) value).getParameters().length > 0) { - Paint oldPaint = g2d.getPaint(); - - g2d.setPaint(CELL_PARAMETER_FILTER_MARK_CONLR); - GeneralPath polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); - polyline.moveTo(0 + left_dowm_count * CELL_MARK_SIZE, height - 1); - polyline.lineTo((left_dowm_count + 1) * CELL_MARK_SIZE + 1, height - 1); - polyline.lineTo(0 + left_dowm_count * CELL_MARK_SIZE, height - 2 - CELL_MARK_SIZE); - GraphHelper.fill(g2d, polyline); - - g2d.setPaint(oldPaint); - return true; - } - } - return false; - } - - /* - * 画悬浮元素 - * - * 仅根据宽度 + 高度画 - */ - //b:此方法在grid和tohtml的时候都被调用,所以对formula会有冲突,暂时这么改,应该考虑分开的,也可以根据result来判断,但是那么写好像不妥 - public static void paintFloatElement(Graphics2D g2d, FloatElement flotEl, int width, int height, int resolution) { - Style.paintBackground(g2d, flotEl.getStyle(), width, height); - - Object value = flotEl.getValue(); - if (value instanceof BaseFormula) { - value = ((BaseFormula) value).getContent(); - } - if (value instanceof BaseChartCollection) { - value = ((BaseChartCollection) value).createResultChartPainterWithOutDealFormula(Calculator.createCalculator(), WebChartIDInfo.createEmptyDesignerInfo(), width, height); - } - //图片需要切割一下 - if (value instanceof Image) { - value = CellUtils.value2ImageWithBackground(value, resolution, flotEl.getStyle(), width, height); - } - Style.paintContent(g2d, value, flotEl.getStyle(), width, height, resolution); - - Style.paintBorder(g2d, flotEl.getStyle(), width, height); - } - - /* - * 画悬浮元素flotEl - * - * 也就是画三个东西:背景 + 内容 + 边框 - */ - public static void paintFloatElement(Graphics2D g2d, FloatElement flotEl, Rectangle paintRectangle, Rectangle clipRectangle, int resolution) { - // 画悬浮元素的背景 - Style.paintBackground(g2d, flotEl.getStyle(), paintRectangle, clipRectangle); - - Object value = flotEl.getValue(); - if (value instanceof ResultChangeWhenExport) { - value = ((ResultChangeWhenExport) value).changeThis(); - } - // 画悬浮元素的内容 - Style.paintContent(g2d, value, resolution, flotEl.getStyle(), paintRectangle, clipRectangle); - // 画悬浮元素的边框 - Style.paintBorder(g2d, flotEl.getStyle(), paintRectangle, clipRectangle); - } - - public static void paintHTMLContent(Graphics2D g2d, String value, int resolution, Style style, Rectangle paintRectangle, Rectangle clipRectangle) { - Style.paintContent(g2d, createHTMLContentBufferedImage(value, paintRectangle, 0, 0, style), resolution, style, paintRectangle, clipRectangle); - } - - public static void paintTag(Painter painter, Repository repo, int width, int height, Style style, Tag tag) { - painter.paintTag(repo, width, height, style, tag); - } - - /** - * 如果用户希望以HTML方式展示String,这个时候先value变成图片 - * - * @param value 值 - * @param paintRectangle 绘制范围 - * @param x x坐标 - * @param y y坐标 - * @param style 当前格子样式 - * @return BufferedImage 返回图片. - */ - public static BufferedImage createHTMLContentBufferedImage(String value, Rectangle paintRectangle, int x, int y, Style style) { - return Html2ImageUtils.createHTMLContentBufferedImage(value, paintRectangle, x, y, style); - } - - /** - * see BaseUtils.getLineTextList, 等于BaseUtils.getLineTextList().size() - * Denny: 为了提高速度和性能,才单独拿出来的 - * TODO: 重构 - * - * @param text 文本 - * @param style 样式 - * @param paintWidth 单元格宽度 - * @return paintWidth 单位为PT - */ - public static int getLineTextCount(String text, Style style, UNIT paintWidth) { - if (style.getRotation() != 0) { - return 1; - } - - - if (style.getTextStyle() != Style.TEXTSTYLE_WRAPTEXT) { - return dealNotWrapTextCount(text.toCharArray()); - } else {// 自动换行 - return dealWrapTextCount(text, style, paintWidth); - } - } - - private static int dealNotWrapTextCount(char[] text_chars) { - boolean remain_chars = false; - int count = 0; - for (int t = 0; t < text_chars.length; t++) { - if (text_chars[t] == '\\') {// 判断是否是 "\n" - if (t + 1 < text_chars.length && text_chars[t + 1] == 'n') { - // 是"\n"字符串,但不是换行符. - t++; - count++; - if (remain_chars) { - remain_chars = false; - } - } else { - if (!remain_chars) { - remain_chars = true; - } - } - } else if (text_chars[t] == '\n' || (text_chars[t] == '\r' && t + 1 < text_chars.length - 1 && text_chars[t + 1] != '\n')) { - count++; - if (remain_chars) { - remain_chars = false; - } - } else { - if (!remain_chars) { - remain_chars = true; - } - } - } - - // 最后一个 - if (remain_chars) { - count++; - } - - return count; - } - - // 自动换行 - //neil:style里面, 默认值padding right = 2时, 默认不生效, 这边算行高时也不要计算入内 - //临时处理, 去掉左边框线, 因为浏览器计算时需要考虑左边框线宽度, 但这边还是存在问题的 - //同样需要考虑的是导出和web端展示, padding计算方式也不一致. - private static int dealWrapTextCount(String text, Style style, UNIT unitWidth) { - AutoChangeLineAndDrawProcess process = AutoChangeLineAndDrawManager.getProcess(); - if (process != null) { - return process.getAutoChangeLineCount(text, new ObjectHolder(style), unitWidth); - } - int count = 0; - char[] text_chars = text.toCharArray(); - FontMetrics fontMetrics = getFontMetrics(style); - double paintWidth = unitWidth.toPixD(Constants.FR_PAINT_RESOLUTION); - double width = paintWidth - style.getPaddingLeft() - (style.getPaddingRight() == Style.DEFAULT_PADDING ? 0 : style.getPaddingRight()) - style.getBorderLeftWidth(); - boolean remain_lineText = false; - int lineTextWidth = 0; - int wordWidth = 0; - for (int t = 0, len = text_chars.length; t < len; t++) { - if (t != 0 && BaseUtils.isNumOrLetter(text_chars[t]) && BaseUtils.isNumOrLetter(text_chars[t - 1])) { - if (wordWidth + fontMetrics.charWidth(text_chars[t]) > width) { - if (lineTextWidth > 0) { - count++; - remain_lineText = false; - lineTextWidth = 0; - } - count++; - wordWidth = 0; - } - wordWidth += fontMetrics.charWidth(text_chars[t]); - } else if (isSwitchLine(text_chars, t) || isLN(text_chars, t)) {// 判断是否是 "\n" - if (isLN(text_chars, t)) { - t++;// 忽略'n'字符.// 是"\n"字符串,但不是换行符,依然需要换行. - } - if (lineTextWidth + wordWidth > width && remain_lineText) { - count += 2; - } else { - count++; - } - remain_lineText = false; - lineTextWidth = 0; - wordWidth = 0; - } else { - if (text_chars[t] == '\\' && t + 1 < text_chars.length && text_chars[t + 1] == '\\') {// 判断是否是转义字符'\' - t++;// _denny: 增加了转义字符'\\'用来表示\,使"\n"可以输入 - } - if (lineTextWidth + wordWidth > width && remain_lineText) { - count++; - lineTextWidth = isPunctuationAtLineHead(t, text_chars) ? dealLineWidthWithPunctuation(t, text_chars, fontMetrics) : 0; - } - remain_lineText = true; - lineTextWidth += wordWidth; - wordWidth = fontMetrics.charWidth(text_chars[t]); - } - } - if (lineTextWidth + wordWidth > width && remain_lineText) { - count += 2; - } else { - count++; - } - return count; - } - - /** - * 标点符号是否在换行后的行首 - */ - private static boolean isPunctuationAtLineHead(int t, char[] text_chars) { - if (t > 1 && BaseUtils.isPunctuation(text_chars[t - 1])) { - return true; - } - return false; - } - - /** - * 防止有连续多个标点符号,要找一个非标点符号字符 - * - * @date 2014-4-17 - */ - private static int dealLineWidthWithPunctuation(int t, char[] text_chars, FontMetrics fontMetrics) { - if (t < 2) { - return 0; - } - int lineWidth = 0; - for (int index = t - 2; index >= 0; index--) { - lineWidth += fontMetrics.charWidth(text_chars[index]); - if (!BaseUtils.isPunctuation(text_chars[index])) { - break; - } - } - return lineWidth; - } - - private static boolean isSwitchLine(char[] text_chars, int t) { - return text_chars[t] == '\n' || (text_chars[t] == '\r' && t + 1 < text_chars.length - 1 && text_chars[t + 1] != '\n'); - } - - private static boolean isLN(char[] text_chars, int t) { - return text_chars[t] == '\\' && t + 1 < text_chars.length && text_chars[t + 1] == 'n'; - } - - /** - * Gets the preferred width. - */ - public static UNIT getPreferredWidth(CellElement cell, UNIT height) { - if (cell == null) { - return UNIT.ZERO; - } - - Object value = cell.getShowValue(); - // 只接受Text,Number,和SeparatorPainter - // got the text - if (value instanceof BaseFormula) { - if (((BaseFormula) value).getResult() != null) { - value = ((BaseFormula) value).getResult(); - } else { - value = StringUtils.EMPTY; - } - } - Style style = cell.getStyle(); - if (style == null) { - style = Style.DEFAULT_STYLE; - } - CellGUIAttr cg = cell.getCellGUIAttr() == null ? new CellGUIAttr() : cell.getCellGUIAttr(); - value = Utils.resolveOtherValue(value, cg.isShowAsImage(), PresentationType.EXPORT); - String text = Style.valueToText(value, style.getFormat()); - - FontMetrics cellFM = getFontMetrics(style); - //bug 12151 有边框线的单元格 自动调整列宽 会多一行 - UNIT padding = new PT(style.getPaddingLeft() + style.getPaddingRight()); - - if (cg.isShowAsHTML()) { - return Html2ImageUtils.getHtmlWidth(text, height, style); - } - - return FU.valueOfPix(cellFM.stringWidth(text) + UNIT_SIZE, Constants.FR_PAINT_RESOLUTION).add(padding); - } - - private static FontMetrics getFontMetrics(Style style) { - Font font = style.getFRFont().applyResolutionNP(Constants.FR_PAINT_RESOLUTION); - FontProcessor processor = ExtraClassManager.getInstance().getSingle(FontProcessor.MARK_STRING); - if (processor != null) { - font = processor.readExtraFont(font); - } - return GraphHelper.getFontMetrics(font); - } - - /** - * Preferred height. (Got the shrink preferred height of CellElement). - * 单位格的预计算高度 - * - * @param cellElement 单元格内容 - * @param paintWidth 画的宽度 - * @return UNIT 单位 - */ - public static UNIT analyzeCellElementPreferredHeight(CellElement cellElement, UNIT paintWidth) { - // 计算高度用显示值 - Object value = cellElement.getShowValue(); - // 只接受Text,Number,和SeparatorPainter - Style style = cellElement.getStyle(); - // got the text - if (value instanceof BaseFormula) { - if (((BaseFormula) value).getResult() != null) { - value = ((BaseFormula) value).getResult(); - } else { - value = StringUtils.EMPTY; - } - } - CellGUIAttr cg = cellElement.getCellGUIAttr() == null ? new CellGUIAttr() : cellElement.getCellGUIAttr(); - if (!(value instanceof String) && !(value instanceof Integer)) { - value = DataUtils.resolveOtherValue(value, cg.isShowAsImage(), cg.isShowAsDownload(), null, true); - } - String text = Style.valueToText(value, style.getFormat()); - - if (cg.isShowAsHTML()) { - return Html2ImageUtils.getHtmlHeight(text, paintWidth, style); - } - - return PaintUtils.analyzeCellElementPreferredHeight(text, style, paintWidth, cg.isShowAsHTML()); - } - - /** - * 单位格的预计算高度 - * 单位PT - * - * @param text 文本 - * @param style 格式 - * @param paintWidth 画的宽度 - * @param isShowAsHtml 是否以html展示 - * @return 返回 单位 - */ - private static UNIT analyzeCellElementPreferredHeight(String text, Style style, UNIT paintWidth, boolean isShowAsHtml) { - if (style == null) { - //peter:获取默认的Style. - style = Style.DEFAULT_STYLE; - } - - // got the text - if (text == null || text.length() <= 0) { - return PT.valueOf(0); - } - - // 变成Line Text List. - if (style.getRotation() != 0) { // more easy to paint. - // attribute map. - return PT.valueOf((float) GraphHelper.stringDimensionWithRotation(text, style.getFRFont(), -style.getRotation(), - CoreConstants.DEFAULT_FRC).getHeight()); - } - // 先获得FontMetics. - int lineCount = getLineTextCount(text, style, paintWidth); - AutoChangeLineAndDrawProcess process = AutoChangeLineAndDrawManager.getProcess(); - if (process != null) { - //算了这两个接口分开做 - return process.getLinedTextHeight(lineCount, new ObjectHolder(style)); - } - - // carl:和paint那边一致,添上段前段后和行间距 - PT lineSpacing = PT.valueOf(style.getSpacingAfter() + style.getSpacingBefore() + style.getLineSpacing() * lineCount); - FontMetrics fontMetrics = getFontMetrics(style); - int textHeight = fontMetrics.getHeight(); - FU allTextHeight = FU.valueOfPix(textHeight * lineCount, Constants.FR_PAINT_RESOLUTION); - return lineSpacing.add(allTextHeight);// 需要给底部添加Leading. - } - - /** - * 截取文字,只考虑了垂直方向,水平方向没意义且难度大. - * - * @param value 画的值 - * @param style 字体样式格式. - * @param blockArea 冻结的范围 - * @param resolution 分辨率 - * @return 返回的字符串 - */ - public static String clipBlockValue(Object value, Style style, Rectangle primitiveArea, Rectangle blockArea, int resolution, boolean isShowAsHTML) { - if (value == null) { - return null; - } - if (value instanceof BaseFormula) { - value = ((BaseFormula) value).getResult(); - } - if (blockArea.y >= primitiveArea.height || blockArea.y + blockArea.height <= 0) { - return null; - } - //截取位置,相对于clipArea - int startY = blockArea.y > 0 ? blockArea.y : 0; - int endY = blockArea.y + blockArea.height < primitiveArea.height ? blockArea.y + blockArea.height : primitiveArea.height; - if (blockArea.x >= primitiveArea.width || blockArea.x + blockArea.width <= 0) { - return null; - } - if (isShowAsHTML) { - return Html2ImageUtils.clipHtmlContent(value, style, primitiveArea, resolution, startY, endY); - } - List lineList = BaseUtils.getLineTextList((String) value, style, style.getFRFont().applyResolutionNP(resolution), primitiveArea.width, resolution); - if (lineList.isEmpty()) { - return null; - } - double spacingBefore = PT.pt2pix(style.getSpacingBefore(), resolution); - double spacingAfter = PT.pt2pix(style.getSpacingAfter(), resolution); - double lineSpacing = PT.pt2pix(style.getLineSpacing(), resolution); - double lineHeight = lineSpacing + GraphHelper.getFontMetrics(style.getFRFont().applyResolutionNP(resolution)).getHeight(); - int textAllHeight = (int) (lineHeight * lineList.size() + spacingBefore + spacingAfter); - //第一行文字距区域高度 - int textStartY = (int) spacingBefore; - - if (style.getVerticalAlignment() == Constants.BOTTOM) { - textStartY += (primitiveArea.height - textAllHeight); - } - if (endY <= textStartY || startY >= textStartY + lineHeight * lineList.size()) { - return null; - } - int lineStart = getLineStart(lineList, lineHeight, textStartY, startY);//截取区域起始行 - int lineEnd = getLineEnd(lineList, lineHeight, endY, textStartY);//截取区域结束行 - String text = ""; - for (; lineStart <= lineEnd; lineStart++) { - text += lineList.get(lineStart); - } - return text; - } - - private static int getLineStart(List lineList, double lineHeight, int textStartY, int startY) { - int lineStart = 0; - for (int i = 0; i < lineList.size(); i++) { - if (textStartY + lineHeight * (i) <= startY && textStartY + lineHeight * (i + 1) > startY) {//压线 - if (startY - textStartY - lineHeight * (i) > lineHeight / 2) { - lineStart = i + 1; - } else { - lineStart = i; - } - } - } - return lineStart; - } - - private static int getLineEnd(List lineList, double lineHeight, int endY, int textStartY) { - int lineEnd = lineList.size() - 1; - for (int i = 0; i < lineList.size(); i++) { - if (textStartY + lineHeight * (i) < endY && textStartY + lineHeight * (i + 1) >= endY) {//压线 - //neil:仿宋,12号字, 行间距8为例, 转为px的行间距大小为10.666, 这边算出的应该有31.98行, 因此要进位 - if (endY - textStartY - lineHeight * (i) >= lineHeight / 2) { - lineEnd = i; - } else { - lineEnd = i - 1; - } - } - } - return lineEnd; - } - - /** - * paintBarcode - */ - public static void paintBarcode(Graphics2D g2d, int width, int height, String text, Style style, BarcodeAttr barcodeAttr) { - BarcodeImpl barcodeImpl; - try { - barcodeImpl = BarCodeUtils.getBarcodeImpl(barcodeAttr, text); - } catch (BarcodeException exp) { - try { - //设置默认值. - barcodeImpl = BarCodeUtils.getBarcodeImpl(new BarcodeAttr(), null); - } catch (BarcodeException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - return; - } - } - - //字体 - if (style.getFRFont() != null) { - barcodeImpl.setFont(style.getFRFont()); - barcodeImpl.setForeground(style.getFRFont().getForeground()); - } - //背景 - Background background = style.getBackground(); - if (background != null && background instanceof ColorBackground) { - barcodeImpl.setBackground(((ColorBackground) background).getColor()); - } - - //根据宽度和高度来确定起始点 - int pointX = (width - barcodeImpl.getWidth()) / 2; - int pointY = (height - barcodeImpl.getHeight()) / 2; - - barcodeImpl.draw(g2d, pointX, pointY); - } - - /** - * create font attribute map, 创建属性map - * - * @param font 字体 - * @return map 返回字体创建的Map - */ - public static Map createFontAttributeMap(Font font) { - Map returnFontAttributeMap = (Map) fontAttributeMapCache.get(font); - if (returnFontAttributeMap == null) {// create - // returnFontAttributeMap. - returnFontAttributeMap = font.getAttributes(); - fontAttributeMapCache.put(font, returnFontAttributeMap); - } - - if (font instanceof FRFont) { - FRFont frFont = (FRFont) font; - - // Strikethrough - if (frFont.isStrikethrough()) { - returnFontAttributeMap.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON); - } - } - - return returnFontAttributeMap; - } - -} diff --git a/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java b/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java deleted file mode 100644 index c760d01da..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java +++ /dev/null @@ -1,214 +0,0 @@ -package com.fr.design.fit.common; - -import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWAbsoluteBodyLayout; -import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.file.MutilTempalteTabPane; -import com.fr.design.fit.DesignerUIModeConfig; -import com.fr.design.fit.JFormType; -import com.fr.design.fit.NewJForm; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.FormArea; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.JTemplate; -import com.fr.event.Event; -import com.fr.event.Listener; -import com.fr.file.MemFILE; -import com.fr.file.StashedFILE; -import com.fr.form.fit.common.LightTool; -import com.fr.form.fit.NewFormMarkAttr; -import com.fr.form.ui.Widget; -import com.fr.form.ui.widget.CRBoundsWidget; -import com.fr.general.ComparatorUtils; - -import java.awt.Rectangle; -import java.util.List; - -/** - * @description:模板工具类 - * @author: Henry.Wang - * @create: 2020/09/03 14:19 - */ -public class TemplateTool { - //和转换有关的所有代码都在这个监听器中 - //在判断新老模式时,统一使用FormUIModeConfig.getInstance().newUIMode()进行判断 - private static Listener switchListener = new Listener() { - @Override - public void on(Event event, JTemplate jTemplate) { - JFormType currentType = JFormType.OLD_TYPE; - if (AdaptiveSwitchUtil.isSwitchJFromIng()) { - currentType = DesignerUIModeConfig.getInstance().newUIMode() ? JFormType.NEW_TYPE : JFormType.OLD_TYPE; - } else { - if (jTemplate instanceof NewJForm) { - NewJForm newJForm = (NewJForm) jTemplate; - if (newJForm.mobileForm()) { - currentType = JFormType.OLD_TYPE; - } else if (LightTool.containNewFormFlag(newJForm.getTarget()) || newJForm.getTarget().getTemplateID() == null) { - currentType = JFormType.NEW_TYPE; - } - } - } - //UI转换 - currentType.switchUIMode(); - //标志位转换 - currentType.updateJFromTemplateType(jTemplate); - //预览方式转换 - currentType.updatePreviewType(jTemplate); - } - }; - - public static Listener getSwitchListener() { - return switchListener; - } - - /** - * @param - * @Description: 获取当前模板 - * @return: - * @Author: Henry.Wang - * @date: 2020/9/6 14:17 - */ - public static JTemplate getCurrentEditingTemplate() { - JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - return jTemplate; - } - - /** - * @param - * @Description: 获取当前NewJForm类型的模板 - * @return: - * @Author: Henry.Wang - * @date: 2020/9/6 14:17 - */ - public static NewJForm getCurrentEditingNewJForm() { - JTemplate jTemplate = getCurrentEditingTemplate(); - if (jTemplate instanceof NewJForm) - return (NewJForm) jTemplate; - return null; - } - - /** - * @param newJTemplate - * @Description: 每次切换设计模式,都会生成新的JForm对象。但是TabPane关联的还是老的JForm对象,所以要重置关联的对象 - * @return: - * @Author: Henry.Wang - * @date: 2020/9/6 14:15 - */ - public static void resetTabPaneEditingTemplate(JTemplate newJTemplate) { - if (newJTemplate == null) - return; - List> jTemplateList = HistoryTemplateListCache.getInstance().getHistoryList(); - for (int i = 0; i < jTemplateList.size(); i++) { - JTemplate oldJTemplate = jTemplateList.get(i); - if (oldJTemplate != null && ComparatorUtils.equals(oldJTemplate.getEditingFILE(), newJTemplate.getEditingFILE())) { - jTemplateList.set(i, newJTemplate); - MutilTempalteTabPane.getInstance().refreshOpenedTemplate(jTemplateList); - return; - } - } - } - - - /** - * @param jTemplate - * @Description: 是否是新建的且没有操作的模板 - * @return: - * @Author: Henry.Wang - * @date: 2020/9/14 20:41 - */ - public static boolean isNewTemplateWithoutModify(JTemplate jTemplate) { - return ((jTemplate.getEditingFILE() instanceof MemFILE) && jTemplate.isSaved()) ? true : false; - } - - /** - * @param template - * @Description: 激活模板 - * @return: - * @Author: Henry.Wang - * @date: 2020/9/6 14:16 - */ - public static void activeAndResizeTemplate(JTemplate template) { - DesignerContext.getDesignerFrame().addAndActivateJTemplate(template); - DesignerContext.getDesignerFrame().setVisible(true); - DesignerContext.getDesignerFrame().resizeFrame(); - } - - /** - * @param jTemplate - * @Description:保存模板 - * @return: - * @Author: Henry.Wang - * @date: 2020/9/6 14:32 - */ - public static void saveForm(JTemplate jTemplate) { - //为空不保存 - if (jTemplate == null) - return; - //不是NewJForm的模板不保存 - if (!(jTemplate instanceof NewJForm)) - return; - //切换环境时产生的模板不保存 - if (jTemplate.getEditingFILE() instanceof StashedFILE) - return; - //新建的且没有操作的模板不保存 - if (TemplateTool.isNewTemplateWithoutModify(jTemplate)) - return; - jTemplate.stopEditing(); - jTemplate.saveTemplate(); - jTemplate.requestFocus(); - } - - /** - * @param height - * @param width - * @param newJForm - * @Description: 只改变绝对布局body的尺寸 - * @return: - * @Author: Henry.Wang - * @date: 2020/9/11 15:14 - */ - public static void onlyChangeAbsoluteBodySize(int height, int width, NewJForm newJForm) { - FormDesigner formDesigner = newJForm.getFormDesign(); - FormArea formArea = formDesigner.getArea(); - XLayoutContainer root = formDesigner.getRootComponent(); - XWAbsoluteBodyLayout xwAbsoluteBodyLayout = LayoutTool.getXWAbsoluteBodyLayout(newJForm); - if (root.acceptType(XWFitLayout.class) && xwAbsoluteBodyLayout != null) { - XWFitLayout layout = (XWFitLayout) root; - if (height == layout.toData().getContainerHeight() && width == layout.toData().getContainerWidth()) - return; - formArea.setWidthPaneValue(width); - formArea.setHeightPaneValue(height); - layout.setSize(width, height); - xwAbsoluteBodyLayout.setSize(width, height); - Widget widget = layout.toData().getWidget(0); - if (widget instanceof CRBoundsWidget) { - ((CRBoundsWidget) widget).setBounds(new Rectangle(0, 0, width, height)); - } - layout.toData().setContainerWidth(width); - layout.toData().setContainerHeight(height); - formArea.doReCalculateRoot(width, height, layout); - } - formDesigner.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); - } - - /** - * @param newJForm - * @Description: 因为新老模板切换有截断的问题,所以body的尺寸会在调用onlyChangeAbsoluteBodySize之后发生改变。为了使模板文件中的尺寸不发生,要在模板保存时调用此函数 - * @return: - * @Author: Henry.Wang - * @date: 2020/9/11 15:20 - */ - public static void resetAbsoluteBodySize(NewJForm newJForm) { - if (LayoutTool.absoluteLayoutForm(newJForm)) { - NewFormMarkAttr newFormMarkAttr = newJForm.getTarget().getAttrMark(NewFormMarkAttr.XML_TAG); - XLayoutContainer root = newJForm.getFormDesign().getRootComponent(); - if (newFormMarkAttr != null && root instanceof XWFitLayout) { - ((XWFitLayout) root).toData().setContainerWidth(newFormMarkAttr.getBodyWidth()); - ((XWFitLayout) root).toData().setContainerHeight(newFormMarkAttr.getBodyHeight()); - } - } - } - -} diff --git a/designer-form/src/main/java/com/fr/design/fit/menupane/BrowserFitAttrPane.java b/designer-form/src/main/java/com/fr/design/fit/menupane/BrowserFitAttrPane.java deleted file mode 100644 index fdc2f8332..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/menupane/BrowserFitAttrPane.java +++ /dev/null @@ -1,303 +0,0 @@ -package com.fr.design.fit.menupane; - -import com.fr.config.Configuration; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.fit.FitStateCompatible; -import com.fr.design.fit.JFormType; -import com.fr.form.fit.FitType; -import com.fr.form.fit.config.FormFitConfig; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIRadioButton; -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.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.report.fit.ReportFitAttr; -import com.fr.stable.StringUtils; -import com.fr.transaction.Configurations; -import com.fr.transaction.Worker; - -import javax.swing.BorderFactory; -import javax.swing.ButtonGroup; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Cursor; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; - -/** - * Created by Administrator on 2016/5/5/0005. - */ -public class BrowserFitAttrPane extends BasicBeanPane { - - protected FontRadioGroup fontRadioGroup; - protected FitRadioGroup fitRadionGroup; - protected UICheckBox globalCheck; - protected FitPreviewPane fitPreviewPane; - protected ReportFitAttr localFitAttr; - protected UIRadioButton horizonRadio; - protected UIRadioButton doubleRadio; - protected UIRadioButton notFitRadio; - protected UIRadioButton fontFitRadio; - protected UIRadioButton fontNotFitRadio; - private UIButton editGlobalOps; - private JPanel borderPane; - private JPanel globalOpsPane; - private JPanel fitOpsPane; - private final JFormType jFormType; - - public BrowserFitAttrPane(JFormType jFormType, ReportFitAttr fitAttr) { - this.jFormType = jFormType; - if (fitAttr == null) { - initComponents(jFormType.obtainFitAttr()); - } else { - initComponents(fitAttr); - } - } - - protected void initComponents(ReportFitAttr globalFitAttr) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - globalOpsPane = initGlobalOpsPane(globalFitAttr); - this.add(globalOpsPane, BorderLayout.NORTH); - fitOpsPane = initFitOpsPane(); - } - - protected void initBorderPane(String title) { - borderPane = FRGUIPaneFactory.createTitledBorderPaneCenter(title); - borderPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 0)); - borderPane.add(fitOpsPane, BorderLayout.WEST); - fitPreviewPane = new FitPreviewPane(); - borderPane.add(fitPreviewPane, BorderLayout.SOUTH); - borderPane.add(getHintUILabel()); - this.add(borderPane, BorderLayout.CENTER); - } - - /** - * @Description: 获取提示信息 - * @param - * @return: - * @Author: Henry.Wang - * @date: 2020/9/9 16:09 - */ - private UILabel getHintUILabel() { - String hint = globalCheck.isSelected() ? getFillBlank(3) + Toolkit.i18nText("Fine-Designer_Fit_Attr_Pane_Hint") : StringUtils.EMPTY; - UILabel hintUILabel = new UILabel(hint); - hintUILabel.setForeground(new Color(143, 143, 146)); - return hintUILabel; - } - - /** - * @Description: 获取空字符串 - * @param n - * @return: - * @Author: Henry.Wang - * @date: 2020/9/9 16:09 - */ - private String getFillBlank(int n) { - String s = ""; - for (int i = 0; i < n; i++) { - s = s + " "; - } - return s; - } - - private JPanel initFitOpsPane() { - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] columnSize = {p, p, p, p, p}; - - ActionListener actionListener = getPreviewActionListener(); - - fontRadioGroup = new FontRadioGroup(); - fontFitRadio = new UIRadioButton(Toolkit.i18nText("Fine-Designer_Fit") + getFillBlank(4)); - fontFitRadio.setSelected(true); - fontNotFitRadio = new UIRadioButton(Toolkit.i18nText("Fine-Designer_Fit-No") + getFillBlank(2)); - addRadioToGroup(fontRadioGroup, fontFitRadio, fontNotFitRadio); - fontRadioGroup.addActionListener(actionListener); - - fitRadionGroup = new FitRadioGroup(); - horizonRadio = new UIRadioButton(FitType.HORIZONTAL_FIT.description()); - doubleRadio = new UIRadioButton(FitType.DOUBLE_FIT.description()); - notFitRadio = new UIRadioButton(FitType.NOT_FIT.description()); - addRadioToGroup(fitRadionGroup, doubleRadio, horizonRadio, notFitRadio); - fitRadionGroup.addActionListener(actionListener); - - - JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(initFitComponents(), rowSize, columnSize); - fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); - return fitOpsPane; - } - - protected Component[][] initFitComponents() { - UILabel fitFontLabel = new UILabel(Toolkit.i18nText("Fine-Designer_Fit-Font")); - fitFontLabel.setHorizontalAlignment(SwingConstants.RIGHT); - UILabel reportFitLabel = new UILabel(Toolkit.i18nText("Fine-Designer_Fit_Report_Scale_Method")); - reportFitLabel.setHorizontalAlignment(SwingConstants.RIGHT); - Component[][] components = new Component[][]{ - new Component[]{fitFontLabel, createFontRadioGroupPane()}, - new Component[]{reportFitLabel, createFitAttrRadioGroupPane()} - }; - return components; - } - - private JPanel createFontRadioGroupPane() { - JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - panel.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0)); - panel.add(fontFitRadio); - panel.add(fontNotFitRadio); - return panel; - } - - private JPanel createFitAttrRadioGroupPane() { - JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - panel.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0)); - panel.add(doubleRadio); - panel.add(horizonRadio); - panel.add(notFitRadio); - return panel; - } - - private void addRadioToGroup(ButtonGroup buttonGroup, UIRadioButton... radios) { - for (UIRadioButton radio : radios) { - buttonGroup.add(radio); - } - } - - private JPanel initGlobalOpsPane(final ReportFitAttr globalFitAttr) { - final JPanel globalOpsPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); - globalCheck = new UICheckBox(Toolkit.i18nText("Fine-Designer_Fit-UseGlobal")); - globalOpsPane.add(globalCheck); - globalCheck.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - boolean isLocalConfig = !globalCheck.isSelected(); - //勾选全局时,采用全局保存的自适应属性更新界面 - if (!isLocalConfig) { - ReportFitAttr attr = globalFitAttr; - populateAttrPane(attr); - remove(BrowserFitAttrPane.this.borderPane); - initBorderPane(Toolkit.i18nText("Fine-Designer_Fit-Global")); - } else { - ReportFitAttr attr = localFitAttr; - populateAttrPane(attr); - remove(BrowserFitAttrPane.this.borderPane); - initBorderPane(Toolkit.i18nText("Fine-Designer_Fit-Local")); - } - fontRadioGroup.setEnabled(isLocalConfig); - fitRadionGroup.setEnabled(isLocalConfig); - editGlobalOps.setVisible(!isLocalConfig); - String fitOptions = getCurrentFitOptions(); - fitPreviewPane.refreshPreview(fitOptions, fitRadionGroup.isEnabled()); - } - }); - - editGlobalOps = new UIButton(Toolkit.i18nText("Fine-Designer_Fit-EditGlobal")); - editGlobalOps.setVisible(false); - editGlobalOps.addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent evt) { - fontRadioGroup.setEnabled(true); - fitRadionGroup.setEnabled(true); - String fitOptions = getCurrentFitOptions(); - - fitPreviewPane.refreshPreview(fitOptions, fitRadionGroup.isEnabled()); - } - - public void mouseEntered(MouseEvent e) { - setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - } - - public void mouseExited(MouseEvent e) { - setCursor(Cursor.getDefaultCursor()); - } - }); - globalOpsPane.add(editGlobalOps); - return globalOpsPane; - } - - @Override - protected String title4PopupWindow() { - return Toolkit.i18nText("Fine-Designer_Fit-AttrSet"); - } - - @Override - public void populateBean(ReportFitAttr attr) { - if (attr == null) { - //如果为空, 就用全局的 - attr = this.jFormType.obtainFitAttr(); - populateGlobalComponents(); - } else { - initBorderPane(Toolkit.i18nText("Fine-Designer_Fit-Local")); - } - this.localFitAttr = attr; - populateAttrPane(attr); - } - - private void populateAttrPane(ReportFitAttr attr) { - fontRadioGroup.selectFontFit((attr).isFitFont()); - int fitState = FitStateCompatible.getNewTypeFromOld(attr.fitStateInPC()); - fitRadionGroup.selectIndexButton(fitState); - fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled()); - } - - protected void populateGlobalComponents() { - globalCheck.setSelected(true); - fontRadioGroup.setEnabled(false); - fitRadionGroup.setEnabled(false); - editGlobalOps.setVisible(true); - initBorderPane(Toolkit.i18nText("Fine-Designer_Fit-Global")); - } - - //有八种组合, 不过有意义的就是6种, 以此为key去缓存里找对应的预览图片 - public String getCurrentFitOptions() { - return fitRadionGroup.getSelectRadioIndex() + "" + fontRadioGroup.getSelectRadioIndex(); - } - - private ActionListener getPreviewActionListener() { - return new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - String fitOptions = getCurrentFitOptions(); - fitPreviewPane.refreshPreview(fitOptions, fontRadioGroup.isEnabled()); - } - }; - } - - @Override - public ReportFitAttr updateBean() { - ReportFitAttr attr = new ReportFitAttr(); - attr.setFitFont(fontRadioGroup.isFontFit()); - int fitState = FitStateCompatible.getOldTypeFromNew(fitRadionGroup.getSelectRadioIndex()); - attr.setFitStateInPC(fitState); - - // 直接用全局的 - if (globalCheck.isSelected()) { - updateGlobalConfig(attr); - return null; - } - this.localFitAttr = attr; - return attr; - } - - private void updateGlobalConfig(final ReportFitAttr attr) { - - Configurations.update(new Worker() { - @Override - public void run() { - jFormType.updateFitAttr(attr); - } - - @Override - public Class[] targets() { - return new Class[]{FormFitConfig.class}; - } - }); - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/menupane/FitPreviewPane.java b/designer-form/src/main/java/com/fr/design/fit/menupane/FitPreviewPane.java deleted file mode 100644 index ed387f39d..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/menupane/FitPreviewPane.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.fr.design.fit.menupane; - -import com.fr.design.dialog.BasicPane; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.general.IOUtils; - -import javax.swing.ImageIcon; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.util.HashMap; -import java.util.Map; - -/** - * Created by Administrator on 2016/5/5/0005. - */ -public class FitPreviewPane extends BasicPane { - private static final String DEFAULT_FONT_TAG = "00"; - private static final String DEFAULT_TAG = "01"; - private static final String HORIZON_FONT_TAG = "10"; - private static final String HORIZON_TAG = "11"; - private static final String DOUBLE_FONT_TAG = "20"; - private static final String DOUBLE_TAG = "21"; - private static final String NOT_FONT_TAG = "30"; - private static final String NOT_TAG = "31"; - - private UILabel imageLabel; - private Map cachedPreviewImage = new HashMap(); - private Map globalCachedPreviewImage = new HashMap(); - - public FitPreviewPane() { - //初始化缓存图片, 有些无意义的组合. - initCacheImage(); - //初始化组件 - initComponents(); - this.setPreferredSize(new Dimension(540, 170)); - } - - //默认和不自适应时,字体自适应不起效,只有6张图 - private void initCacheImage() { - globalCachedPreviewImage.put(DEFAULT_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + DOUBLE_FONT_TAG + ".png"))); - globalCachedPreviewImage.put(DEFAULT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + DOUBLE_TAG + ".png"))); - globalCachedPreviewImage.put(HORIZON_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + HORIZON_FONT_TAG + ".png"))); - globalCachedPreviewImage.put(HORIZON_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + HORIZON_TAG + ".png"))); - globalCachedPreviewImage.put(DOUBLE_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + NOT_FONT_TAG + ".png"))); - globalCachedPreviewImage.put(DOUBLE_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + NOT_FONT_TAG + ".png"))); - - cachedPreviewImage.put(DEFAULT_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + DOUBLE_FONT_TAG + ".png"))); - cachedPreviewImage.put(DEFAULT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + DOUBLE_TAG + ".png"))); - cachedPreviewImage.put(HORIZON_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + HORIZON_FONT_TAG + ".png"))); - cachedPreviewImage.put(HORIZON_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + HORIZON_TAG + ".png"))); - cachedPreviewImage.put(DOUBLE_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + NOT_FONT_TAG + ".png"))); - cachedPreviewImage.put(DOUBLE_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + NOT_FONT_TAG + ".png"))); - - } - - private void initComponents() { - this.setLayout(FRGUIPaneFactory.createCenterFlowLayout()); - imageLabel = new UILabel(); - ImageIcon image = cachedPreviewImage.get(DEFAULT_TAG); - imageLabel.setIcon(image); - this.add(imageLabel, BorderLayout.CENTER); - } - - public void refreshPreview(String index, boolean isEditedable) { - ImageIcon newImageIcon = isEditedable ? cachedPreviewImage.get(index) : globalCachedPreviewImage.get(index); - imageLabel.setIcon(newImageIcon); - } - - @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Preview"); - } - - -} diff --git a/designer-form/src/main/java/com/fr/design/fit/menupane/FitRadioGroup.java b/designer-form/src/main/java/com/fr/design/fit/menupane/FitRadioGroup.java deleted file mode 100644 index 46fb32768..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/menupane/FitRadioGroup.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.fr.design.fit.menupane; - -import com.fr.design.gui.ibutton.UIRadioButton; - -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; - -/** - * 自适应四个按钮选项的group - *

- * Created by Administrator on 2016/5/5/0005. - */ -public class FitRadioGroup extends ButtonGroup { - - private List radioButtons = new ArrayList(); - - @Override - public void add(AbstractButton button) { - super.add(button); - - UIRadioButton radioButton = (UIRadioButton) button; - radioButtons.add(radioButton); - } - - /** - * 设置按钮状态 - */ - public boolean isEnabled() { - return radioButtons.get(0).isEnabled(); - } - - /** - * 设置按钮状态 - */ - public void setEnabled(boolean enabled) { - for (UIRadioButton radioButton : radioButtons) { - radioButton.setEnabled(enabled); - } - } - - /** - * 获取当前选中的按钮index - * - * @return 按钮index - */ - public int getSelectRadioIndex() { - for (int i = 0, len = radioButtons.size(); i < len; i++) { - if (radioButtons.get(i).isSelected()) { - return i; - } - } - - return 0; - } - - /** - * 选中指定index的按钮 - */ - public void selectIndexButton(int index) { - if (index < 0 || index > radioButtons.size() - 1) { - return; - } - - UIRadioButton button = radioButtons.get(index); - button.setSelected(true); - } - - /** - * 给所有的按钮加上监听 - */ - public void addActionListener(ActionListener actionListener) { - for (UIRadioButton radioButton : radioButtons) { - radioButton.addActionListener(actionListener); - } - } - -} diff --git a/designer-form/src/main/java/com/fr/design/fit/menupane/FontRadioGroup.java b/designer-form/src/main/java/com/fr/design/fit/menupane/FontRadioGroup.java deleted file mode 100644 index 8d26f4074..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/menupane/FontRadioGroup.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.fr.design.fit.menupane; - -/** - * 字体的两个选项组成的group - *


- - - - - - - - - - - - - - - - - - - - - - - - - -tC;K&-B[7`5WK?,Xelf@&8+0+s;]Ad+gFe2#R^R0KRcH9&1(_,Q&m?CF2#j -L2g`#\[sRl3^"LL;I*q<:m`bRtAnUh^m(8[R[\Qdap[PoDZI+D(a6:V.`2I2?>R^Sd'MY!@@k@GfZiTaUt[[X*Qn(Vqi1,QX!S[g -X8cV#:o/U(RN!]A[-MCK!$>RYIs_SOW[_9PE1L2Q+u4)L'*_+9GA>FbhqkF3>rH*rsS)m6q"c>/>qr/Vjd(?R(*:-.oLG%<9eZ1]Al^J"e-:(+>+Q1NPOaSJo+/S+i4n&T% -\/J4IBcE%5,_GkC[%jH'kh$2]A+l)FI""N?9]AXFHef&/Q\Pm:q*oGRR,WLM]A._;-d'aOX+8Xcia>YISk1g?.bi%E?!"e!Dq4AIRE5*J06XZ"l9/,[%5lSYHM*Gsc;De0X(/o,#On+F;om!UF7s$[mR(>_*`AIpT;n1NSp*r -5Md*5kOL1RpseeaT5!G,kk_1&F%\@jJs#W%4nbD$X(dC(\O+&KX.Vp>]AY-LoL^V=LM7!$S/!&hR'nH_0hm_H,f=2p+p`R&".Le>"lHKmKAHnSIm69U'g -LYG,>[,VlJ&!5>PutHqRJ4XG^$7ZL6(YG+-e=+b;LUuH3Zrc58GNFlF?j1-+QXQ(%S6.V?:G -1jf/GeC6q@_Q>S5"##8tiN'(`qU.T7U?<]A'i8Uhe/g^>U%!HX@Al,.N83)TcC)q$'k_OQ-?: -_D-F="?_k3O8O[DbknE3?fn3U+EJ3:q;#XccA+E^R:k_hA7K7g.e*(3U#a[& -%V(jo6,q3)+CL/"I32M"cKPBGLn2M%"r'=faV2lDBHCm%MHBI]AOIZj%Z*1+*FVK8J!g'*3c# -"WMR3*Y&1h_H@PEJC*H;"Y@nbp:f4UB61F[-H4phL"^(VI"gQST8h*)bt+Jo(MXVpo+u.k@X -tpaqkFs9$ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/designer-realize/src/test/resources/cpt/read-write-image-ref.cpt b/designer-realize/src/test/resources/cpt/read-write-image-ref.cpt deleted file mode 100644 index 62797764a..000000000 --- a/designer-realize/src/test/resources/cpt/read-write-image-ref.cpt +++ /dev/null @@ -1,78 +0,0 @@ - - - - -
- - - -
- - - - - - - - - - - - - - - - - - - - -tC;K&-B[7`5WK?,Xelf@&8+0+s;]Ad+gFe2#R^R0KRcH9&1(_,Q&m?CF2#j -L2g`#\[sRl3^"LL;I*q<:m`bRtAnUh^m(8[R[\Qdap[PoDZI+D(a6:V.`2I2?>R^Sd'MY!@@k@GfZiTaUt[[X*Qn(Vqi1,QX!S[g -X8cV#:o/U(RN!]A[-MCK!$>RYIs_SOW[_9PE1L2Q+u4)L'*_+9GA>FbhqkF3>rH*rsS)m6q"c>/>qr/Vjd(?R(*:-.oLG%<9eZ1]Al^J"e-:(+>+Q1NPOaSJo+/S+i4n&T% -\/J4IBcE%5,_GkC[%jH'kh$2]A+l)FI""N?9]AXFHef&/Q\Pm:q*oGRR,WLM]A._;-d'aOX+8Xcia>YISk1g?.bi%E?!"e!Dq4AIRE5*J06XZ"l9/,[%5lSYHM*Gsc;De0X(/o,#On+F;om!UF7s$[mR(>_*`AIpT;n1NSp*r -5Md*5kOL1RpseeaT5!G,kk_1&F%\@jJs#W%4nbD$X(dC(\O+&KX.Vp>]AY-LoL^V=LM7!$S/!&hR'nH_0hm_H,f=2p+p`R&".Le>"lHKmKAHnSIm69U'g -LYG,>[,VlJ&!5>PutHqRJ4XG^$7ZL6(YG+-e=+b;LUuH3Zrc58GNFlF?j1-+QXQ(%S6.V?:G -1jf/GeC6q@_Q>S5"##8tiN'(`qU.T7U?<]A'i8Uhe/g^>U%!HX@Al,.N83)TcC)q$'k_OQ-?: -_D-F="?_k3O8O[DbknE3?fn3U+EJ3:q;#XccA+E^R:k_hA7K7g.e*(3U#a[& -%V(jo6,q3)+CL/"I32M"cKPBGLn2M%"r'=faV2lDBHCm%MHBI]AOIZj%Z*1+*FVK8J!g'*3c# -"WMR3*Y&1h_H@PEJC*H;"Y@nbp:f4UB61F[-H4phL"^(VI"gQST8h*)bt+Jo(MXVpo+u.k@X -tpaqkFs9$ - - - - - - - - - - - - - -
- - - - - - - - - - - -

- * Created by Administrator on 2016/5/5/0005. - */ -public class FontRadioGroup extends FitRadioGroup { - - public void selectFontFit(boolean isFontFit) { - selectIndexButton(isFontFit ? 0 : 1); - } - - public boolean isFontFit() { - return getSelectRadioIndex() == 0; - } -} diff --git a/designer-form/src/main/java/com/fr/design/fit/menupane/FormFitAttrPane.java b/designer-form/src/main/java/com/fr/design/fit/menupane/FormFitAttrPane.java deleted file mode 100644 index be1411264..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/menupane/FormFitAttrPane.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.fr.design.fit.menupane; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.fit.NewJForm; -import com.fr.report.fit.ReportFitAttr; - -import javax.swing.BorderFactory; -import javax.swing.BoxLayout; - -/** - * Created by Administrator on 2015/7/6 0006. - */ -public class FormFitAttrPane extends BasicBeanPane { - - private BrowserFitAttrPane attrPane; - private NewJForm newJForm; - - public FormFitAttrPane(NewJForm newJForm) { - this.newJForm = newJForm; - initComponents(); - } - - private void initComponents() { - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 2, 10)); - attrPane = new BrowserFitAttrPane(this.newJForm.getJFormType(),this.newJForm.getTarget().getReportFitAttr()); - this.add(attrPane); - - } - - /** - * 展示界面 - * - * @param fitAttr 自适应属性 - */ - public void populateBean(ReportFitAttr fitAttr) { - attrPane.populateBean(fitAttr); - } - - /** - * 提交数据 - * - * @return 界面上的更新数据 - */ - public ReportFitAttr updateBean() { - return attrPane.updateBean(); - } - - /** - * 标题 - * - * @return 标题 - */ - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_PC_Adaptive_Attr"); - } - -} diff --git a/designer-form/src/main/java/com/fr/design/fit/toolbar/SwitchAction.java b/designer-form/src/main/java/com/fr/design/fit/toolbar/SwitchAction.java deleted file mode 100644 index e14d39a68..000000000 --- a/designer-form/src/main/java/com/fr/design/fit/toolbar/SwitchAction.java +++ /dev/null @@ -1,287 +0,0 @@ -package com.fr.design.fit.toolbar; - -import com.fr.design.actions.UpdateAction; -import com.fr.design.dialog.FineJOptionPane; -import com.fr.design.file.TemplateTreePane; -import com.fr.design.fit.DesignerUIModeConfig; -import com.fr.design.fit.NewJForm; -import com.fr.design.fit.common.AdaptiveSwitchUtil; -import com.fr.design.fit.common.TemplateTool; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.i18n.Toolkit; -import com.fr.design.mainframe.BaseJForm; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.menu.MenuKeySet; -import com.fr.file.FILE; -import com.fr.file.FILEChooserPane; -import com.fr.file.FileFILE; -import com.fr.file.FileNodeFILE; -import com.fr.file.MemFILE; -import com.fr.file.filetree.FileNode; -import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; - -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.KeyStroke; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Font; -import java.awt.event.ActionEvent; -import java.nio.file.Paths; - -import static javax.swing.JOptionPane.OK_CANCEL_OPTION; -import static javax.swing.JOptionPane.WARNING_MESSAGE; -import static javax.swing.JOptionPane.YES_NO_OPTION; - -/** - * Created by kerry on 2020-06-02 - */ -public class SwitchAction extends UpdateAction { - - private UIButton switchBtn; - private static final Icon SWITCH_ICON = IOUtils.readIcon("/com/fr/design/form/images/icon_switch.png"); - private static final String LOADING_ICON_PATH = "/com/fr/design/form/images/loading.png"; - private static final MenuKeySet SWITCH_ATTR = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'C'; - } - - @Override - public String getMenuName() { - return Toolkit.i18nText("Fine-Designer_Fit_Switch_To_Old_UI"); - } - - @Override - public KeyStroke getKeyStroke() { - return null; - } - }; - - public SwitchAction() { - initMenuStyle(); - } - - private void initMenuStyle() { - this.setMenuKeySet(SWITCH_ATTR); - this.setName(getMenuKeySet().getMenuKeySetName()); - this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(SWITCH_ICON); - this.setAccelerator(getMenuKeySet().getKeyStroke()); - switchBtn = (UIButton) this.createToolBarComponent(); - switchBtn.set4ToolbarButton(); - switchBtn.setIcon(SWITCH_ICON); - Font oldFont = switchBtn.getFont(); - switchBtn.setFont(new Font(oldFont.getName(),oldFont.getStyle(),12)); - switchBtn.setForeground(new Color(0x33, 0x33, 0x34)); - freshSwitchButton(); - } - - @Override - public void actionPerformed(ActionEvent e) { - //如果此时模板还在切换中,则直接返回 - if (AdaptiveSwitchUtil.isSwitchJFromIng() || !saveCurrentEditingTemplate()) - return; - backToFormTab(); - if (confirmSwitchDialog() && backUpOldModeJTemplate()) { - AdaptiveSwitchUtil.setSwitchJFromIng(1); - showLoadingJPanel(); - if (DesignerUIModeConfig.getInstance().newUIMode()) { - AdaptiveSwitchUtil.switch2OldUI(); - } else { - AdaptiveSwitchUtil.switch2NewUI(); - } - } - } - - /** - * @Description: 对未存储在磁盘的模板进行界面切换 - * @return: - * @Author: Henry.Wang - * @date: 2020/10/22 17:26 - */ - public boolean saveCurrentEditingTemplate() { - JTemplate jTemplate = TemplateTool.getCurrentEditingTemplate(); - if (!(jTemplate.getEditingFILE() instanceof FileNodeFILE) || !jTemplate.getEditingFILE().exists()) { - int returnVal = FineJOptionPane.showConfirmDialog( - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), - Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), - OK_CANCEL_OPTION, - WARNING_MESSAGE); - if (returnVal == JOptionPane.YES_OPTION) { - jTemplate.stopEditing(); - if ((jTemplate.getEditingFILE() instanceof MemFILE) || !jTemplate.getEditingFILE().exists()) { - return jTemplate.saveTemplate(); - } else if (jTemplate.getEditingFILE() instanceof FileFILE) { - return jTemplate.saveAsTemplate2Env(); - } - } - return false; - } - return true; - } - - /** - * @Description: 显示加载中界面 - * @param - * @return: - * @Author: Henry.Wang - * @date: 2020/9/30 15:18 - */ - public void showLoadingJPanel() { - JComponent area = TemplateTool.getCurrentEditingNewJForm().getFormDesign().getArea(); - JComponent formDesigner = TemplateTool.getCurrentEditingNewJForm().getFormDesign(); - area.remove(formDesigner); - - JPanel loadingJPanel = new JPanel(new BorderLayout()); - loadingJPanel.setBackground(Color.WHITE); - loadingJPanel.setBounds(formDesigner.getBounds()); - JLabel jLabel = new JLabel(new ImageIcon(this.getClass().getResource(LOADING_ICON_PATH)), JLabel.CENTER); - loadingJPanel.add(jLabel, BorderLayout.CENTER); - - area.setLayout(null); - area.add(loadingJPanel); - DesignerContext.getDesignerFrame().setVisible(true); - } - - - /** - * @Description: 如果是在报表块编辑状态进行切换时,会先回到表单页 - * @param - * @return: - * @Author: Henry.Wang - * @date: 2020/9/30 15:20 - */ - private void backToFormTab() { - NewJForm newJForm = TemplateTool.getCurrentEditingNewJForm(); - if (newJForm != null && newJForm.getEditingReportIndex() != BaseJForm.FORM_TAB) { - newJForm.tabChanged(BaseJForm.FORM_TAB); - } - } - - /** - * @param - * @Description: 备份老设计模式下的模板文件 - * @return: - * @Author: Henry.Wang - * @date: 2020/9/23 16:24 - */ - private boolean backUpOldModeJTemplate() { - JTemplate jTemplate = TemplateTool.getCurrentEditingTemplate(); - if (jTemplate != null && !DesignerUIModeConfig.getInstance().newUIMode()) { - FILE editingFILE = jTemplate.getEditingFILE(); - if (editingFILE != null && editingFILE.exists()) { - try { - //待备份的文件名称 - String fileName = editingFILE.getName().substring(0, editingFILE.getName().length() - jTemplate.suffix().length()) + "_bak"; - //生成要备份的文件对象 - FILE backUpFile = null; - FileNodeFILE directory = getFileParentDirectory(jTemplate.getEditingFILE()); - if (directory != null) - backUpFile = new FileNodeFILE(directory, fileName + jTemplate.suffix(), false); - //要备份的文件存在 - if (backUpFile != null && backUpFile.exists()) { - if (!confirmCoverFileDialog()) { - FILEChooserPane fileChooser = FILEChooserPane.getInstance(true, true); - fileChooser.setFileNameTextField(fileName, jTemplate.suffix()); - fileChooser.setCurrentDirectory(directory); - int chooseResult = fileChooser.showSaveDialog(DesignerContext.getDesignerFrame(), jTemplate.suffix()); - if ((chooseResult == FILEChooserPane.CANCEL_OPTION) || - (chooseResult == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION)) { - return false; - } - backUpFile = fileChooser.getSelectedFILE(); - } - } - jTemplate.getTarget().export(backUpFile.asOutputStream()); - TemplateTreePane.getInstance().refresh(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - return false; - } - return true; - } - } - return true; - } - - /** - * @param file - * @Description: 获得当前文件的父目录 - * @return: - * @Author: Henry.Wang - * @date: 2020/9/23 16:50 - */ - public static FileNodeFILE getFileParentDirectory(FILE file) { - FileNodeFILE fileParent = null; - if (file instanceof FileNodeFILE) { - FileNodeFILE fileNodeFILE = (FileNodeFILE) file; - FileNode fileNode = new FileNode(Paths.get(fileNodeFILE.getPath()).getParent().toString(), true); - fileParent = new FileNodeFILE(fileNode, fileNodeFILE.getEnvPath()); - } - return fileParent; - } - - /** - * @param - * @Description: 确认是否弹出框 - * @return: 点击确定返回true - * @Author: Henry.Wang - * @date: 2020/9/18 11:20 - */ - private boolean confirmSwitchDialog() { - Object message = DesignerUIModeConfig.getInstance().newUIMode() ? Toolkit.i18nText("Fine-Designer_Fit_Confirm_New_Old_Switch") : Toolkit.i18nText("Fine-Designer_Fit_Confirm_Old_New_Switch"); - int returnVal = FineJOptionPane.showConfirmDialog( - DesignerContext.getDesignerFrame(), - message, - Toolkit.i18nText("Fine-Design_Basic_Confirm"), - YES_NO_OPTION); - return returnVal == JOptionPane.YES_OPTION; - } - - /** - * @param - * @Description: 是否覆盖文件 - * @return: - * @Author: Henry.Wang - * @date: 2020/9/23 17:00 - */ - private boolean confirmCoverFileDialog() { - int returnVal = FineJOptionPane.showConfirmDialog( - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Designer_Fit_Cover_File_Switch"), - Toolkit.i18nText("Fine-Design_Basic_Confirm"), - YES_NO_OPTION); - return returnVal == JOptionPane.YES_OPTION; - } - - /** - * @param - * @Description:更新按钮的状态 - * @return: - * @Author: Henry.Wang - * @date: 2020/8/31 16:39 - */ - public UIButton freshSwitchButton() { - if (DesignerUIModeConfig.getInstance().newUIMode()) { - switchBtn.setToolTipText(Toolkit.i18nText("Fine-Designer_Fit_Switch_To_Old_UI")); - switchBtn.setText(Toolkit.i18nText("Fine-Designer_Fit_Switch_To_Old_Version")); - } else { - switchBtn.setToolTipText(Toolkit.i18nText("Fine-Designer_Fit_Switch_To_New_UI")); - switchBtn.setText(Toolkit.i18nText("Fine-Designer_Fit_Switch_To_New_Version")); - } - return switchBtn; - } - - public UIButton getToolBarButton() { - return freshSwitchButton(); - } - -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java b/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java index e475133a9..d976691c6 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java @@ -1,10 +1,10 @@ package com.fr.design.mainframe; import com.fr.design.constants.UIConstants; -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; import com.fr.share.ShareConstants; +import com.fr.general.FRScreen; import com.fr.general.IOUtils; import com.fr.stable.StringUtils; @@ -63,7 +63,7 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{ // controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH); controlButton.setVisible(false); helpDialog = new WidgetHelpDialog(DesignerContext.getDesignerFrame(), helpMsg); - double screenValue = DesignerUIModeConfig.getInstance().getDesignScreenByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue(); + double screenValue = FRScreen.getDesignScreenByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue(); int offsetX = 0; if (screenValue < FormArea.DEFAULT_SLIDER) { offsetX = (int) ((1 - screenValue / FormArea.DEFAULT_SLIDER) 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 b9ce52fc5..524dd8bf1 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 @@ -194,7 +194,7 @@ public class EditingMouseListener extends MouseInputAdapter { e.translatePoint(oldX - e.getX(), oldY - e.getY()); } - private void offsetEventPoint(MouseEvent e) { + private void offsetEventPoint(MouseEvent e){ int x = designer.getRelativeX(e.getX()); int y = designer.getRelativeY(e.getY()); e.translatePoint(x - e.getX(), y - e.getY()); @@ -206,8 +206,8 @@ public class EditingMouseListener extends MouseInputAdapter { * @param e 鼠标事件 */ public void mouseReleased(MouseEvent e) { - MouseEvent transEvent = new MouseEvent(e.getComponent(), MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); - MouseEvent clickEvent = new MouseEvent(e.getComponent(), MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); + MouseEvent transEvent = new MouseEvent(e.getComponent(), MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); + MouseEvent clickEvent = new MouseEvent(e.getComponent(), MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); int oldX = e.getX(); int oldY = e.getY(); offsetEventPoint(e); @@ -240,7 +240,7 @@ public class EditingMouseListener extends MouseInputAdapter { } } - private boolean isAutoFire(MouseEvent transEvent, MouseEvent clickEvent) { + private boolean isAutoFire(MouseEvent transEvent, MouseEvent clickEvent ) { offsetEventPoint(transEvent); XCreator xCreator = designer.getComponentAt(transEvent); return (pressX != clickEvent.getX() || pressY != clickEvent.getY()) @@ -728,15 +728,15 @@ public class EditingMouseListener extends MouseInputAdapter { /** * 刷新顶层组件 - */ - public void refreshTopXCreator(boolean isEditing) { + * */ + public void refreshTopXCreator(boolean isEditing){ designer.refreshTopXCreator(isEditing); } /** * 刷新顶层组件 - */ - public void refreshTopXCreator() { + * */ + public void refreshTopXCreator(){ refreshTopXCreator(false); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java index bc4e941fc..f127f8ea0 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java @@ -1,13 +1,14 @@ package com.fr.design.mainframe; +import com.fr.base.ScreenResolution; import com.fr.common.inputevent.InputEventBaseOnOS; +import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.fit.DesignerUIModeConfig; -import com.fr.form.fit.NewFormMarkAttr; +import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.layout.TableLayout; @@ -78,6 +79,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { private boolean isValid = true; // 初始时滑块值为100,托动后的值设为START_VALUE; private double START_VALUE = DEFAULT_SLIDER; + private int resolution = ScreenResolution.getScreenResolution(); private double screenValue; @@ -251,7 +253,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { private void initCalculateSize() { Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension scrnsize = toolkit.getScreenSize(); - this.screenValue = DesignerUIModeConfig.getInstance().getDesignScreenByDimension(scrnsize).getValue(); + this.screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue(); XLayoutContainer root = FormArea.this.designer.getRootComponent(); // 7.1.1不放缩放滑块,但表单大小仍按屏幕分辨率调整 // slidePane.populateBean(screenValue); @@ -283,19 +285,10 @@ public class FormArea extends JComponent implements ScrollRulerComponent { // 失去焦点时,可以认为输入结束 int width = (int) ((UINumberField) e.getSource()).getValue(); changeWidthPaneValue(width); - changeFormMarkAttrWidth(width); } }); } - private void changeFormMarkAttrWidth(int width) { - NewFormMarkAttr newFormMarkAttr = designer.getTarget().getAttrMark(NewFormMarkAttr.XML_TAG); - if (newFormMarkAttr != null) { - newFormMarkAttr.setBodyWidth(width); - } - } - - private void changeWidthPaneValue(int width) { XWFitLayout layout = (XWFitLayout) designer.getRootComponent(); if (width != layout.toData().getContainerWidth()) { @@ -310,7 +303,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent { public void actionPerformed(ActionEvent evt) { int height = (int) ((UINumberField) evt.getSource()).getValue(); changeHeightPaneValue(height); - changeFormMarkAttrHeight(height); } }); heightPane.addFocusListener( @@ -323,14 +315,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent { }); } - private void changeFormMarkAttrHeight(int height){ - NewFormMarkAttr newFormMarkAttr = designer.getTarget().getAttrMark(NewFormMarkAttr.XML_TAG); - if (newFormMarkAttr != null) { - newFormMarkAttr.setBodyHeight(height); - } - } - - private void changeHeightPaneValue(int height) { XWFitLayout layout = (XWFitLayout) designer.getRootComponent(); if (height != layout.toData().getContainerHeight()) { @@ -399,7 +383,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { /** * 修改大小后,再根据屏幕分辨率调整下 */ - public void doReCalculateRoot(int width, int height, XWFitLayout layout) { + private void doReCalculateRoot(int width, int height, XWFitLayout layout) { // double value = slidePane.updateBean(); //重置滑块的值为默认值100 START_VALUE = DEFAULT_SLIDER; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index f167a2c72..1d4fad8e3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -43,7 +43,6 @@ import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.fun.RightSelectionHandlerProvider; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; @@ -145,7 +144,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection // 存储被选择组件和剪切板的model private transient SelectionModel selectionModel; - private int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + private int resolution = ScreenResolution.getScreenResolution(); // 编辑状态的事件表 private CreatorEventListenerTable edit; protected List designerActions; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java index efc7ff2b0..e5617c946 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java @@ -11,11 +11,15 @@ import com.fr.form.ui.BaseChartEditor; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.script.Calculator; +import com.fr.stable.EmbParaFilter; import com.fr.stable.ParameterProvider; import com.fr.stable.js.WidgetName; +import com.fr.util.ParameterApplyHelper; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class FormModelAdapter extends DesignModelAdapter> { @@ -42,6 +46,16 @@ public class FormModelAdapter extends DesignModelAdapter> jTemplate.populateParameter(); } + @Override + public void tableDataParametersChanged(String oldName, String tdName, TableData tableData) { + Map map = new HashMap<>(); + addGlobalParameters(map); + updateTableDataParameters(oldName, tdName, tableData, map, parameterProvider -> !EmbParaFilter.isFRLayerTypePara(parameterProvider)); + ParameterApplyHelper.addPara2Map(map, this.getBook().getTemplateParameters()); + parameters = map.values().toArray(new Parameter[0]); + jTemplate.populateParameter(); + } + /** * 控件配置改变. */ @@ -135,6 +149,13 @@ public class FormModelAdapter extends DesignModelAdapter> @Override protected Parameter[] getLatestParameters() { - return this.getBook().getParameters(); + Map map = new HashMap<>(); + addGlobalParameters(map); + + addTableDataParameters(map, parameterProvider -> !EmbParaFilter.isFRLayerTypePara(parameterProvider)); + + ParameterApplyHelper.addPara2Map(map, this.getBook().getTemplateParameters()); + + return map.values().toArray(new Parameter[0]); } } diff --git a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java deleted file mode 100644 index 7db99129c..000000000 --- a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.fr.design.preview; - -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.fun.impl.AbstractPreviewProvider; -import com.fr.design.mainframe.JForm; -import com.fr.design.mainframe.JTemplate; -import com.fr.general.web.ParameterConstants; - -import java.util.HashMap; -import java.util.Map; - -/** - * Created by kerry on 2020-04-23 - */ -public class DeveloperPreview extends AbstractPreviewProvider { - private static final int PREVIEW_TYPE = 7; - - @Override - public String nameForPopupItem() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Developer_Preview"); - } - - @Override - public String iconPathForPopupItem() { - return "com/fr/design/form/images/developer_preview.png"; - } - - @Override - public String iconPathForLarge() { - return "com/fr/design/form/images/developer_preview24.png"; - } - - @Override - public int previewTypeCode() { - return PREVIEW_TYPE; - } - - - @Override - public Map parametersForPreview() { - Map map = new HashMap(); - map.put(ParameterConstants.OP, "developer_preview"); - return map; - } - - @Override - public boolean accept(JTemplate jTemplate) { - if (jTemplate == null) { - jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - } - return jTemplate instanceof JForm; - } -} diff --git a/designer-form/src/main/java/com/fr/design/preview/FormAdaptivePreview.java b/designer-form/src/main/java/com/fr/design/preview/FormAdaptivePreview.java deleted file mode 100644 index 01bd0e126..000000000 --- a/designer-form/src/main/java/com/fr/design/preview/FormAdaptivePreview.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.fr.design.preview; - -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.fun.impl.AbstractPreviewProvider; -import com.fr.design.mainframe.JForm; -import com.fr.design.mainframe.JTemplate; -import com.fr.general.web.ParameterConstants; - -import java.util.HashMap; -import java.util.Map; - -/** - * Created by kerry on 2020-04-23 - */ -public class FormAdaptivePreview extends AbstractPreviewProvider { - private static final int PREVIEW_TYPE = 6; - public static final String PREVIEW_OP = "form_adaptive"; - - @Override - public String nameForPopupItem() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_New_Form_Preview"); - } - - @Override - public String iconPathForPopupItem() { - return "com/fr/design/images/buttonicon/runs.png"; - } - - @Override - public String iconPathForLarge() { - return "com/fr/design/images/buttonicon/run24.png"; - } - - @Override - public int previewTypeCode() { - return PREVIEW_TYPE; - } - - - @Override - public Map parametersForPreview() { - Map map = new HashMap(); - map.put(ParameterConstants.OP, PREVIEW_OP); - return map; - } - - @Override - public boolean accept(JTemplate jTemplate) { - if (jTemplate == null) { - jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - } - return jTemplate instanceof JForm; - } -} diff --git a/designer-form/src/main/resources/com/fr/design/form/images/developer_preview.png b/designer-form/src/main/resources/com/fr/design/form/images/developer_preview.png deleted file mode 100755 index 7d7e064d1cdf48fa3304c490e92817f0c9737633..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 542 zcmV+(0^$9MP)g-Xe$z{md1k(f(D@;MD(Z<1<{HpJp`$sf(Jo7C>X&U zM5V~GLLrD64Y7ox5=0t%NYX;%W0e$(sBM$om8`B3NRtZwmtmNhZyx`Q!0)&H=4>3( z^xFDdQqv~Fsi5niZ5RFkLNjKq;F3L;OC!t9Td82{p_2a306WRkzyd4w{{vi&0{uRb zqiT_Fvv6sr#K0S!Q{5u{Pju4xU!7L0z}+Npeuu=>M3HA%lNAkcWw*?}I|aH|3iNeJ z1RoVieKIQp?(Ua~W^_U?3@gjAEutl_4eOQ+bc*z}Iyi8zP`iSmagz(1#t03*;=@+~ z_XZDVde>C1pp>OFgL6KSvo|92wmVtf;YAQkvdI|Ah{0HcZ|)h`U*wq1v$sA$&#paX zs}YT;+@I>ga5h$M!S=5EILv8(GfP`ml>xN(6I@g?%rtwe1LVmOj&C+-TfeakFrFUe za&(G9lczcWL#IOvb0lyWNs=sxVHgaAuk*alPjTV$8UVoY<1?=OAY0wb5G9dh@-^E! z*YV(CjCXB)JU-bnzg2cjPl9P!gIk=r%?bZnVlUs4j7Ju!s`};cEzIYfO_L=#1y8;9 gJuwt-R}>}t6Ak^{5p4;(QUCw|07*qoM6N<$f=1i*UH||9 diff --git a/designer-form/src/main/resources/com/fr/design/form/images/developer_preview24.png b/designer-form/src/main/resources/com/fr/design/form/images/developer_preview24.png deleted file mode 100755 index fc3d3d34788de6d53a98a5461a896f335b1394e5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 862 zcmV-k1EKthP)2W958P*4ISgx3N1AiM@J*P+IXQckV^10YZa+)X4gK?9c?DCg!J^hGHoSa#}rQ8Ec1 zF>qZ+VaVp{fyWLw#P21MSRG8Dy`Mo&{S3esg$VbR5|}J3)U|dzI!q#3PT(obl3z3c%US)SwWysPeJ#camhHYyje7WyAUXr0nb$u*eD>a z(vGoN1_%}cckxV*A&?$JLideEVH54#y`V`ry(*WTl`08V1hB|`(u84iH-h}cu#C~z z5gmez)Od7S2w{%lYzW6iWT$~k4HRz2S@Bu_3LCa3AS^t>>44a3!iV=-=-5OIh(cWQ zV$nIU;NOmAu(78CIp@zn;^Q-K7(>%|TJ{Vrfhs^Ob@mGeAni6FFJ+a>&gW7Ln)^{u z)q-E)`-KOH=&8fC?2~-Y0X!_N#+TqU;Q_WX&Ge9T6U2O>Z5pX7M}l zxU2@B0*?s~Anj^Ie%dC;L&FwyVZ<_oTV;A!S1N@E07D_hT!{;r86d>sc@QkiLQ`9c zcLR~IDdM~U0Du_n!?rOUj;1CfXt~@e;@G+2Z9NVhNPt$Sg~q%d){vc({em4sry4yD z|86}Z{YMb&M_|~-pu-{qP52@u^e2qQW+W+*3zlXK&6NCYb>!363je`2n=L9e oQ7}eEf4d3w4yhG+yQrzi*+G+mLDp8Y31 zA%W}ga(3T``$IX7D)e&LbsgHA?!VS;8{U7b2QXQtKv`=fj4so$Eg#oBC@(~faX dY-YY&#qh($G@r}j^ADh*44$rjF6*2UngDvpEFb^? diff --git a/designer-form/src/main/resources/com/fr/design/form/images/icon_switch.png b/designer-form/src/main/resources/com/fr/design/form/images/icon_switch.png deleted file mode 100644 index 3730b3b79d0c44ede776f8bb1e3575302ea741b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 304 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6oZW8(2`y1f!v9fk}`jvc=IysLe>zwH?YHHqekS(BTuc0ROs z);J^JmXyOL%~xV|`2T-i>uvd|JUl!izyCe{ZpY@QR+hG4sM4=_Q@{W zS=IV_m-TTcG&Y@OTXghclkv;3_JN40_212e(-kR1bUgl)78&qol`;+05m>t A`v3p{ diff --git a/designer-form/src/main/resources/com/fr/design/form/images/icon_switch_disable.png b/designer-form/src/main/resources/com/fr/design/form/images/icon_switch_disable.png deleted file mode 100755 index daee74b513d87662cdf4eeb8bf59268b862eb51c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 296 zcmV+@0oVSCP);zykPa?0|z+aG)mYum__73XlRkaIgb2 zI>_5>CP5b>m-+0x&kW@CUmV9rLFtb1+u`J7zUF%##nCF`)iae0a^w6)` z_t)p1WGk~Y#ySxN;xbLsRogxeM9+Ii;9`Bqnez&Ho_8F~%SHqtYL19iJ>B}RzlzThydtl9N?-l upj9-;uK(iz``gT;^C={PAt+5D5bO(KVpuOb$Wvbc00004%P)F8+hA7VG3tTiQxR z#6b~PMXMZkzV*KIan3zl!apAc)o1e7(TfwxRko?^Y6Aldvnv2AQ9ifZi&U>(3T0Lh25mLMrdt~jh(MFP@3M8jWNf+$BBv$rq6_W<03*p_&Z z&q@bm{{|aGK$A%rL@> z*g_-{;Y&pP)pc+UATG(6J=q9fdWi?~RVkIaTj88@GV+}r0r{zvm5-B2JyENbYhDmd z(s5-)$YN00000NkvXX Hu0mjfc diff --git a/designer-form/src/main/resources/com/fr/design/form/images/icon_switch_old_ui.png b/designer-form/src/main/resources/com/fr/design/form/images/icon_switch_old_ui.png deleted file mode 100755 index 08217d41132434f3e03617896800278903046bad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 417 zcmV;S0bc%zP)LAb5AH}F0x5F+jGC)J>Pc@;h#mL>NPE)mCFwm0B%P+GC2EfSu{=a)oY4gh{=MpMQ|ob(~M0agea9}FM#uIvR<`u!V%YL zJpr)DFpLzl7^~OCO|^Pg_Y!ydnLLNyMC%=(Pl`n1bHO0BW%j-{uC#MkS^tg~Bvojq z!SWKob9Y_o)pW66(;vtrDr diff --git a/designer-form/src/main/resources/com/fr/design/form/images/loading.png b/designer-form/src/main/resources/com/fr/design/form/images/loading.png deleted file mode 100644 index d479fb376be6526651ffa41579bd4551f5d44916..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7641 zcmd6MRZtvC6eS@L+}(o)C%C%@hu}^iz~D}B8(f2j4DRkO!3jFRFgSw*A3V5Zd4IdV zTeVVkTRytFySnc^efr!OO?5>qbaHeA1OzN)B{}Wa_WHG~p}u>q%klSfUK=D^X*FpC zgoY%HCre}m1gd0ZIqA>7Z%#lM0fY-Zqchpr>r)sqN{GMdxQPBdRN5`9Zr4B~nI)=- zj2)bw4eHj=kp@QfdRB;6SE}05&ml*nH}f|hlEcScy3+Uo&AJXXHO)puJz?nZNU^bS z>!!Nwj=m<#9YmES#+<+xb%~s8;j=68tGuf$-hcE+SZK)z{~y>dCA6^=gjgnKxc=`Bo3^WzL}ALM1|bu+2}O4?@~-?5dLp{HimmutsJZuYz>3ZI4`x_ zRi5lJ&(f(35m0kBw49*ad{=mi=VXy8(hWWm8ADT!v|nrQvs$o;5((K8Up08#F1Mu{ zM5`~Ec18YpPe@QdOvy6bSuRzzWK68@&&P7cU23n#K>bQrTCb^SulI|*?*sm1iR3x7 zNlgf}{q{(3TJ6jD@swRJ2PVGhbI@K}TNAQZqkUhXNg~5RVnH@z-1Df@YLkmq04-dhTex{5I<|E_uj&`!t zF~3tC9GX%_;;^eDJYuN)*R7j-jK!iCuw|`p=hs4cHh?^JfQK64bfMM7nCs6bgv%#C zSju>cqR7?q6qD^^6Xs>uSL@Me`EKL+p^qp%o`bd(si9=ZIBABs@1+Q4dsJ&Ug~8@i z%rGaG7!jv|U$bVh*}6QB1wsTd*F)~vMrHptA7Y#0Aou2U8e9o7p?igSRUK|ulM#3& z77+YN2e^!?Lrm18$~C;Y?@4KZBK=1E9B!)eWL@hqo7(HUnQf6nxxL|;M*dyw7iG7y zRtU%4*nDUHY8MZ!^$5q|@m6Oz%D2+k%|g*3Zpm02+xWk15#_N#GE^kfZ!)-?uwrYd zb>OEBL%X(cSjTcbf)uv*s%; zX_IK$lvR~CF_FnUZ<8&EjJARsf;gZ5zSQ_tQ_K*2_@!vIU44*>20g>l zFea%2&VwV{t*eyR4gYTqa?Q4j1n}Egt+s~qKUgyh7G+i^&X{2eP!*vFsZSCf32Dw* zwzP;dzmsuGb1R|0;49VQ9l_NZ(ZbLoPucO1CdYpt+D#`_FkN+IZK;F+dnQ0cOO^`4 z%h%l34{YRPc<=6B==d_&+O&8quD<|-6t3)38@w;z{}G9#B!xHDk>R%iSY2qDcx<(a z6|GMlTyc8N-2~ox%dX?T0$vDRvWE;6x_@2-v@d~UV$Igs*^>qX6x4_IE?{jt?Uok} zPX9UrYyD@s_99f#0Sx}zRbY8Jbikj)pm~7gu2By3T^AUh zNlmMz>8e(muJp`zl{pV{GJ`YDw#{kadxU=SjZX}?jIWbEkEQcOPi9Uz0Yv4AtfuFV zg4r{9{w*3SIK(UB3t@)-BsjABW<>tMQEQ(gL5qU=HTnrdO(=Dm_Fh3Cl2)pK`W-e% z={?EoWqC9}vuyE6BN2dpq(Yu_p(YHk2R3ZM#lPCcbye+Js4H99HVB$aHIRfuT!7M%63U>3^w_2 z0Ln;>Jc{RjU^Gls>xo|ak6f<_rG65U<(wr8M44ViEyM{_p@U~)3Wz@3xz!(hwA9!9 zi_FuE{p7{viRgo2oOE1PncY&QaK~9~yqn$lE#`5@dSI^-Hbnic!$@RLv9!FwY&F&N)(TLPSmW;m*A@THf95Nsgq8q~AsTFUT84f>E7LJ+aVDt8S_P;1OTxt=9JR_fWOg^Q(>L73I|1Ij8RD`UZI{B+7uQ z_%jFZdv~AE8=6)Lah?kF%aQ4L>y3Xe719&H(QFLDM5b{;zQ7i{z%DM_)=YjusIwR$ z_53BL)Z)`j4#kJSrjFTXYquCNqM*9GwoVUt!N8v%;y{r_06WfQRp+{7r)RhC$zX`@ zQ^HHMMU_+ZxXJJJ#B@dlYswRhm2Ebh=Gf5u7WW(~8_#d3LwNbI_32V^q4V+I>n)^;8>qR@h2LCsCCknzHa z7piCIU}n-p6-B_V^2EvxhheM+Jsf;rF;un|J??2NnSNj$Kf{Ek$=2`d7YvWYs$`>Zb@j=>W(6WHBNMJj`K6I*UEsD*aphS!e`FGH^ws*vwI z0Q{{oI-m`W6i9o!!~Vws-769RBkhe6-ZrVIb>z(U4HL&Oy|@*5XAI{-{flWL8=8MN zt7E!O(;T%C@YU@^H|uw)6piLA;nCZWa~=<*Gz(aqJj+!ulzi5vlxapn_gKb(Ba*ms z?XR8U<`k%Zd#~iQi3NOd94kYWhvCF4XJOL71em~@#k)Fb@k1_+Um3ch5e?&H8P;b3 zhpTQs&ornTb<=@4^HA3!^i4K$>$8Ga`mYQCV~s~_3t9EVeZqbAx3-rRYZdGmK#_Dl zvPC=s&6;yA^JR)}XHTl(qI2tsB+C~q*lxF(tUyZxj%&4zZx>I5om9Y1@L32ub00Zx zU0{LYlew`{b$jC{p)Y#z-WIF5I9)P@qF=*%bjsS#$*UWimsqH4%uhN*Fk+K+4f8c^ zb-f79zC!S4a%j#7pO=((Pz*%KsU+F(ySQsNT0bzaJPd4$SMwcX1zc|U?a4(Mc zCXEW%d|Jqj9H93(z}G3qnTq5rQkC-RprAg&oj+fI)?AIq_r@fuHIDZ66%OQPL5=Qn zOe~|*&1*T)qE2+pyJsG2mg<24>IIyCR%R@gbuj|hxmJg`7qDktoxiR9j2GX0oAkC$ zH@}G0^8$>;KR~-HPEzC4!|yDI{8hO?y?S6LC@052^FbszL|el5m;kg5si;-L2+a5Y z+xaz~wp33@Ubliaad-}VS$NmxzzD&C-L@QU*e}fs6@`Flz0(C3Ap@kk3kG2}#>fv-ff1S3nEU257S7*%0O-$T( zguf_W_v*wF)CO3zxxBB=n`^WlcwC;e=DQTAbXBAu%ue)hPQ5i^uIa+Q&q}zCtvHkY z+8I)m)jP-3xmS5K##XJR%7lM?wD13xVgvs8Qd*LFN`2ByDv3tO5c=Q+O64-$KZ%m4 zZ_bho+-&3OYfE1}CH%8KB2yM6H74os35chvVMRAbfogaY?^%+mcIaBjo&%syy0Thb zDPD0G|Eha?K->z5ua&?i6YQ+8wuKWO!K*X7Cy07OIo*V9R(fHuGDC%&fAyxWso8`_ z-2{1XcHG|3NR#>E@K@GMm6rVutvE$$rBl|Pogj6b4)NfH*vG%S?f6Ha`qgUhcCeoe zJq(Mh|57@&;*HJo#MZMU0p@p-jV1c=IKbqz4Erd2Nkxr%Ufc|aIymjLS@NDzgo8}) zC4Yk`D~sOe~t#9U#wi5cqiH8vYqobx1#Gq80jQDq=Q&w3fZ&o$+%3dv29&M2JkF%bHqCkWH3Et%|Qn;J}ZjGd&-~^ zg&Cs;xz=o%AeGplY!XKVYNq;uM_LG5Y4(HUwio$U>r^lnLm4?*ilYw_GHO)()P*tA$SKyAFAO>2 z!^HCI1)VfG$bC4Xo1%CbVo@TmVTN$m|LdNYB;c4Ls~34AIL95ri-jnP=CmTWCTG9; zQJhIdjEdzAO9O4*daRwdbbFg@x8$#D<4D5EB=wRq*M-6x1Lif7YHHI`Uc65^zRr9rbc6R7*Zl|8Ukc<&s(?-g1f3~|# zIGk2b2~SM^YsUh=*!D8;#N8EpwEuXFz2mD@D+TXn)-x1R-G(|C9z!^A9s~Nq{{&&b z+jJCK3;O{^jAo0*m3EY&;p4ulaZr#-ZH0a2h5eW~yTl0otu-KM`YD*aDpEP+|D;4n z87mc-x)1Ht&27TorFIAoO7&S;W17LSI>8q=e+hGX4^R5?JoEZrF6sR(de)8NKQg*P za};nIYkGWq3eyQ<_F1tdc|+gTnEKoi8seLeJcRR13)b$Kks8J3OOi@K<%?i0szv@x zez-l7!Fc-N=AK++&9(1jY43{DO({EhPISsrXiC#{S`!KF=Vs`IuANMU-|m@N$@HJ2 zhxA;%Kk9(aCBTn81H1Rx9Jdb=2~lxX9kYRt^;)0qfw8f%oAp5lS^P-M5M{k#p)&5P zEsCl~+JR5k8beYRvIRai~vEGmXjaw*m7ii4}IUGf)(30#p2bU5uI+ojc!>) zsQRm!&ez%{kKvI=y^kw&@F?<^ey%fCnTTUD67T8(v+|WYs8q-qoriq%Ml!OE7=$)O zw|RU-bVRj?8x`R42-Y_}E?o*mQ6sU^iH%Ove!5MQp=X|kIUR0U{h4&OuYRVzyqSOC zubIywS#;Fj;_QX#xUWpEJR{weaF|s!n=e%^=m(|U+lqc>L&FRB^NDpe3E_8Puxxso z{I~I=YOzLFnLHEUJ9cNsJGm_oJG51)&#SD|A;{6bz_9e5lrJ_A?YzJ>D45{8c2psE ziLB}p74*CFRu6R;hOR{+eosW(Y-7gOgK*i$AXJ*w^Y_Av_n_70W7cRm%Tc%UZmm2x z*k52x_VEE*H-oV^(E(4OKt?sXC_kzi{X#9SoEF2_=RN6KgPKC$^SFwOZ)_0`o(+ml zN7d?MCdj2cU+c?Ea_5etwI0m)j2OS92=W_b14iTlCWHIEKXoa zRYPMZwg|A7cWHN}+af>%VoJ3y@NJgAwa~Sk(G=6bdUfVC>8~D`v!O z=u3wSbHGo6zZV)&wbK=vxPE+{8@4A{w-r>ZbP5D>p?4bsKv%H_J4f5V`P$(~KFHg> zoj^0+F}GJuhQ3^C73^oTr2SADg~>G1+b|W?(8Tk+)U6)vbKWIm%Bu695KM$=Qm6dw z)=XnG?V%K^j4Luh2vt5%*Z75bD?Coaux3wMt1l?<8GG2p5Xu)1gz26x3B03#$Mh=w zGcg?E)hwD_B76XgZdXCa&9=o=}bY5G3R zUYszXUde}B7PGO}w7E(!K(h2C)fQW>$Ej*MS6GV8K{Vrhf>5#G*+8mP#FtI1EKFnl zHmk+pFZA{Mf*cirdO$;LwGFNv{^ff%pFGOe$&gmFI9I+#UWRr@#w>}@vbn9_6z@{5sZ+F zEi0k+@;2^}f>_@r1#3LYw8}o}jP*;@w0v^=1@1u^u3f49vaO|+>hSr7J4+_C=G<3p zwOeIzSL1WFRyegHOKaM5?x1S`VGG7PSr5v{Zh626I7@^OUAzKV{k@!qx+&_vop{Z5 z7w^%gV~#*@kN(65O9h~vY{|;jfr~w5>&-<>*mE*FU4Sf+soqo<@?68~jE7$se3 z!ee^3b4@q&KUR6aGdd%&+L?=O>AW0|0X5WBf@N}Sb3b31!R3~_7dDzcbX9hK8N3wx zFT|RPsJHiI&}f);oky5NN#w+(aBVF)#uY99zRafA4KF>3>_!F_Ps>fj2Np-PTR1(c z@>0I&-*F5oSt5==uj(bIhkZZv+U5&Fj?WyrP@FS&NDjSsEIoX*VxCjWh}%VPrXW>z zk^B@CfGD$3>0e1Wz!MeL#LDO2Xjd0Q_Lo5@b!WLFgK!QpT+UGgGY9ADK+h%A!z`Xx zuV&D+vfm{lozHaw*03Vwg!+uAu?jKOs%uef%h#n-Az}NQ|IW=QIbDUc@Zi!pQZRm^ zmGddMzGl(Lu$c*&P_B<-Cl3|xHt_#X?P>MT+&3G#pkx~Lzc6y(H`Dv_)|-1b8>oAh z*9P^cj3B+T`C1W6(Qh&qt^&%*(2XxIv)E_D>3$;Pw$fHNmgIv{qe>)BExRa)z@&0r zehn>)u?uymUC-~3Su6R~dot$cG!D}JFeJU@8l?13^~HMxY*EHpON7iD-N8Mfbu_qvczDZ*51!e;sra{N6&V$q+PZ@}*3K!sYuyuP3*{io5}4n4#STHgWN_ zWvLqS{Rg>AWmL-{`Ussx4m`tIWWxu4;JmNqXMN-@@h-tZ|BgM+8f{ZI)rgbpC|S0T zc;0#F--szCm{X^Tiw$&^h zwd#V-x^j=sITflT list1 = new ArrayList(); - List list2 = new ArrayList(); - list2.add("test2"); - list2.add("test3"); - list2.add("test4"); - FormDesignerUtil.removeDeletedEC(list1, list2); - Assert.assertEquals(0, list2.size()); - - list1.add("test1"); - list1.add("test3"); - list2.add("test2"); - list2.add("test3"); - list2.add("test4"); - FormDesignerUtil.removeDeletedEC(list1, list2); - Assert.assertEquals(1, list2.size()); - Assert.assertEquals("test3", list2.get(0)); - - list1.remove("test3"); - FormDesignerUtil.removeDeletedEC(list1, list2); - Assert.assertEquals(0, list2.size()); - - } -} diff --git a/designer-form/src/test/java/com/fr/design/preview/DeveloperPreviewTest.java b/designer-form/src/test/java/com/fr/design/preview/DeveloperPreviewTest.java deleted file mode 100644 index 624e34e59..000000000 --- a/designer-form/src/test/java/com/fr/design/preview/DeveloperPreviewTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fr.design.preview; - -import com.fr.design.mainframe.JForm; -import com.fr.general.web.ParameterConstants; -import org.easymock.EasyMock; -import org.junit.Assert; -import org.junit.Test; - -import java.util.Map; - -/** - * Created by kerry on 2020-04-24 - */ -public class DeveloperPreviewTest { - @Test - public void testParametersForPreview() { - DeveloperPreview formPreview = new DeveloperPreview(); - Map map = formPreview.parametersForPreview(); - Assert.assertEquals(1, map.size()); - Assert.assertEquals("developer_preview", map.get(ParameterConstants.OP)); - } - - @Test - public void testAccept() { - DeveloperPreview formPreview = new DeveloperPreview(); - Assert.assertTrue(formPreview.accept(EasyMock.mock(JForm.class))); - } -} diff --git a/designer-form/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java b/designer-form/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java deleted file mode 100644 index 4972568b4..000000000 --- a/designer-form/src/test/java/com/fr/design/preview/FormAdaptivePreviewTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fr.design.preview; - -import com.fr.design.mainframe.JForm; -import com.fr.general.web.ParameterConstants; -import org.easymock.EasyMock; -import org.junit.Assert; -import org.junit.Test; - -import java.util.Map; - -/** - * Created by kerry on 2020-04-24 - */ -public class FormAdaptivePreviewTest { - @Test - public void testParametersForPreview() { - FormAdaptivePreview formPreview = new FormAdaptivePreview(); - Map map = formPreview.parametersForPreview(); - Assert.assertEquals(1, map.size()); - Assert.assertEquals("form_adaptive", map.get(ParameterConstants.OP)); - } - - @Test - public void testAccept() { - FormAdaptivePreview formPreview = new FormAdaptivePreview(); - Assert.assertTrue(formPreview.accept(EasyMock.mock(JForm.class))); - } -} diff --git a/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java b/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java index 794f1febb..0903323b8 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java @@ -4,7 +4,6 @@ package com.fr.design.actions.columnrow; import com.fr.design.DesignerEnvManager; -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.gui.frpane.UnitInputPane; import com.fr.design.gui.frpane.UnitInputPane.ValueNotChangeException; @@ -12,6 +11,8 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.fun.ReportLengthUNITProvider; +import com.fr.design.unit.UnitConvertUtil; import com.fr.general.ComparatorUtils; import com.fr.grid.selection.CellSelection; import com.fr.report.elementcase.ElementCase; @@ -50,7 +51,7 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction try { float newHeight = (float) uPane.update(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); - ReportLengthUNITProvider lengthUNIT = DesignerUIModeConfig.getInstance().parseLengthUNIT(unitType); + ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); UNIT newLen = lengthUNIT.float2UNIT(newHeight); if (!ComparatorUtils.equals(oldLen, newLen)) { updateAction(report, newLen, finalCS); @@ -67,7 +68,7 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction protected void populateNumberDialog(final UnitInputPane uPane, UNIT unit) { int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); - ReportLengthUNITProvider lengthUNIT = DesignerUIModeConfig.getInstance().parseLengthUNIT(unitType); + ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); float va = lengthUNIT.unit2Value4Scale(unit); uPane.setUnitText(lengthUNIT.unitText()); uPane.populate(va); diff --git a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java index 0b7fc7c01..7b4f636a6 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java @@ -1,10 +1,10 @@ package com.fr.design.condition; import com.fr.design.DesignerEnvManager; -import com.fr.design.fit.DesignerUIModeConfig; -import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; +import com.fr.design.fun.ReportLengthUNITProvider; +import com.fr.design.unit.UnitConvertUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.report.cell.cellattr.highlight.HighlightAction; @@ -47,7 +47,7 @@ public abstract class WHPane extends ConditionAttrSingleConditionPane= 0 && e.getY() < height) { - Point convertPoint = new Point(width, 0); - SwingUtilities.convertPointToScreen(convertPoint, grid); - showToolTip(grid, e, actualWidth + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Px"), convertPoint); - return; - } else { - hideToolTip(); - } - if (Math.abs(e.getY() - height) < 5 && e.getX() >= 0 && e.getX() < width) { - Point convertPoint = new Point(0, height); - SwingUtilities.convertPointToScreen(convertPoint, grid); - showToolTip(grid, e, actualHeight + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Px"), convertPoint); - return; - } else { - hideToolTip(); - } - } - - private void showToolTip(Grid grid, MouseEvent evt, String text, Point tipLocation) { - if (tipWindow == null) { - tipWindow = new JWindow(); - - - tip = grid.createToolTip(); - tip.setBorder(BorderFactory.createEmptyBorder()); - tipWindow.getContentPane().add(tip, BorderLayout.CENTER); - } - tip.setTipText(text); - tip.setForeground(Color.decode("#88ACC6")); - tipWindow.setLocation(tipLocation.x, tipLocation.y); - tipWindow.pack(); - tipWindow.setVisible(true); - } - - private void hideToolTip() { - if (tipWindow != null) { - tipWindow.setVisible(false); - } - } - - @Override - public void mouseClicked(MouseEvent e) { - - } - - @Override - public void mousePressed(MouseEvent e) { - - } - - @Override - public void mouseReleased(MouseEvent e) { - - } - - @Override - public void mouseEntered(MouseEvent e) { - - } - - @Override - public void mouseExited(MouseEvent e) { - hideToolTip(); - } - - @Override - public void mouseWheelMoved(MouseWheelEvent e) { - hideToolTip(); - } -} diff --git a/designer-realize/src/main/java/com/fr/design/fit/grid/ElementCasePaneUtil.java b/designer-realize/src/main/java/com/fr/design/fit/grid/ElementCasePaneUtil.java deleted file mode 100644 index 1078250c6..000000000 --- a/designer-realize/src/main/java/com/fr/design/fit/grid/ElementCasePaneUtil.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.fr.design.fit.grid; - -import com.fr.base.vcs.DesignerMode; -import com.fr.design.actions.cell.CleanAuthorityAction; -import com.fr.design.actions.columnrow.CancelColumnAction; -import com.fr.design.actions.columnrow.CancelRowAction; -import com.fr.design.actions.columnrow.ColumnHideAction; -import com.fr.design.actions.columnrow.ColumnWidthAction; -import com.fr.design.actions.columnrow.DeleteColumnAction; -import com.fr.design.actions.columnrow.DeleteRowAction; -import com.fr.design.actions.columnrow.FootColumnAction; -import com.fr.design.actions.columnrow.FootRowAction; -import com.fr.design.actions.columnrow.HeadColumnAction; -import com.fr.design.actions.columnrow.HeadRowAction; -import com.fr.design.actions.columnrow.InsertColumnAction; -import com.fr.design.actions.columnrow.InsertRowAction; -import com.fr.design.actions.columnrow.ResetColumnHideAction; -import com.fr.design.actions.columnrow.ResetRowHideAction; -import com.fr.design.actions.columnrow.RowHeightAction; -import com.fr.design.actions.columnrow.RowHideAction; -import com.fr.design.gui.imenu.UIPopupMenu; -import com.fr.design.mainframe.ElementCasePane; -import com.fr.grid.GridUtils; -import com.fr.grid.selection.CellSelection; -import com.fr.page.ReportPageAttrProvider; -import com.fr.report.elementcase.ElementCase; -import com.fr.stable.ColumnRow; - -import javax.swing.JPopupMenu; -import java.awt.event.MouseEvent; - -/** - * Created by kerry on 2020-04-28 - */ -public class ElementCasePaneUtil { - public static UIPopupMenu createColumnPopupMenu(ElementCasePane reportPane, MouseEvent evt, int selectedColumn) { - UIPopupMenu popupMenu = new UIPopupMenu(); - - if (DesignerMode.isAuthorityEditing()) { - popupMenu.add(new CleanAuthorityAction(reportPane).createMenuItem()); - return popupMenu; - } - - InsertColumnAction insertColumnAction = new InsertColumnAction(reportPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Insert_Column")); - - DeleteColumnAction deleteColumnAction = new DeleteColumnAction(reportPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Delete_Column")); - - ColumnWidthAction columnWidthAction = new ColumnWidthAction(reportPane, selectedColumn); - - ColumnHideAction columnHideAction = new ColumnHideAction(reportPane, selectedColumn); - - ResetColumnHideAction resetRowHideAction = new ResetColumnHideAction(reportPane, selectedColumn); - popupMenu.add(insertColumnAction.createMenuItem()); - popupMenu.add(deleteColumnAction.createMenuItem()); - popupMenu.addSeparator(); - popupMenu.add(columnWidthAction.createMenuItem()); - - CellSelection cs = (CellSelection) reportPane.getSelection(); - addColumnMenu(reportPane, popupMenu, evt, cs.getColumn(), cs.getColumn() + cs.getColumnSpan() - 1); - popupMenu.add(columnHideAction.createMenuItem()); - popupMenu.add(resetRowHideAction.createMenuItem()); - - return popupMenu; - } - - private static void addColumnMenu(ElementCasePane reportPane, UIPopupMenu popupMenu, MouseEvent evt, int selectedColumnsFrom, int selectedColumnsTo) { - HeadColumnAction headcolumnAction = new HeadColumnAction(reportPane); - FootColumnAction footcolumnAction = new FootColumnAction(reportPane); - - ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evt.getX(), evt.getY(), reportPane.getResolution()); - ElementCase elementCase = reportPane.getEditingElementCase(); - boolean cancel = false; - ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr(); - - if (reportPageAttr != null) { - popupMenu.addSeparator(); - popupMenu.add(headcolumnAction.createMenuItem()); - popupMenu.add(footcolumnAction.createMenuItem()); - int from = reportPageAttr.getRepeatHeaderColumnFrom(); - int to = reportPageAttr.getRepeatHeaderColumnTo(); - int from2 = reportPageAttr.getRepeatFooterColumnFrom(); - int to2 = reportPageAttr.getRepeatFooterColumnTo(); - int column = selectedCellPoint.getColumn(); - - if (column >= selectedColumnsFrom && column <= selectedColumnsTo) { - cancel = isCancel(elementCase, selectedColumnsFrom, selectedColumnsTo, from, to, from2, to2); - } else { - - if (elementCase.getReportPageAttr() != null) { - - if (column == from || column == to || column == from2 || column == to2) { - cancel = true; - } - } - } - if (cancel) { - CancelColumnAction cancelAction = new CancelColumnAction(reportPane); - popupMenu.add(cancelAction.createMenuItem()); - } - } - } - - private static boolean isCancel(ElementCase report, int selectedColumnsFrom, int selectedColumnsTo, int from, int to, int from2, int to2) { - - boolean cancel = false; - - if (report.getReportPageAttr() != null) { - - if (from == selectedColumnsFrom && to == selectedColumnsTo) { - cancel = true; - } - - if (from2 == selectedColumnsFrom && to2 == selectedColumnsTo) { - cancel = true; - } - } - return cancel; - } - - public static UIPopupMenu createRowPopupMenu(ElementCasePane reportPane, MouseEvent evt, int selectedRows) { - UIPopupMenu popupMenu = new UIPopupMenu(); - if (DesignerMode.isAuthorityEditing()) { - popupMenu.add(new CleanAuthorityAction(reportPane).createMenuItem()); - return popupMenu; - } - - InsertRowAction insertRowAction = new InsertRowAction(reportPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Insert_Row")); - - DeleteRowAction deleteRowAction = new DeleteRowAction(reportPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Delete_Row")); - - RowHeightAction rowHeightAction = new RowHeightAction(reportPane, selectedRows); - - RowHideAction rowHideAction = new RowHideAction(reportPane, selectedRows); - - ResetRowHideAction resetRowHideAction = new ResetRowHideAction(reportPane, selectedRows); - popupMenu.add(insertRowAction.createMenuItem()); - popupMenu.add(deleteRowAction.createMenuItem()); - popupMenu.addSeparator(); - popupMenu.add(rowHeightAction.createMenuItem()); - CellSelection cs = (CellSelection) reportPane.getSelection(); - addRowMenu(reportPane, popupMenu, evt, cs.getRow(), cs.getRow() + cs.getRowSpan() - 1); - popupMenu.add(rowHideAction.createMenuItem()); - popupMenu.add(resetRowHideAction.createMenuItem()); - return popupMenu; - } - - private static void addRowMenu(ElementCasePane reportPane, JPopupMenu popupMenu, MouseEvent evt, int selectedRowsFrom, int selectedRowsTo) { - HeadRowAction headrowAction = new HeadRowAction(reportPane); - FootRowAction footrowAction = new FootRowAction(reportPane); - - ElementCase elementCase = reportPane.getEditingElementCase(); - boolean cancel = false; - ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evt.getX(), evt.getY(), reportPane.getResolution()); - ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr(); - ElementCase report = reportPane.getEditingElementCase(); - if (reportPageAttr != null) { - popupMenu.addSeparator(); - popupMenu.add(headrowAction.createMenuItem()); - popupMenu.add(footrowAction.createMenuItem()); - int from = report.getReportPageAttr().getRepeatHeaderRowFrom(); - int to = report.getReportPageAttr().getRepeatHeaderRowTo(); - int from2 = report.getReportPageAttr().getRepeatFooterRowFrom(); - int to2 = report.getReportPageAttr().getRepeatFooterRowTo(); - - if (selectedCellPoint.getRow() >= selectedRowsFrom && selectedCellPoint.getRow() <= selectedRowsTo) { - - cancel = isCancel(report, selectedRowsFrom, selectedRowsTo, from, to, from2, to2); - - } else { - - int row = selectedCellPoint.getRow(); - if (report.getReportPageAttr() != null) { - if (row == from || row == to || row == from2 || row == to2) { - cancel = true; - } - } - } - - if (cancel) { - CancelRowAction cancelAction = new CancelRowAction(reportPane); - popupMenu.add(cancelAction.createMenuItem()); - } - } - } - -} diff --git a/designer-realize/src/main/java/com/fr/design/fit/grid/GridHeaderWithBoundMouseHandler.java b/designer-realize/src/main/java/com/fr/design/fit/grid/GridHeaderWithBoundMouseHandler.java deleted file mode 100644 index bd3c73846..000000000 --- a/designer-realize/src/main/java/com/fr/design/fit/grid/GridHeaderWithBoundMouseHandler.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.fr.design.fit.grid; - -import com.fr.base.DynamicUnitList; -import com.fr.design.fit.DesignerUIModeConfig; -import com.fr.design.mainframe.ElementCasePane; -import com.fr.grid.GridHeader; -import com.fr.grid.AbstractGridHeaderMouseHandler; -import com.fr.report.elementcase.ElementCase; -import com.fr.report.elementcase.TemplateElementCase; - -import java.awt.event.MouseEvent; - -public abstract class GridHeaderWithBoundMouseHandler extends AbstractGridHeaderMouseHandler{ - protected static final int FUZZY_EDGE = 10; - private int limit; - - public GridHeaderWithBoundMouseHandler(GridHeader gHeader, int limit) { - super(gHeader); - this.limit = limit; - } - - public void setLimit(int limit) { - this.limit = limit; - } - - public int getLimit() { - return limit; - } - - public int getDragIndex(MouseEvent evt) { - ElementCase report = this.getEditingElementCase(); - DynamicUnitList sizeList = getSizeList(report); - - int scrollValue = getScrollValue(this.getElementCasePane()); - int scrollExtent = getScrollExtent(this.getElementCasePane()); - int endValue = scrollValue + scrollExtent + 1; - - int beginValue = getBeginValue(this.getElementCasePane()); - - double tmpSize1 = 0; - double tmpSize2; - double tmpIncreaseSize = 0; - - int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); - - for (int index = beginValue; index < endValue; index++) { - if (index == 0) { - index = scrollValue; - } - - tmpSize1 += tmpIncreaseSize; - tmpIncreaseSize = sizeList.get(index).toPixD(resolution); - tmpSize2 = tmpSize1 + Math.max(1, tmpIncreaseSize); - if (isOnSeparatorLineIncludeZero(evt, tmpSize2, tmpIncreaseSize) || isOnNormalSeparatorLine(evt, tmpSize2)) { - return index; - } - } - return -1; - } - - - public ElementCasePane getElementCasePane() { - return this.gHeader.getElementCasePane(); - } - - public TemplateElementCase getEditingElementCase() { - return this.getElementCasePane().getEditingElementCase(); - } - -} diff --git a/designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitColumnMouseHandler.java b/designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitColumnMouseHandler.java deleted file mode 100644 index 28185bc38..000000000 --- a/designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitColumnMouseHandler.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.fr.design.fit.grid; - -import com.fr.base.DynamicUnitList; -import com.fr.design.fit.DesignerUIModeConfig; -import com.fr.design.gui.imenu.UIPopupMenu; -import com.fr.design.mainframe.ElementCasePane; -import com.fr.grid.GridColumn; -import com.fr.grid.GridHeader; -import com.fr.grid.GridUtils; -import com.fr.grid.selection.CellSelection; -import com.fr.grid.selection.Selection; -import com.fr.report.ReportHelper; -import com.fr.report.elementcase.ElementCase; -import com.fr.stable.ColumnRow; -import com.fr.stable.unit.FU; -import com.fr.stable.unit.UNIT; - -import javax.swing.SwingUtilities; -import java.awt.Dimension; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.Toolkit; -import java.awt.event.MouseEvent; - -/** - * peter:处理对GridColumn的Mouse事件. - */ -public class GridLimitColumnMouseHandler extends GridHeaderWithBoundMouseHandler { - - - public GridLimitColumnMouseHandler(GridColumn gridColumn, int limit) { - super(gridColumn, limit); - this.resolution = gridColumn.getResolution(); - } - - @Override - protected void resetSelectionByRightButton(ColumnRow selectedCellPoint, Selection cs, ElementCasePane ePane) { - int[] selectedColumns = cs.getSelectedColumns(); - if (selectedColumns.length == 0 - || selectedCellPoint.getColumn() < selectedColumns[0] - || selectedCellPoint.getColumn() > selectedColumns[selectedColumns.length - 1]) { - resetGridSelectionBySelect(selectedCellPoint.getColumn(), ePane); - } - } - - - protected int doChooseFrom() { - return CellSelection.CHOOSE_COLUMN; - } - - @Override - protected Rectangle resetSelectedBoundsByShift(Rectangle editRectangle, ColumnRow selectedCellPoint, ElementCasePane reportPane) { - int tempOldSelectedCellX = editRectangle.x;// editRectangle.x; - - // adjust them to got the correct selected bounds. - if (selectedCellPoint.getColumn() >= editRectangle.x) { - selectedCellPoint = ColumnRow.valueOf(selectedCellPoint.getColumn() + 1, selectedCellPoint.getRow()); - } else { - tempOldSelectedCellX++; - } - - int lastRow = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane).getRow(); - return new Rectangle(Math.min(tempOldSelectedCellX, selectedCellPoint.getColumn()), 0, Math.max(editRectangle.width, Math.abs(tempOldSelectedCellX - - selectedCellPoint.getColumn())), lastRow); - } - - @Override - protected int[] getGridSelectionIndices(CellSelection cs) { - return cs.getSelectedColumns(); - } - - @Override - protected int getScrollValue(ElementCasePane casePane) { - return casePane.getGrid().getHorizontalValue(); - } - - @Override - protected int getScrollExtent(ElementCasePane casePane) { - return casePane.getGrid().getHorizontalExtent(); - } - - @Override - protected int getBeginValue(ElementCasePane casePane) { - return casePane.getGrid().getHorizontalBeginValue(); - } - - @Override - protected int getColumnOrRowByGridHeader(ColumnRow selectedCellPoint) { - return selectedCellPoint.getColumn(); - } - - - /** - * Checks whether is on zero separator line. - */ - @Override - protected boolean isOnSeparatorLineIncludeZero(MouseEvent evt, double tmpWidth2, double tmpIncreaseWidth) { - return tmpIncreaseWidth <= 1 && (evt.getX() >= tmpWidth2 + 2 && (evt.getX() <= tmpWidth2 + SEPARATOR_GAP)); - } - - @Override - protected boolean between(MouseEvent evt, double from, double to) { - return evt.getX() > from && evt.getX() <= to; - } - - /** - * Checks whether is on normal separator line. - */ - @Override - protected boolean isOnNormalSeparatorLine(MouseEvent evt, double tmpWidth2) { - return (evt.getX() >= tmpWidth2 - 2) && (evt.getX() <= tmpWidth2 + 2); - } - - @Override - protected int evtOffset(MouseEvent evt, int offset) { - return evt.getX() - offset; - } - - @Override - protected DynamicUnitList getSizeList(ElementCase elementCase) { - return ReportHelper.getColumnWidthList(elementCase); - } - - @Override - protected String methodName() { - return "setColumnWidth"; - } - - @Override - protected String getSelectedHeaderTooltip(int selectedColumnCount) { - return selectedColumnCount + "C"; - } - - @Override - protected Point getTipLocationByMouseEvent(MouseEvent evt, GridHeader gHeader, Dimension tipPreferredSize) { - Point convertPoint = new Point(evt.getX(), 0); - SwingUtilities.convertPointToScreen(convertPoint, gHeader); - - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - convertPoint.x = Math.max(0, Math.min(convertPoint.x - tipPreferredSize.width / 2, screenSize.width - tipPreferredSize.width)); - convertPoint.y = convertPoint.y - tipPreferredSize.height - 2; - - return convertPoint; - } - - @Override - protected void resetGridSelectionBySelect(int column, ElementCasePane ePane) { - int lastRow = GridUtils.getAdjustLastColumnRowOfReportPane(ePane).getRow(); - CellSelection cellSelection = new CellSelection(column, 0, 1, lastRow); - cellSelection.setSelectedType(CellSelection.CHOOSE_COLUMN); - ePane.setSelection(cellSelection); - } - - @Override - protected String nameOfMoveCursorGIF() { - return "cursor_hmove"; - } - - @Override - protected String nameOfSelectCursorGIF() { - return "cursor_hselect"; - } - - @Override - protected String nameOfSplitCursorGIF() { - return "cursor_hsplit"; - } - - @Override - protected UIPopupMenu createPopupMenu(ElementCasePane reportPane, - MouseEvent evt, int columnIndex) { - return ElementCasePaneUtil.createColumnPopupMenu(reportPane, evt, columnIndex); - } - - @Override - protected void resetGridSelectionByDrag(CellSelection gridSelection, ElementCasePane reportPane, - int startMultiSelectIndex, int endMultiSelectIndex) { - int lastRow = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane).getRow(); - gridSelection.setLastRectangleBounds(Math.min(endMultiSelectIndex, startMultiSelectIndex), 0, Math.abs(startMultiSelectIndex - endMultiSelectIndex) + 1, lastRow); - } - - @Override - public void mouseReleased(MouseEvent e) { - super.mouseReleased(e); - int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); - int dragIndex = getDragIndex(e); - if (Math.abs(e.getX() - getLimit()) < FUZZY_EDGE && dragIndex >= 0) { - UNIT oldValue = this.getEditingElementCase().getColumnWidth(dragIndex); - this.getEditingElementCase().setColumnWidth(dragIndex, FU.valueOfPix(oldValue.toPixI(resolution) + getLimit() - e.getX(), resolution)); - } - this.getElementCasePane().repaint(); - } - -} diff --git a/designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitRowMouseHandler.java b/designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitRowMouseHandler.java deleted file mode 100644 index ac4a70eab..000000000 --- a/designer-realize/src/main/java/com/fr/design/fit/grid/GridLimitRowMouseHandler.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.fr.design.fit.grid; - -import com.fr.base.DynamicUnitList; -import com.fr.design.fit.DesignerUIModeConfig; -import com.fr.design.gui.imenu.UIPopupMenu; -import com.fr.design.mainframe.ElementCasePane; -import com.fr.grid.GridHeader; -import com.fr.grid.GridRow; -import com.fr.grid.GridUtils; -import com.fr.grid.selection.CellSelection; -import com.fr.grid.selection.Selection; -import com.fr.report.ReportHelper; -import com.fr.report.elementcase.ElementCase; -import com.fr.stable.ColumnRow; -import com.fr.stable.unit.FU; -import com.fr.stable.unit.UNIT; - -import javax.swing.SwingUtilities; -import java.awt.Dimension; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.event.MouseEvent; - -/** - * peter:处理对GridRow的Mouse事件. - */ -public class GridLimitRowMouseHandler extends GridHeaderWithBoundMouseHandler { - - public GridLimitRowMouseHandler(GridRow gridRow, int limit) { - super(gridRow, limit); - } - - @Override - protected void resetSelectionByRightButton(ColumnRow selectedCellPoint, Selection cs, ElementCasePane ePane) { - int[] selectedRows = cs.getSelectedRows(); - if (selectedRows.length == 0 - || selectedCellPoint.getRow() < selectedRows[0] - || selectedCellPoint.getRow() > selectedRows[selectedRows.length - 1]) { - resetGridSelectionBySelect(selectedCellPoint.getRow(), ePane); - } - } - - - protected int doChooseFrom() { - return CellSelection.CHOOSE_ROW; - } - - @Override - protected int getScrollValue(ElementCasePane casePane) { - return casePane.getGrid().getVerticalValue(); - } - - @Override - protected int getScrollExtent(ElementCasePane casePane) { - return casePane.getGrid().getVerticalExtent(); - } - - @Override - protected int getBeginValue(ElementCasePane casePane) { - return casePane.getGrid().getVerticalBeginValue(); - } - - @Override - protected Rectangle resetSelectedBoundsByShift(Rectangle editRectangle, ColumnRow selectedCellPoint, ElementCasePane reportPane) { - int tempOldSelectedCellY = editRectangle.y;// editRectangle.x; - - // ajust them to got the correct selected bounds. - if (selectedCellPoint.getRow() >= editRectangle.y) { - selectedCellPoint = ColumnRow.valueOf(selectedCellPoint.getColumn(), selectedCellPoint.getRow() + 1); - } else { - tempOldSelectedCellY++; - } - - int lastColumn = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane).getColumn(); - return new Rectangle(0, Math.min(tempOldSelectedCellY, selectedCellPoint.getRow()), - lastColumn, Math.max(editRectangle.height, Math.abs(tempOldSelectedCellY - selectedCellPoint.getRow()))); - } - - @Override - protected int[] getGridSelectionIndices(CellSelection cs) { - return cs.getSelectedRows(); - } - - @Override - protected int getColumnOrRowByGridHeader(ColumnRow selectedCellPoint) { - return selectedCellPoint.getRow(); - } - - - @Override - protected void resetGridSelectionBySelect(int row, ElementCasePane ePane) { - int lastColumn = GridUtils.getAdjustLastColumnRowOfReportPane(ePane).getColumn(); - CellSelection cellSelection = new CellSelection(0, row, lastColumn, 1); - cellSelection.setSelectedType(CellSelection.CHOOSE_ROW); - ePane.setSelection(cellSelection); - } - - /** - * Checks whether is on zero separator line. - */ - @Override - protected boolean isOnSeparatorLineIncludeZero(MouseEvent evt, double tmpHeight2, double tmpIncreaseHeight) { - return tmpIncreaseHeight <= 1 && (evt.getY() >= tmpHeight2 + 2 && evt.getY() <= tmpHeight2 + SEPARATOR_GAP); - } - - @Override - protected boolean between(MouseEvent evt, double from, double to) { - return evt.getY() > from && evt.getY() <= to; - } - - @Override - protected DynamicUnitList getSizeList(ElementCase elementCase) { - return ReportHelper.getRowHeightList(elementCase); - } - - @Override - protected String methodName() { - return "setRowHeight"; - } - - /** - * Checks whether is on normal separator line. - */ - @Override - protected boolean isOnNormalSeparatorLine(MouseEvent evt, double tmpHeight2) { - return (evt.getY() >= tmpHeight2 - 2) && (evt.getY() <= tmpHeight2 + 2); - } - - @Override - protected int evtOffset(MouseEvent evt, int offset) { - return evt.getY() - offset; - } - - @Override - protected String getSelectedHeaderTooltip(int rowSelectedCount) { - return rowSelectedCount + "R"; - } - - @Override - protected Point getTipLocationByMouseEvent(MouseEvent evt, GridHeader gHeader, Dimension tipPreferredSize) { - Point convertPoint = new Point(0, evt.getY()); - SwingUtilities.convertPointToScreen(convertPoint, gHeader); - - convertPoint.x = convertPoint.x + gHeader.getSize().width + 2; - convertPoint.y = convertPoint.y - tipPreferredSize.height / 2; - - return convertPoint; - } - - @Override - protected String nameOfMoveCursorGIF() { - return "cursor_vmove"; - } - - @Override - protected String nameOfSelectCursorGIF() { - return "cursor_vselect"; - } - - @Override - protected String nameOfSplitCursorGIF() { - return "cursor_vsplit"; - } - - @Override - protected UIPopupMenu createPopupMenu(ElementCasePane reportPane, - MouseEvent evt, int rowIndex) { - return ElementCasePaneUtil.createRowPopupMenu(reportPane, evt, rowIndex); - } - - @Override - protected void resetGridSelectionByDrag(CellSelection gridSelection, ElementCasePane reportPane, - int startMultiSelectIndex, int endMultiSelectIndex) { - int lastColumn = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane).getColumn(); - gridSelection.setLastRectangleBounds(0, Math.min(endMultiSelectIndex, startMultiSelectIndex), lastColumn, Math.abs(startMultiSelectIndex - endMultiSelectIndex) + 1); - - } - - @Override - public void mouseReleased(MouseEvent e) { - super.mouseReleased(e); - int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); - int dragIndex = getDragIndex(e); - if (Math.abs(e.getY() - getLimit()) < FUZZY_EDGE && dragIndex >= 0) { - UNIT oldValue = this.getEditingElementCase().getRowHeight(dragIndex); - this.getEditingElementCase().setRowHeight(dragIndex, FU.valueOfPix(oldValue.toPixI(resolution) + getLimit() - e.getY(), resolution)); - } - this.getElementCasePane().repaint(); - } -} diff --git a/designer-realize/src/main/java/com/fr/design/fit/grid/NewFormDesignerGridUI.java b/designer-realize/src/main/java/com/fr/design/fit/grid/NewFormDesignerGridUI.java deleted file mode 100644 index c3cc4f53d..000000000 --- a/designer-realize/src/main/java/com/fr/design/fit/grid/NewFormDesignerGridUI.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.fr.design.fit.grid; - -import com.fr.design.designer.creator.XElementCase; -import com.fr.design.fit.AdaptiveCellElementPainter; -import com.fr.design.fit.common.FormDesignerUtil; -import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.mainframe.FormDesigner; -import com.fr.grid.CellElementPainter; -import com.fr.grid.Grid; -import com.fr.grid.GridColumn; -import com.fr.grid.GridRow; -import com.fr.grid.GridUI; -import com.fr.report.elementcase.TemplateElementCase; -import com.fr.report.worksheet.FormElementCase; -import com.fr.stable.Constants; -import com.fr.stable.GraphDrawHelper; - -import javax.swing.JComponent; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Insets; -import java.awt.Rectangle; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; -import java.awt.event.MouseWheelListener; - - -/** - * Created by kerry on 2020-04-14 - */ -public class NewFormDesignerGridUI extends GridUI { - private GridLimitColumnMouseHandler gridColumnMouseHandler; - private GridLimitRowMouseHandler gridRowMouseHandler; - private AdaptiveGridListener adaptiveGridListener; - private FormDesigner designer; - - public NewFormDesignerGridUI(FormDesigner designer, int resolution) { - super(resolution); - this.designer = designer; - this.setCellElementPainter(new AdaptiveCellElementPainter()); - } - - public void setCellElementPainter(CellElementPainter elementPainter) { - this.painter = elementPainter; - } - - public void paint(Graphics g, JComponent c) { - Graphics2D g2d = (Graphics2D) g; - Grid grid = (Grid) c; - // 取得ElementCasePane.ElementCase - ElementCasePane elementCasePane = grid.getElementCasePane(); - final TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); - - super.paint(g, c); - - if (!(elementCase instanceof FormElementCase)) { - return; - } - final Rectangle rectangle = getBoundsLineRect(elementCase, grid); - int width = rectangle.width - columnWidthList.getRangeValue(0, horizontalValue).toPixI(resolution); - int height = rectangle.height - rowHeightList.getRangeValue(0, verticalValue).toPixI(resolution); - drawBoundsLine(g2d, width, height); - addListener(grid, elementCasePane, width, height, rectangle.width, rectangle.height); - } - - /** - * 获取需要画线的矩形大小 - */ - private Rectangle getBoundsLineRect(TemplateElementCase elementCase, Grid grid) { - final Rectangle rectangle = new Rectangle(); - XElementCase xElementCase = FormDesignerUtil.getXelementCase(designer.getRootComponent(), (FormElementCase) elementCase); - if (xElementCase != null) { - rectangle.setBounds(xElementCase.getBounds()); - - //减去内边距的宽和高 - Insets insets = xElementCase.getInsets(); - rectangle.width -= insets.left + insets.right; - rectangle.height -= insets.top + insets.bottom; - - } - return rectangle; - } - - - private void addListener(Grid grid, ElementCasePane elementCasePane, int width, int height, int actualWidth, int actualHeight) { - addGridColumnListener(elementCasePane.getGridColumn(), width); - addGridRowListener(elementCasePane.getGridRow(), height); - addMouseListener(grid, width, height, actualWidth, actualHeight); - } - - - private void drawBoundsLine(Graphics2D g2d, int width, int height) { - g2d.setPaint(Color.black); - g2d.setStroke(GraphDrawHelper.getStroke(Constants.LINE_DASH_DOT)); - g2d.drawLine(0, height, width, height); - g2d.drawLine(width, 0, width, height); - } - - private void removeGridColumnListener(GridColumn column) { - MouseMotionListener[] mouseMotionListeners = column.getMouseMotionListeners(); - for (MouseMotionListener mouseMotionListener : mouseMotionListeners) { - if (mouseMotionListener instanceof com.fr.grid.GridColumnMouseHandler || mouseMotionListener instanceof GridLimitColumnMouseHandler) { - column.removeMouseMotionListener(mouseMotionListener); - } - } - MouseListener[] mouseListeners = column.getMouseListeners(); - for (MouseListener motionListener : mouseListeners) { - if (motionListener instanceof com.fr.grid.GridColumnMouseHandler || motionListener instanceof GridLimitColumnMouseHandler) { - column.removeMouseListener(motionListener); - } - } - } - - private void removeGridRowListener(GridRow row) { - MouseMotionListener[] mouseMotionListeners = row.getMouseMotionListeners(); - for (MouseMotionListener mouseMotionListener : mouseMotionListeners) { - if (mouseMotionListener instanceof com.fr.grid.GridRowMouseHandler || mouseMotionListener instanceof GridLimitRowMouseHandler) { - row.removeMouseMotionListener(mouseMotionListener); - } - } - MouseListener[] mouseListeners = row.getMouseListeners(); - for (MouseListener motionListener : mouseListeners) { - if (motionListener instanceof com.fr.grid.GridRowMouseHandler || motionListener instanceof GridLimitRowMouseHandler) { - row.removeMouseListener(motionListener); - } - } - } - - private void removeGridListener(Grid grid) { - MouseMotionListener[] mouseMotionListeners = grid.getMouseMotionListeners(); - for (MouseMotionListener mouseMotionListener : mouseMotionListeners) { - if (mouseMotionListener instanceof AdaptiveGridListener) { - grid.removeMouseMotionListener(mouseMotionListener); - break; - } - } - MouseListener[] mouseListeners = grid.getMouseListeners(); - for (MouseListener motionListener : mouseListeners) { - if (motionListener instanceof AdaptiveGridListener) { - grid.removeMouseListener(motionListener); - break; - } - } - MouseWheelListener[] mouseWheelListeners = grid.getMouseWheelListeners(); - for (MouseWheelListener mouseWheelListener : mouseWheelListeners) { - if (mouseWheelListener instanceof AdaptiveGridListener) { - grid.removeMouseWheelListener(mouseWheelListener); - break; - } - } - } - - private void addGridColumnListener(GridColumn column, int width) { - if (gridColumnMouseHandler != null) { - gridColumnMouseHandler.setLimit(width); - return; - } - removeGridColumnListener(column); - gridColumnMouseHandler = new GridLimitColumnMouseHandler(column, width); - column.addMouseListener(gridColumnMouseHandler); - column.addMouseMotionListener(gridColumnMouseHandler); - } - - - private void addGridRowListener(GridRow row, int height) { - if (gridRowMouseHandler != null) { - gridRowMouseHandler.setLimit(height); - return; - } - removeGridRowListener(row); - gridRowMouseHandler = new GridLimitRowMouseHandler(row, height); - row.addMouseMotionListener(gridRowMouseHandler); - row.addMouseListener(gridRowMouseHandler); - } - - - private void addMouseListener(Grid grid, int width, int height, int actualWidth, int actualHeight) { - if (adaptiveGridListener != null) { - adaptiveGridListener.resetBoundInfo(width, height, actualWidth, actualHeight); - return; - } - removeGridListener(grid); - adaptiveGridListener = new AdaptiveGridListener(grid, width, height, actualWidth, actualHeight); - grid.addMouseMotionListener(adaptiveGridListener); - grid.addMouseListener(adaptiveGridListener); - grid.addMouseWheelListener(adaptiveGridListener); - } - -} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index befe413f9..30f7b1546 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -67,7 +67,6 @@ import com.fr.design.constants.UIConstants; import com.fr.design.designer.EditingState; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.fun.ElementUIProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIPopupMenu; @@ -226,7 +225,7 @@ public abstract class ElementCasePane extends Tar //todo 直接修改分辨率 if (this.resolution == 0) { - this.resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + this.resolution = ScreenResolution.getScreenResolution(); } this.initGridComponent(); @@ -352,10 +351,10 @@ public abstract class ElementCasePane extends Tar this.grid = new Grid(this.resolution); } if (this.gridColumn == null) { - this.gridColumn = new GridColumn(this.resolution); + this.gridColumn = new GridColumn(); } if (this.gridRow == null) { - this.gridRow = new GridRow(this.resolution); + this.gridRow = new GridRow(); } if (this.gridCorner == null) { this.gridCorner = new GridCorner(); @@ -1376,7 +1375,7 @@ public abstract class ElementCasePane extends Tar protected Selection selection; protected int verticalValue = 0; protected int horizontalValue = 0; - protected int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + protected int resolution = ScreenResolution.getScreenResolution(); protected ElementCaseEditingState(Selection selection, int verticalValue, int horizontalValue, int resolution) { try { 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 fa1fe93cd..ff14d54f4 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 @@ -55,7 +55,6 @@ import com.fr.design.module.DesignModuleFactory; import com.fr.design.parameter.ParameterDefinitePane; import com.fr.design.parameter.ParameterInputPane; import com.fr.design.preview.MobilePreview; -import com.fr.design.preview.PagePlusPreview; import com.fr.design.preview.PagePreview; import com.fr.design.preview.ViewPreview; import com.fr.design.preview.WriteEnhancePreview; @@ -919,7 +918,7 @@ public class JWorkBook extends JTemplate { public PreviewProvider[] supportPreview() { PreviewProvider[] templatePreviews = super.supportPreview(); return ArrayUtils.addAll(new PreviewProvider[]{ - new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview(), new MobilePreview(), new PagePlusPreview() + new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview(), new MobilePreview() }, templatePreviews); } @@ -1195,7 +1194,6 @@ public class JWorkBook extends JTemplate { protected void addChooseFILEFilter(FILEChooserPane fileChooser) { String appName = ProductConstants.APP_NAME; fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPT, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); - fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPTX, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); addExtraChooseFILEFilter(fileChooser); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java index 1a4f20c3d..87391a5a0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java @@ -18,9 +18,12 @@ import com.fr.stable.StringUtils; import com.fr.stable.bridge.StableFactory; import com.fr.stable.js.WidgetName; +import com.fr.util.ParameterApplyHelper; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; /** * @author zhou @@ -72,6 +75,18 @@ public class WorkBookModelAdapter extends DesignModelAdapter map = new HashMap<>(); + addGlobalParameters(map); + updateTableDataParameters(oldName, tdName, tableData, map, null); + addReportParameters(map); + parameters = map.values().toArray(new Parameter[0]); + jTemplate.updateReportParameterAttr(); + jTemplate.populateReportParameterAttr(); + + } + /** * 控件改变. */ @@ -107,9 +122,27 @@ public class WorkBookModelAdapter extends DesignModelAdapter map = new HashMap<>(); + addGlobalParameters(map); + + addTableDataParameters(map, null); + + addReportParameters(map); + + return map.values().toArray(new Parameter[0]); + } + + private void addReportParameters(Map map) { + // 添加模板参数 + ReportParameterAttr parameterAttr = this.getBook().getReportParameterAttr(); + if (parameterAttr != null) { + ParameterApplyHelper.addPara2Map(map, parameterAttr.getParameters()); + } } + + + /** * 返回控件的名字 * diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java index 23ddcbe8a..ec425847d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java @@ -4,7 +4,6 @@ import com.fr.design.mainframe.App; import com.fr.design.mainframe.JTemplateFactory; import com.fr.module.Activator; import com.fr.module.extension.Prepare; -import com.fr.nx.app.designer.CptxApp; import java.util.List; @@ -34,7 +33,7 @@ public class DesignerAppActivator extends Activator implements Prepare { @Override public void prepare() { - addMutable(App.KEY, new CptApp(), new CptxApp(), new FormApp(), new XlsApp(), new XlsxApp()); + addMutable(App.KEY, new CptApp(), new FormApp(), new XlsApp(), new XlsxApp()); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java index e9af09a4e..13c288f92 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java @@ -7,7 +7,6 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.ui.util.UIUtil; import com.fr.event.EventDispatcher; -import com.fr.nx.app.designer.cell.CellTreeAttrPanelProvider; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; @@ -20,10 +19,7 @@ import java.awt.BorderLayout; import java.awt.Component; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; -import java.util.LinkedHashSet; import java.util.List; -import java.util.Optional; import java.util.Set; import static com.fr.plugin.observer.PluginEventType.AfterRun; @@ -118,14 +114,14 @@ public class CellExpandExtraAttrPane extends JPanel { extras = new ArrayList<>(); } extras.clear(); - Set attrProviders = new LinkedHashSet<>(Collections.singletonList(new CellTreeAttrPanelProvider())); - Optional.>of(ExtraDesignClassManager.getInstance().getArray(CellExpandAttrPanelProvider.MARK_STRING)) - .ifPresent(attrProviders::addAll); - for (CellExpandAttrPanelProvider attrProvider : attrProviders) { - if (attrProvider.isDisplayable()) { - BasicBeanPane extra = attrProvider.createPanel(); - if (extra != null) { - extras.add(extra); + Set attrProviders = ExtraDesignClassManager.getInstance().getArray(CellExpandAttrPanelProvider.MARK_STRING); + if (attrProviders != null) { + for (CellExpandAttrPanelProvider attrProvider : attrProviders) { + if (attrProvider.isDisplayable()) { + BasicBeanPane extra = attrProvider.createPanel(); + if (extra != null) { + extras.add(extra); + } } } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java index dea5145ce..45c2fea61 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java @@ -13,7 +13,6 @@ import com.fr.design.designer.EditingState; import com.fr.design.designer.TargetComponent; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.AuthorityEditPane; @@ -138,9 +137,6 @@ public class FormElementCaseDesigner g.setColor(Color.WHITE); g.fillRect(0, 0, size.width, size.height); g.setColor(oldColor); - if (DesignerUIModeConfig.getInstance().newUIMode()) { - g.translate(-elementCasePane.getGridCorner().getWidth(), -elementCasePane.getGridCorner().getHeight()); - } this.elementCasePane.paintComponents(g); diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java index 3fe126879..d306bb179 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java @@ -310,9 +310,9 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { // 单元格组要记录下之前的选中情况 private CellSelection oriCellSelection = null; - private List newAdd = new ArrayList<>(); + private List newAdd = new ArrayList(); - private List oldAdd = new ArrayList<>(); + private List oldAdd = new ArrayList(); public SmartJTablePane4DB(KeyColumnTableModel model, ElementCasePane actionReportPane) { this(model, actionReportPane, false); @@ -433,8 +433,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { if (!allColumnRow.contains(columnRow.toString())) { add.addColumnRow(columnRow); } - // 重新更换区域框选单元格后 清理历史框选 - oldAdd.clear(); + } if (add.getSize() > 0) { @@ -460,11 +459,10 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { TemplateCellElement cellElement = ePane.getEditingElementCase().getTemplateCellElement(c + i, r + j); if (cellElement != null && ((i + c) != 0 || (r + j) != 0)) { String value = cellElement.toString(); - ColumnRow columnRow = ColumnRow.valueOf(value); - if (!newAdd.contains(columnRow) && !allColumnRow.contains(value)) { - add.addColumnRow(columnRow); + if (!newAdd.contains(value) && !allColumnRow.contains(value)) { + add.addColumnRow(ColumnRow.valueOf(value)); } - newAdd.add(columnRow); + newAdd.add(value); } if (cellElement == null) { @@ -472,14 +470,16 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { if (!allColumnRow.contains(columnRow.toString())) { add.addColumnRow(columnRow); } - newAdd.add(columnRow); + newAdd.add(columnRow.toString()); } } } - // 计算出前后两次选中的差值 - oldAdd.removeAll(newAdd); - // 移除差值部分 - newValue.removeAll(oldAdd); + int oldSize = oldAdd.size(); + int newSize = newAdd.size(); + if (oldSize > newSize && oldAdd.containsAll(newAdd)) { + int diff = oldSize - newSize; + newValue.splice(newValue.getSize() - diff, diff); + } oldAdd.clear(); oldAdd.addAll(newAdd); } diff --git a/designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java b/designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java index b04e4ad1e..349503bd7 100644 --- a/designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java +++ b/designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java @@ -2,12 +2,13 @@ package com.fr.grid; import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; +import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.unit.UnitConvertUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.FloatSelection; @@ -38,7 +39,7 @@ import java.lang.reflect.Method; public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter { protected static final int SEPARATOR_GAP = 5; - protected GridHeader gHeader; + private GridHeader gHeader; private int dragType = GridUtils.DRAG_NONE; //james 是否为选定多行的drag private boolean isMultiSelectDragPermited = false; @@ -50,7 +51,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter { private int dragIndex = 0; private JToolTip tip = null; private JWindow tipWindow = null; - protected int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + protected int resolution = ScreenResolution.getScreenResolution(); public AbstractGridHeaderMouseHandler(GridHeader gHeader) { this.gHeader = gHeader; @@ -306,7 +307,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter { // int resolution = ScreenResolution.getScreenResolution(); FU ulen = FU.valueOfPix((int) doubleValue, resolution); FU tulen = FU.valueOfPix((int) totalDoubleValue, resolution); - ReportLengthUNITProvider lengthUNIT = DesignerUIModeConfig.getInstance().parseLengthUNIT(unitType); + ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); String unit = lengthUNIT.unitText(); double len = lengthUNIT.unit2Value4Scale(ulen); double tlen = lengthUNIT.unit2Value4Scale(tulen); diff --git a/designer-realize/src/main/java/com/fr/grid/DefaultGridUIProcessor.java b/designer-realize/src/main/java/com/fr/grid/DefaultGridUIProcessor.java index 0b4c900e3..65b6aa456 100644 --- a/designer-realize/src/main/java/com/fr/grid/DefaultGridUIProcessor.java +++ b/designer-realize/src/main/java/com/fr/grid/DefaultGridUIProcessor.java @@ -1,24 +1,16 @@ package com.fr.grid; -import com.fr.design.fit.DesignerUIModeConfig; -import com.fr.design.fit.grid.NewFormDesignerGridUI; import com.fr.design.fun.impl.AbstractGridUIProcessor; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.WidgetPropertyPane; import javax.swing.plaf.ComponentUI; /** * Created by Administrator on 2016/6/28/0028. */ -public class DefaultGridUIProcessor extends AbstractGridUIProcessor { +public class DefaultGridUIProcessor extends AbstractGridUIProcessor{ @Override public ComponentUI appearanceForGrid(int resolution) { - if (DesignerUIModeConfig.getInstance().newUIMode()) { - FormDesigner designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - return new NewFormDesignerGridUI(designer, resolution); - } return new GridUI(resolution); } diff --git a/designer-realize/src/main/java/com/fr/grid/GridColumn.java b/designer-realize/src/main/java/com/fr/grid/GridColumn.java index eed4136d4..8ba6484bc 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridColumn.java +++ b/designer-realize/src/main/java/com/fr/grid/GridColumn.java @@ -6,10 +6,14 @@ package com.fr.grid; import java.awt.Dimension; import com.fr.base.GraphHelper; -import com.fr.design.fit.DesignerUIModeConfig; +import com.fr.base.ScreenResolution; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.GridUIProcessor; import com.fr.design.mainframe.ElementCasePane; import com.fr.stable.StableUtils; +import javax.swing.plaf.ComponentUI; + /** * GridColumn used to paint and edit grid column. * @@ -18,23 +22,20 @@ import com.fr.stable.StableUtils; */ public class GridColumn extends GridHeader { + public int resolution = ScreenResolution.getScreenResolution(); private GridColumnMouseHandler gridColumnMouseHandler; - public GridColumn(int resolution) { - super(resolution); - } - @Override protected void initByConstructor() { + resolution = ScreenResolution.getScreenResolution(); + this.setResolution(resolution); gridColumnMouseHandler = new GridColumnMouseHandler(this); this.addMouseListener(gridColumnMouseHandler); this.addMouseMotionListener(gridColumnMouseHandler); this.updateUI(); } - - @Override public String getDisplay(int index) { return StableUtils.convertIntToABC(index + 1); @@ -47,16 +48,26 @@ public class GridColumn extends GridHeader { gridColumnMouseHandler = new GridColumnMouseHandler(this); this.addMouseListener(gridColumnMouseHandler); this.addMouseMotionListener(gridColumnMouseHandler); +// gridColumnMouseHandler.setResolution(resolution); this.setUI(new GridColumnUI(resolution)); } + public void setResolution(int resolution) { + this.resolution = resolution; + } + + @Override + public int getResolution() { + return this.resolution; + } + /** * Gets the preferred size. */ @Override public Dimension getPreferredSize() { ElementCasePane reportPane = this.getElementCasePane(); - float time = (float)reportPane.getResolution()/ DesignerUIModeConfig.getInstance().getScreenResolution(); + float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); if (!reportPane.isColumnHeaderVisible()) { return new Dimension(0, 0); } diff --git a/designer-realize/src/main/java/com/fr/grid/GridColumnMouseHandler.java b/designer-realize/src/main/java/com/fr/grid/GridColumnMouseHandler.java index bc5b54c90..09ad45d32 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridColumnMouseHandler.java +++ b/designer-realize/src/main/java/com/fr/grid/GridColumnMouseHandler.java @@ -7,7 +7,9 @@ import java.awt.Toolkit; import java.awt.event.MouseEvent; import javax.swing.SwingUtilities; + import com.fr.base.DynamicUnitList; +import com.fr.base.ScreenResolution; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.ElementCasePane; import com.fr.grid.selection.CellSelection; @@ -21,6 +23,8 @@ import com.fr.stable.ColumnRow; */ public class GridColumnMouseHandler extends AbstractGridHeaderMouseHandler { + private int resolution; + public GridColumnMouseHandler(GridColumn gridColumn) { super(gridColumn); this.resolution = gridColumn.resolution; diff --git a/designer-realize/src/main/java/com/fr/grid/GridColumnUI.java b/designer-realize/src/main/java/com/fr/grid/GridColumnUI.java index 088c8f220..d3e90308b 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridColumnUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridColumnUI.java @@ -16,7 +16,6 @@ import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; import com.fr.cache.list.IntList; import com.fr.design.constants.UIConstants; -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.grid.selection.Selection; @@ -34,7 +33,7 @@ public class GridColumnUI extends ComponentUI { public GridColumnUI(int resolution){ if (resolution == 0){ - resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + resolution = ScreenResolution.getScreenResolution(); } this.resolution = resolution; } @@ -50,7 +49,7 @@ public class GridColumnUI extends ComponentUI { Grid gird = reportPane.getGrid(); // size Dimension size = gridColumn.getSize(); - float time = (float)resolution/DesignerUIModeConfig.getInstance().getScreenResolution(); + float time = (float)resolution/ScreenResolution.getScreenResolution(); g2d.setFont(gridColumn.getFont().deriveFont(gridColumn.getFont().getSize2D() * time)); ElementCase elementCase = reportPane.getEditingElementCase(); @@ -162,7 +161,7 @@ public class GridColumnUI extends ComponentUI { columnContent += "(FR)"; } } - float time = (float)resolution/DesignerUIModeConfig.getInstance().getScreenResolution(); + float time = (float)resolution/ScreenResolution.getScreenResolution(); double stringWidth = gridColumn.getFont().getStringBounds(columnContent, fontRenderContext).getWidth() * time; if (stringWidth > tmpIncreaseWidth) { diff --git a/designer-realize/src/main/java/com/fr/grid/GridCorner.java b/designer-realize/src/main/java/com/fr/grid/GridCorner.java index 4d1d393b7..f2dd43d5e 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridCorner.java +++ b/designer-realize/src/main/java/com/fr/grid/GridCorner.java @@ -6,7 +6,6 @@ package com.fr.grid; import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; import com.fr.design.constants.UIConstants; -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.mainframe.ElementCasePane; import javax.swing.event.MouseInputListener; @@ -36,7 +35,7 @@ public class GridCorner extends BaseGridComponent { Graphics2D g2d = (Graphics2D) g; ElementCasePane reportPane = this.getElementCasePane(); - float time = (float) reportPane.getResolution() / DesignerUIModeConfig.getInstance().getScreenResolution(); + float time = (float) reportPane.getResolution() / ScreenResolution.getScreenResolution(); //size Dimension size = this.getSize(); Rectangle2D rect2D = new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()); diff --git a/designer-realize/src/main/java/com/fr/grid/GridHeader.java b/designer-realize/src/main/java/com/fr/grid/GridHeader.java index ec974b197..9a4a1b949 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridHeader.java +++ b/designer-realize/src/main/java/com/fr/grid/GridHeader.java @@ -15,8 +15,7 @@ public abstract class GridHeader extends BaseGridComponent { protected int resolution; - public GridHeader(int resolution) { - this.resolution = resolution; + public GridHeader() { //清除所有的Key Action. this.getInputMap().clear(); this.getActionMap().clear(); 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 060bc2ace..b0f91a902 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -6,7 +6,6 @@ import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.constants.UIConstants; -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.ElementCasePane; @@ -74,7 +73,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous private int ECBlockGap = 40; - private int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + private int resolution = ScreenResolution.getScreenResolution(); protected GridMouseAdapter(Grid grid) { this.grid = grid; diff --git a/designer-realize/src/main/java/com/fr/grid/GridRow.java b/designer-realize/src/main/java/com/fr/grid/GridRow.java index a85c3c398..7dbb4af3a 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridRow.java +++ b/designer-realize/src/main/java/com/fr/grid/GridRow.java @@ -8,7 +8,6 @@ import java.awt.Dimension; import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; import com.fr.design.ExtraDesignClassManager; -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.fun.GridUIProcessor; import com.fr.design.mainframe.ElementCasePane; @@ -23,14 +22,13 @@ import javax.swing.plaf.ComponentUI; public class GridRow extends GridHeader { private static final int MAX = 4; + private int resolution = ScreenResolution.getScreenResolution(); private GridRowMouseHandler gridRowMouseHandler; - public GridRow(int resolution) { - super(resolution); - } - @Override protected void initByConstructor() { + resolution = ScreenResolution.getScreenResolution(); + this.setResolution(resolution); gridRowMouseHandler = new GridRowMouseHandler(this); this.addMouseListener(gridRowMouseHandler); this.addMouseMotionListener(gridRowMouseHandler); @@ -52,6 +50,14 @@ public class GridRow extends GridHeader { this.setUI(new GridRowUI(resolution)); } + public void setResolution(int resolution) { + this.resolution = resolution; + } + + public int getResolution() { + return this.resolution; + } + /** * Gets the preferred size. @@ -59,7 +65,7 @@ public class GridRow extends GridHeader { @Override public Dimension getPreferredSize() { ElementCasePane reportPane = this.getElementCasePane(); - float time = (float)reportPane.getResolution()/ DesignerUIModeConfig.getInstance().getScreenResolution(); + float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); if (!(reportPane.isRowHeaderVisible())) { return new Dimension(0, 0); } diff --git a/designer-realize/src/main/java/com/fr/grid/GridRowUI.java b/designer-realize/src/main/java/com/fr/grid/GridRowUI.java index 6c2fed6d0..a0245a3d8 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridRowUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridRowUI.java @@ -7,8 +7,6 @@ import java.awt.geom.Rectangle2D; import javax.swing.JComponent; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; - -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.stable.AssistUtils; import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; @@ -34,7 +32,7 @@ public class GridRowUI extends ComponentUI { GridRowUI(int resolution){ if (resolution == 0){ - resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + resolution = ScreenResolution.getScreenResolution(); } this.resolution = resolution; } @@ -49,7 +47,7 @@ public class GridRowUI extends ComponentUI { ElementCasePane reportPane = gridRow.getElementCasePane(); // size Dimension size = gridRow.getSize(); - float time = (float)resolution/DesignerUIModeConfig.getInstance().getScreenResolution(); + float time = (float)resolution/ScreenResolution.getScreenResolution(); g2d.setFont(gridRow.getFont().deriveFont(gridRow.getFont().getSize2D() * time)); ElementCase elementCase = reportPane.getEditingElementCase(); @@ -158,7 +156,7 @@ public class GridRowUI extends ComponentUI { , ElementCase elementCase, Dimension size, double tmpHeight1) { // FontMetrics FontRenderContext fontRenderContext = g2d.getFontRenderContext(); - float time = (float)resolution/DesignerUIModeConfig.getInstance().getScreenResolution(); + float time = (float)resolution/ScreenResolution.getScreenResolution(); float fmAscent = GraphHelper.getFontMetrics(gridRow.getFont()).getAscent() * time; double stringWidth = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getWidth() * time; double stringHeight = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getHeight() * time; diff --git a/designer-realize/src/main/java/com/fr/grid/GridUtils.java b/designer-realize/src/main/java/com/fr/grid/GridUtils.java index 31ceacd7a..80e6f3ff5 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUtils.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUtils.java @@ -5,7 +5,6 @@ import com.fr.base.ScreenResolution; import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.FloatElementsClip; -import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; @@ -125,7 +124,7 @@ public class GridUtils { */ public static double[] caculateFloatElementLocations(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList, int verticalValue, int horizentalValue) { - int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + int resolution = ScreenResolution.getScreenResolution(); double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution); double floatY = rowHeightList.getRangeValue(verticalValue, 0).toPixD(resolution) + floatElement.getTopDistance().toPixD(resolution); @@ -178,7 +177,7 @@ public class GridUtils { private static int cc_selected_column_or_row(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList) { double tmpIntIndex = 0; int selectedCellIndex = 0; - int resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + int resolution = ScreenResolution.getScreenResolution(); if (mouseEvtPosition < 0) { selectedCellIndex = value; for (; true; selectedCellIndex--) { diff --git a/designer-realize/src/main/java/com/fr/nx/app/designer/CptxApp.java b/designer-realize/src/main/java/com/fr/nx/app/designer/CptxApp.java deleted file mode 100644 index 9186a6734..000000000 --- a/designer-realize/src/main/java/com/fr/nx/app/designer/CptxApp.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.fr.nx.app.designer; - -import com.fr.base.extension.FileExtension; -import com.fr.design.mainframe.AbstractAppProvider; -import com.fr.design.mainframe.JTemplate; -import com.fr.file.FILE; -import com.fr.main.impl.WorkBook; -import com.fr.nx.app.designer.utils.DesignerCptxFileUtils; - -/** - * 支持设计器打开cptx文件 - */ -public class CptxApp extends AbstractAppProvider { - - public CptxApp() { - StartupAssist.initDesignModule(); - } - - @Override - public String[] defaultExtensions() { - return new String[]{FileExtension.CPTX.getExtension()}; - } - - @Override - public void process() { - super.process(); - StartupAssist.reloadTemplate(); - } - - /** - * 该方法只是为了读到cptx中的cpt - * - * @param tplFile file - * @return template - */ - @Override - public JTemplate openTemplate(FILE tplFile) { - WorkBook workBook = DesignerCptxFileUtils.getWorkBook(tplFile); - if (workBook == null) { - workBook = new WorkBook(); - } - return new JStreamBook(workBook, tplFile); - } - - @Override - public WorkBook asIOFile(FILE file) { - WorkBook workBook = DesignerCptxFileUtils.getWorkBook(file); - if (workBook == null) { - workBook = new WorkBook(); - } - return workBook; - } -} diff --git a/designer-realize/src/main/java/com/fr/nx/app/designer/JStreamBook.java b/designer-realize/src/main/java/com/fr/nx/app/designer/JStreamBook.java deleted file mode 100644 index 2fa748f95..000000000 --- a/designer-realize/src/main/java/com/fr/nx/app/designer/JStreamBook.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.fr.nx.app.designer; - -import com.fr.base.extension.FileExtension; -import com.fr.design.actions.file.export.CSVExportAction; -import com.fr.design.actions.file.export.PDFExportAction; -import com.fr.design.actions.file.export.SVGExportAction; -import com.fr.design.actions.file.export.TextExportAction; -import com.fr.design.actions.file.export.WordExportAction; -import com.fr.design.mainframe.JWorkBook; -import com.fr.design.menu.MenuDef; -import com.fr.design.menu.ShortCut; -import com.fr.file.FILE; -import com.fr.general.ComparatorUtils; -import com.fr.locale.InterProviderFactory; -import com.fr.log.FineLoggerFactory; -import com.fr.main.impl.WorkBook; -import com.fr.nx.app.designer.utils.DesignerCptxFileUtils; -import com.fr.nx.cptx.entry.metadata.CptxMetadata; -import com.fr.nx.app.designer.menu.CalculateAttrAction; -import com.fr.nx.app.designer.toolbar.TemplateTransformer; -import com.fr.nx.app.designer.toolbar.TransformResult; -import com.fr.nx.app.designer.toolbar.TransformResultInfo; -import com.fr.stable.StringUtils; -import com.fr.stable.project.ProjectConstants; -import com.fr.third.jodd.util.ArraysUtil; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; - -public class JStreamBook extends JWorkBook { - - - public JStreamBook(WorkBook workBook, FILE file) { - super(workBook, file); - } - - @Override - protected boolean saveFile() { - boolean saved; - TransformResultInfo resultInfo = TemplateTransformer.compileCPTX(getTarget(), getEditingFILE()); - saved = resultInfo.isSaved(); - this.setSaved(saved); - if (saved) { - this.fireJTemplateSaved(); - } - return saved; - } - - @Override - protected boolean saveToNewFile(String oldName) { - String path = this.getEditingFILE().getPath(); - try { - if (!path.startsWith(ProjectConstants.REPORTLETS_NAME)) { - File file = new File(path); - if (file.getParentFile() != null && !file.getParentFile().exists()) { - file.getParentFile().mkdirs(); - } - file.createNewFile(); - OutputStream outputStream = new FileOutputStream(file); - this.getTarget().export(outputStream); - return true; - }else { - TransformResult result; - if (FileExtension.CPT.matchExtension(path)) { - result = TemplateTransformer.TO_CPT.transform(this); - } else { - result = TemplateTransformer.TO_CPTX.transform(this); - } - return ComparatorUtils.equals(TransformResult.SUCCESS, result); - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return false; - } - - - /** - * 保存文件的后缀名 - * - * @return 后缀的字符串 - */ - @Override - public String suffix() { - return ".cptx"; - } - - @Override - protected void addShortCut(MenuDef exportMenuDef, MenuDef excelExportMenuDef) { - exportMenuDef.addShortCut(excelExportMenuDef, new PDFExportAction(this), new WordExportAction(this), new SVGExportAction(this), - new CSVExportAction(this), new TextExportAction(this)); - } - - - @Override - public String getPath() { - return getEditingFILE().getPath() + getSuffix(); - } - - public String getTemplateName() { - return getEditingFILE().getName() + getSuffix(); - } - - private String getSuffix() { - CptxMetadata metadata = DesignerCptxFileUtils.getMetadata(this.getEditingFILE()); - if (metadata != null && metadata.isForceCpt()) { - return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Compatibility_Mode"); - } - return StringUtils.EMPTY; - } - - @Override - public ShortCut[] shortcut4TemplateMenu() { - return ArraysUtil.insert(super.shortcut4TemplateMenu(), new CalculateAttrAction(this), 5); - } -} diff --git a/designer-realize/src/main/java/com/fr/nx/app/designer/StartupAssist.java b/designer-realize/src/main/java/com/fr/nx/app/designer/StartupAssist.java deleted file mode 100644 index be4d9ddc8..000000000 --- a/designer-realize/src/main/java/com/fr/nx/app/designer/StartupAssist.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.fr.nx.app.designer; - -import com.fr.base.Parameter; -import com.fr.base.extension.FileExtension; -import com.fr.common.annotations.Negative; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.JTemplateFactory; -import com.fr.design.module.DesignModuleFactory; -import com.fr.design.parameter.AbstractParameterReader; -import com.fr.design.ui.util.UIUtil; -import com.fr.log.FineLoggerFactory; -import com.fr.main.impl.WorkBook; -import com.fr.nx.cptx.CptxIOManager; -import com.fr.nx.cptx.io.handle.CptxTemplateHandle; - -/** - * 保证设计器默认 cptx 启动正常 - * - * @author yaohwu - * created by yaohwu at 2020/6/5 16:28 - */ -public class StartupAssist { - - public static void initDesignModule() { - DesignModuleFactory.registerParameterReader(new AbstractParameterReader() { - @Override - public Parameter[] readParameterFromPath(String tplPath) { - if (accept(tplPath, FileExtension.CPTX.getSuffix())) { - try { - CptxTemplateHandle handle = CptxIOManager.open(tplPath); - WorkBook book = handle.getTemplate().getLegacyWorkBook(); - return book.getParameters(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - return new Parameter[0]; - } - } - return null; - } - }); - } - - private static void reload() { - JTemplate old = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - JTemplate template = JTemplateFactory.createJTemplate(old.getEditingFILE()); - DesignerContext.getDesignerFrame().addAndActivateJTemplate(template); - HistoryTemplateListCache.getInstance().setCurrentEditingTemplate(template); - } - - /** - * 主代码修复后就可以删除了 - * - * 主代码任务链接 - */ - @Negative(until = "2021-09-01") - public static void reloadTemplate() { - if (isCptxJTemplate()) { - UIUtil.invokeLaterIfNeeded(() -> { - reload(); - DesignerContext.getDesignerFrame().setVisible(true); - DesignerContext.getDesignerFrame().resizeFrame(); - }); - } - } - - private static boolean isCptxJTemplate() { - JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - String path; - return jTemplate != null && - (path = jTemplate.getPath()) != null - && path.endsWith(FileExtension.CPTX.getExtension()); - } -} diff --git a/designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanel.java b/designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanel.java deleted file mode 100644 index fcab8a861..000000000 --- a/designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanel.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.fr.nx.app.designer.cell; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.event.UIObserverListener; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.MultilineLabel; -import com.fr.design.mainframe.CellWidgetPropertyPane; -import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.mainframe.JTemplate; -import com.fr.form.ui.Widget; -import com.fr.locale.InterProviderFactory; -import com.fr.report.cell.TemplateCellElement; -import com.fr.report.web.button.form.TreeNodeToggleButton; - -import java.awt.BorderLayout; -import java.awt.Color; - -/** - * @author yaohwu - * created by yaohwu at 2020/4/26 16:33 - */ -public class CellTreeAttrPanel extends BasicBeanPane { - private static final Color TIP_COLOR = new Color(0x8f8f92); - - private TemplateCellElement cellElement = null; - - private final UICheckBox showAsTreeNodeCheckBox; - - private final UIObserverListener listener = new UIObserverListener() { - @Override - public void doChange() { - JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (template != null) { - if (CellTreeAttrPanel.this.cellElement != null) { - CellTreeAttrPanel.this.updateBean(); - } - template.fireTargetModified(); - CellWidgetPropertyPane.getInstance().populate((ElementCasePane) template.getCurrentElementCasePane()); - } - } - }; - - private static final class Holder { - private static final CellTreeAttrPanel INSTANCE = new CellTreeAttrPanel(); - } - - public static CellTreeAttrPanel getInstance() { - return Holder.INSTANCE; - } - - private CellTreeAttrPanel() { - this.setLayout(new BorderLayout()); - showAsTreeNodeCheckBox = - new UICheckBox(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Cell_Show_As_Tree_Node")); - this.add(showAsTreeNodeCheckBox, BorderLayout.NORTH); - MultilineLabel multilineLabel = - new MultilineLabel(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Cell_Show_As_Tree_Node_TIP")); - multilineLabel.setForeground(TIP_COLOR); - this.add(multilineLabel, BorderLayout.CENTER); - } - - /** - * 展示数据 - * - * @param ob 待展示的对象 - */ - @Override - public void populateBean(TemplateCellElement ob) { - this.cellElement = ob; - Widget widget = cellElement.getWidget(); - showAsTreeNodeCheckBox.registerChangeListener(null); - showAsTreeNodeCheckBox.setSelected(widget instanceof TreeNodeToggleButton); - showAsTreeNodeCheckBox.registerChangeListener(listener); - } - - /** - * 保存数据 - * - * @return 待保存的对象 - */ - @Override - public TemplateCellElement updateBean() { - if (this.cellElement == null) { - return null; - } - if (showAsTreeNodeCheckBox.isSelected()) { - cellElement.setWidget(createTreeToggleButton()); - } else { - cellElement.setWidget(null); - } - return this.cellElement; - } - - @Override - public void updateBean(TemplateCellElement ob) { - this.cellElement = ob; - updateBean(); - } - - @Override - protected String title4PopupWindow() { - return ""; - } - - private TreeNodeToggleButton createTreeToggleButton() { - return new TreeNodeToggleButton(); - } -} diff --git a/designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanelProvider.java b/designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanelProvider.java deleted file mode 100644 index e50e9309a..000000000 --- a/designer-realize/src/main/java/com/fr/nx/app/designer/cell/CellTreeAttrPanelProvider.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fr.nx.app.designer.cell; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.fun.impl.AbstractCellExpandAttrPanelProvider; -import com.fr.design.mainframe.JTemplate; -import com.fr.nx.app.designer.JStreamBook; -import com.fr.report.cell.TemplateCellElement; - -/** - * @author yaohwu - * created by yaohwu at 2020/4/26 16:32 - */ -public class CellTreeAttrPanelProvider extends AbstractCellExpandAttrPanelProvider { - - @Override - public BasicBeanPane createPanel() { - return CellTreeAttrPanel.getInstance(); - } - - /** - * 只有新引擎 cptx 模版才展示 - * 先注释掉Override,适配老的主jar,保留这个方法是为了在新主jar下支持这个功能 - */ - // @Override - public boolean isDisplayable() { - JTemplate current = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - return current instanceof JStreamBook; - } -} diff --git a/designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrAction.java b/designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrAction.java deleted file mode 100644 index d318f725a..000000000 --- a/designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrAction.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.fr.nx.app.designer.menu; - -import com.fr.base.BaseUtils; -import com.fr.design.actions.JTemplateAction; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.dialog.UIDialog; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.menu.MenuKeySet; -import com.fr.locale.InterProviderFactory; -import com.fr.main.impl.WorkBook; -import com.fr.nx.app.designer.JStreamBook; -import com.fr.plugin.attr.CalculatorAttrMark; - -import javax.swing.KeyStroke; -import java.awt.event.ActionEvent; - -public class CalculateAttrAction extends JTemplateAction { - - public CalculateAttrAction(JStreamBook jTemplate) { - super(jTemplate); - initMenuStyle(); - } - - private void initMenuStyle() { - this.setMenuKeySet(CALCULATE_FIT_ATTR); - this.setName(getMenuKeySet().getMenuKeySetName() + "..."); - this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/center.png")); - } - - /** - * Action触发事件 - * - * @param e 事件 - */ - public void actionPerformed(ActionEvent e) { - final JStreamBook jwb = getEditingComponent(); - if (jwb == null) { - return; - } - WorkBook workBook = jwb.getTarget(); - CalculatorAttrMark mark = workBook.getAttrMark(CalculatorAttrMark.MARK); - CalculateAttrPane attrPane = new CalculateAttrPane(); - showReportFitDialog(mark, jwb, workBook, attrPane); - } - - private void showReportFitDialog(CalculatorAttrMark mark, final JStreamBook jwb, final WorkBook workBook, final BasicBeanPane attrPane) { - attrPane.populateBean(mark); - UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - @Override - public void doOk() { - workBook.addAttrMark(attrPane.updateBean()); - jwb.fireTargetModified(); - } - }); - dialog.setVisible(true); - } - - private static final MenuKeySet CALCULATE_FIT_ATTR = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'C'; - } - - @Override - public String getMenuName() { - return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Attr"); - } - - @Override - public KeyStroke getKeyStroke() { - return null; - } - }; -} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrPane.java b/designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrPane.java deleted file mode 100644 index a0f53c938..000000000 --- a/designer-realize/src/main/java/com/fr/nx/app/designer/menu/CalculateAttrPane.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.fr.nx.app.designer.menu; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.ActionLabel; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.locale.InterProviderFactory; -import com.fr.nx.app.designer.menu.bean.FeatureFlagBean; -import com.fr.nx.feature.FeatureFlags; -import com.fr.nx.feature.FeatureManager; -import com.fr.plugin.attr.CalculatorAttrMark; - -import javax.swing.BorderFactory; -import javax.swing.BoxLayout; -import javax.swing.JDialog; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Font; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; - -public class CalculateAttrPane extends BasicBeanPane { - - private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92); - - // private UICheckBox calculateEnd; - private UICheckBox queryCache; - - private UICheckBox treeAsyncQuery; - - private UICheckBox multiSourceMode; - - private UISpinner treeExpandLayer; - - private JPanel treeConfigPanel; - - /** - * 当前模版从未设置过模版计算属性 - */ - private boolean isEmptyAttr = false; - - public CalculateAttrPane() { - initComponents(); - } - - private void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - - JPanel featureFlagPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); - ActionLabel featureLabel = new ActionLabel(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Experimental_Feature")); - featureLabel.setFont(new Font(null, Font.PLAIN, 10)); - featureLabel.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JDialog wDialog = createJDialog(); - wDialog.setVisible(true); - } - }); - featureFlagPanel.add(featureLabel); - - JPanel calculateAttrPanel = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - calculateAttrPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0)); - -// JPanel calculatedEndPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); -// calculateEnd = new UICheckBox(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Calculate-End")); -// calculatedEndPanel.add(calculateEnd); - JPanel queryCachePanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - queryCache = new UICheckBox(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Calculate_Query_Cache")); - queryCachePanel.add(queryCache); - JPanel multiSourcePanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - multiSourceMode = new UICheckBox(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Feature_Multi_Source")); - multiSourcePanel.add(multiSourceMode); - -// calculateAttrPanel.add(calculatedEndPanel); - calculateAttrPanel.add(queryCachePanel); - calculateAttrPanel.add(multiSourcePanel); - - - treeConfigPanel = FRGUIPaneFactory.createTitledBorderPane( - InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Tree_Config") - ); - treeConfigPanel.setVisible(FeatureManager.getInstance().isFlagEnable(FeatureFlags.TREE)); - treeConfigPanel.setLayout(new BoxLayout(treeConfigPanel, BoxLayout.Y_AXIS)); - - JPanel treeAsyncQueryPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - treeAsyncQuery = new UICheckBox(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Tree_Async_Query")); - treeAsyncQueryPanel.add(treeAsyncQuery); - - JPanel treeExpandLayerPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - UILabel treeExpandLayerLabel = new UILabel(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Tree_Expand_Layer")); - treeExpandLayer = new UISpinner(1, Integer.MAX_VALUE, 1, 1); - // 功能不支持,设置先禁用 - treeExpandLayer.setEnabled(false); - - treeExpandLayerPanel.add(treeExpandLayerLabel); - treeExpandLayerPanel.add(treeExpandLayer); - - JPanel treeExpandLayerLabelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - UILabel multilineLabel = new UILabel(InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Tree_Expand_Layer_Label")); - multilineLabel.setForeground(TIPS_FONT_COLOR); - treeExpandLayerLabelPanel.add(multilineLabel); - - - treeConfigPanel.add(treeAsyncQueryPanel); - treeConfigPanel.add(treeExpandLayerPanel); - treeConfigPanel.add(treeExpandLayerLabelPanel); - - List components = new ArrayList<>(); - components.add(new Component[]{featureFlagPanel}); - components.add(new Component[]{calculateAttrPanel}); - components.add(new Component[]{treeConfigPanel}); - - JPanel content = - TableLayoutHelper.createGapTableLayoutPane( - components.toArray(new Component[0][]), - TableLayoutHelper.FILL_LASTCOLUMN, - 5, - 5 - ); - - this.add(content, BorderLayout.CENTER); - } - - @Override - public void populateBean(CalculatorAttrMark attrMark) { - if (attrMark == null) { - isEmptyAttr = true; - // 默认折叠树配置 - treeAsyncQuery.setSelected(FeatureManager.getInstance().isFlagEnable(FeatureFlags.TREE_ASYNC)); - return; - } -// calculateEnd.setSelected(attrMark.isCalculateEnd()); - queryCache.setSelected(attrMark.isQueryCache()); - treeAsyncQuery.setSelected(attrMark.isTreeAsyncQuery()); - treeExpandLayer.setValue(attrMark.getTreeExpandLayer()); - multiSourceMode.setSelected(attrMark.isUseMultiSourceMode()); - isEmptyAttr = false; - } - - - /** - * 提交数据 - * - * @return 界面上的更新数据 - */ - @Override - public CalculatorAttrMark updateBean() { - return new CalculatorAttrMark(false, queryCache.isSelected()) - .treeAsyncQuery(treeAsyncQuery.isSelected()) - .treeExpandLayer((int) treeExpandLayer.getValue()) - .useMultiSourceMode(multiSourceMode.isSelected()); - } - - /** - * 标题 - * - * @return 标题 - */ - @Override - protected String title4PopupWindow() { - return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine-Attr"); - } - - private void showFeatureConfigPane() { - treeConfigPanel.setVisible(FeatureManager.getInstance().isFlagEnable(FeatureFlags.TREE)); - } - - private void resetTreeAsyncConfigPane() { - if (isEmptyAttr) { - treeAsyncQuery.setSelected(FeatureManager.getInstance().isFlagEnable(FeatureFlags.TREE_ASYNC)); - } - } - - - private JDialog createJDialog() { - final FeatureFlagsPanel panel = new FeatureFlagsPanel(); - panel.populateBean(new FeatureFlagBean()); - return panel.showSmallWindow(SwingUtilities.getWindowAncestor(CalculateAttrPane.this), new DialogActionAdapter() { - @Override - public void doOk() { - panel.updateBean().saveModification(); - super.doOk(); - CalculateAttrPane.this.resetTreeAsyncConfigPane(); - CalculateAttrPane.this.showFeatureConfigPane(); - CalculateAttrPane.this.revalidate(); - CalculateAttrPane.this.repaint(); - } - }); - } -} diff --git a/designer-realize/src/main/java/com/fr/nx/app/designer/menu/FeatureFlagsPanel.java b/designer-realize/src/main/java/com/fr/nx/app/designer/menu/FeatureFlagsPanel.java deleted file mode 100644 index eaee45551..000000000 --- a/designer-realize/src/main/java/com/fr/nx/app/designer/menu/FeatureFlagsPanel.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.fr.nx.app.designer.menu; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.locale.InterProviderFactory; -import com.fr.nx.app.designer.menu.bean.FeatureFlagBean; -import com.fr.nx.feature.FeatureFlag; -import com.fr.stable.collections.combination.Pair; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -/** - * Created by loy on 2020/4/14. - */ -public class FeatureFlagsPanel extends BasicBeanPane { - - private FeatureFlagBean bean; - private JPanel mainPanel; - - public FeatureFlagsPanel() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - mainPanel = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - mainPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0)); - JPanel content = - TableLayoutHelper.createGapTableLayoutPane( - new Component[][]{new Component[]{mainPanel}}, - TableLayoutHelper.FILL_LASTCOLUMN, - 5, - 5 - ); - - this.add(content, BorderLayout.CENTER); - } - - @Override - public void populateBean(FeatureFlagBean featureFlagBean) { - this.bean = featureFlagBean; - mainPanel.removeAll(); - for (Pair entry : featureFlagBean.getAllFlags()) { - final FeatureFlag flag = entry.getFirst(); - Boolean selected = entry.getSecond(); - JPanel itemPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - final UICheckBox cb = new UICheckBox(flag.getDisplayName()); - cb.setSelected(selected); - cb.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - bean.modifyFlag(flag, cb.isSelected()); - } - }); - itemPanel.add(cb); - mainPanel.add(itemPanel); - } - } - - @Override - public FeatureFlagBean updateBean() { - return bean; - } - - @Override - protected String title4PopupWindow() { - return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Experimental_Feature"); - } -} diff --git a/designer-realize/src/main/java/com/fr/nx/app/designer/menu/bean/FeatureFlagBean.java b/designer-realize/src/main/java/com/fr/nx/app/designer/menu/bean/FeatureFlagBean.java deleted file mode 100644 index 4410d266d..000000000 --- a/designer-realize/src/main/java/com/fr/nx/app/designer/menu/bean/FeatureFlagBean.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.fr.nx.app.designer.menu.bean; - -import com.fr.nx.feature.FeatureFlag; -import com.fr.nx.feature.FeatureManager; -import com.fr.stable.collections.combination.Pair; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by loy on 2020/4/14. - */ -public class FeatureFlagBean { - - private Map modifyMap = new HashMap<>(); - - public List> getAllFlags() { - List> flagList = new ArrayList<>(); - for (FeatureFlag flag : FeatureManager.getSupportFlags()) { - flagList.add(new Pair<>(flag, FeatureManager.getInstance().isFlagEnable(flag))); - } - return flagList; - } - - public void modifyFlag(FeatureFlag flag, boolean value) { - modifyMap.put(flag, value); - } - - public void saveModification() { - for (Map.Entry entry : modifyMap.entrySet()) { - FeatureManager.getInstance().setFlagEnable(entry.getKey(), entry.getValue()); - } - } -} 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 4bcf4387f..162a2044f 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -6,7 +6,6 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.actions.file.newReport.NewPolyReportAction; import com.fr.design.actions.file.newReport.NewWorkBookAction; -import com.fr.design.actions.server.LocalAnalyzerAction; import com.fr.design.actions.server.ServerConfigManagerAction; import com.fr.design.actions.server.StyleListAction; import com.fr.design.actions.server.WidgetManagerAction; @@ -166,7 +165,6 @@ public class MainDesigner extends BaseDesigner { if (WorkContext.getCurrent().isRoot()) { menuDef.addShortCut(new ServerConfigManagerAction(), new StyleListAction(), new WidgetManagerAction()); menuDef.addShortCut(new ChartPreStyleAction(), new ChartEmptyDataStyleAction(),new ChartMapEditorAction()); - menuDef.addShortCut(new LocalAnalyzerAction()); } insertMenu(menuDef, MenuHandler.SERVER); diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 025539d79..3f1aa2663 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -27,8 +27,6 @@ import com.fr.design.actions.insert.flot.ImageFloatAction; import com.fr.design.actions.insert.flot.TextBoxFloatAction; import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.constants.DesignerLaunchStatus; -import com.fr.design.fit.NewJForm; -import com.fr.design.fit.common.TemplateTool; import com.fr.design.form.parameter.FormParaDesigner; import com.fr.design.fun.ElementUIProvider; import com.fr.design.gui.controlpane.NameObjectCreator; @@ -44,7 +42,7 @@ import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.ElementCaseThumbnail; import com.fr.design.mainframe.FormHierarchyTreePane; import com.fr.design.mainframe.InformationCollector; -import com.fr.design.mainframe.JTemplateEvent; +import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetToolBarPane; import com.fr.design.mainframe.alphafine.AlphaFineHelper; @@ -64,7 +62,6 @@ import com.fr.design.parameter.WorkBookParameterReader; import com.fr.design.update.actions.RecoverForDesigner; import com.fr.design.update.push.DesignerPushUpdateManager; import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane; -import com.fr.event.EventDispatcher; import com.fr.form.stable.ElementCaseThumbnailProcessor; import com.fr.general.GeneralContext; import com.fr.general.xml.GeneralXMLTools; @@ -398,15 +395,9 @@ public class DesignerActivator extends Activator { DesignModuleFactory.registerButtonDetailPaneClass(FormSubmitButtonDetailPane.class); DesignModuleFactory.registerParameterReader(new FormParameterReader()); - StableFactory.registerMarkedClass(BaseJForm.XML_TAG, NewJForm.class); - StableFactory.registerMarkedObject(ElementCaseThumbnailProcessor.MARK_STRING, new ElementCaseThumbnail()); - - registerJTemplateEvent(); - } + StableFactory.registerMarkedClass(BaseJForm.XML_TAG, JForm.class); - private static void registerJTemplateEvent(){ - EventDispatcher.listen(JTemplateEvent.BEFORE_TEMPLATE_INIT, TemplateTool.getSwitchListener()); - EventDispatcher.listen(JTemplateEvent.BEFORE_TEMPLATE_ACTIVE, TemplateTool.getSwitchListener()); + StableFactory.registerMarkedObject(ElementCaseThumbnailProcessor.MARK_STRING, new ElementCaseThumbnail()); } private static void storePassport() { diff --git a/designer-realize/src/test/java/com/fr/nx/app/designer/CptxAppTest.java b/designer-realize/src/test/java/com/fr/nx/app/designer/CptxAppTest.java deleted file mode 100644 index 26ca454c5..000000000 --- a/designer-realize/src/test/java/com/fr/nx/app/designer/CptxAppTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.fr.nx.app.designer; - -import com.fr.file.AbstractFILE; -import com.fr.file.FILE; -import com.fr.main.impl.WorkBook; -import com.fr.nx.app.designer.utils.DesignerCptxFileUtils; -import org.easymock.EasyMock; -import org.junit.Assert; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; -import org.junit.runners.MethodSorters; -import org.powermock.api.easymock.PowerMock; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.modules.junit4.PowerMockRunnerDelegate; - - -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -@RunWith(PowerMockRunner.class) -@PowerMockRunnerDelegate(JUnit4.class) -@PrepareForTest({ - DesignerCptxFileUtils.class -}) -public class CptxAppTest { - - @Test - public void testDefaultExtensions() { - CptxApp app = new CptxApp(); - String[] extendsions = app.defaultExtensions(); - Assert.assertEquals("cptx", extendsions[0]); - } - - @Test - public void testAsIOFile() { - PowerMock.mockStatic(DesignerCptxFileUtils.class); - FILE file = new AbstractFILE() { - }; - WorkBook workBook = new WorkBook(); - EasyMock.expect(DesignerCptxFileUtils.getWorkBook(file)) - .andReturn(workBook).once() - .andReturn(null).once(); - - PowerMock.replay(DesignerCptxFileUtils.class); - Assert.assertSame(workBook, new CptxApp().asIOFile(file)); - - Assert.assertNotNull(new CptxApp().asIOFile(file)); - - PowerMock.verify(DesignerCptxFileUtils.class); - - - } -} diff --git a/designer-realize/src/test/java/com/fr/nx/app/designer/JStreamBookTest.java b/designer-realize/src/test/java/com/fr/nx/app/designer/JStreamBookTest.java deleted file mode 100644 index 236096f0d..000000000 --- a/designer-realize/src/test/java/com/fr/nx/app/designer/JStreamBookTest.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.fr.nx.app.designer; - -import com.fr.file.FILE; -import com.fr.main.impl.WorkBook; -import com.fr.nx.app.designer.toolbar.TemplateTransformer; -import com.fr.nx.app.designer.toolbar.TransformResult; -import com.fr.nx.app.designer.toolbar.TransformResultInfo; -import org.easymock.EasyMock; -import org.easymock.IAnswer; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.easymock.PowerMock; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({TemplateTransformer.class, JStreamBook.class}) -@PowerMockIgnore({"com.fr.license.*"}) -@SuppressStaticInitializationFor({"com.fr.plugin.designer.JStreamBook"}) -public class JStreamBookTest { - - - @Test - public void saveFile() { - - PowerMock.mockStatic(TemplateTransformer.class); - final boolean[] fireSave = {false}; - - - JStreamBook workbook = - EasyMock.partialMockBuilder(VirtualJStreamBook.class) - .addMockedMethod("fireJTemplateSaved") - .addMockedMethod("getTarget") - .addMockedMethod("getEditingFILE") - .createMock(); - // 保存成功 - EasyMock.expect(TemplateTransformer.compileCPTX(null, null)) - .andReturn(TransformResultInfo.generateResult(TransformResult.UNSUPPORT, "fake Unsupported").saved(true)) - .once(); - PowerMock.replay(TemplateTransformer.class); - - workbook.fireJTemplateSaved(); - EasyMock.expectLastCall().andAnswer(new IAnswer() { - @Override - public Void answer() throws Throwable { - fireSave[0] = true; - return null; - } - }).once(); - - EasyMock.expect(workbook.getTarget()).andAnswer(new IAnswer() { - @Override - public WorkBook answer() throws Throwable { - return null; - } - }).once(); - - EasyMock.expect(workbook.getEditingFILE()).andAnswer(new IAnswer() { - @Override - public FILE answer() throws Throwable { - return null; - } - }).once(); - - EasyMock.replay(workbook); - - boolean saved = workbook.saveFile(); - Assert.assertTrue(saved); - Assert.assertTrue(fireSave[0]); - - PowerMock.verify(TemplateTransformer.class); - EasyMock.verify(workbook); - - fireSave[0] = false; - - // 保存失败 - PowerMock.reset(TemplateTransformer.class); - EasyMock.expect(TemplateTransformer.compileCPTX(null, null)) - .andReturn(TransformResultInfo.generateResult(TransformResult.FAILED, "fake Unsupported").saved(false)) - .once(); - PowerMock.replay(TemplateTransformer.class); - EasyMock.reset(workbook); - - EasyMock.expect(workbook.getTarget()).andAnswer(new IAnswer() { - @Override - public WorkBook answer() throws Throwable { - return null; - } - }).once(); - - EasyMock.expect(workbook.getEditingFILE()).andAnswer(new IAnswer() { - @Override - public FILE answer() throws Throwable { - return null; - } - }).once(); - EasyMock.replay(workbook); - - saved = workbook.saveFile(); - Assert.assertFalse(saved); - Assert.assertFalse(fireSave[0]); - - PowerMock.verify(TemplateTransformer.class); - EasyMock.verify(workbook); - } - - private static final class VirtualJStreamBook extends JStreamBook { - - public VirtualJStreamBook(WorkBook workBook, FILE file) { - super(workBook, file); - } - - @Override - public String toString() { - return this.getClass().getName() + "fake to string"; - } - } -} \ No newline at end of file diff --git a/designer-realize/src/test/resources/cpt/read-write-expand-order.cpt b/designer-realize/src/test/resources/cpt/read-write-expand-order.cpt deleted file mode 100644 index 3401f6fcc..000000000 --- a/designer-realize/src/test/resources/cpt/read-write-expand-order.cpt +++ /dev/null @@ -1,79 +0,0 @@ - - - - -