From a786a9833882c2af5317b8af05cfdaca2d18b07c Mon Sep 17 00:00:00 2001 From: "Jimmy.Zheng" Date: Wed, 31 Aug 2022 15:02:49 +0800 Subject: [PATCH 01/21] =?UTF-8?q?REPORT-70593=20=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E5=90=88=E5=B9=B6=E4=B8=BB=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/core/WidgetOption.java | 33 +++++- .../HyperlinkGroupPaneActionProvider.java | 2 + .../com/fr/design/report/SelectImagePane.java | 67 ++++++----- .../buttonicon/widget/picture_widget_16.png | Bin 0 -> 1061 bytes .../widget/picture_widget_designer_bg.png | Bin 0 -> 4933 bytes .../designer/creator/XCreatorUtils.java | 2 + .../fr/design/designer/creator/XPicture.java | 74 ++++++++++++ .../com/fr/design/designer/ui/ImgPanel.java | 111 ++++++++++++++++++ .../AccessiblePictureModelEditor.java | 77 ++++++++++++ .../AccessibleUrlLinkModelEditor.java | 57 +++++++++ .../widget/editors/PictureEditor.java | 17 +++ .../widget/editors/UrlLinkEditor.java | 17 +++ .../widget/renderer/PictureRenderer.java | 15 +++ .../widget/renderer/UrlLinkRenderer.java | 16 +++ .../widget/wrappers/PictureModelWrapper.java | 34 ++++++ .../widget/wrappers/UrlLinkModelWrapper.java | 33 ++++++ .../fr/start/module/DesignerActivator.java | 6 +- .../com/fr/start/preload/ImagePreLoader.java | 1 + 18 files changed, 521 insertions(+), 41 deletions(-) rename {designer-realize => designer-base}/src/main/java/com/fr/design/report/SelectImagePane.java (96%) create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/picture_widget_16.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png create mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java create mode 100644 designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleUrlLinkModelEditor.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/editors/UrlLinkEditor.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/PictureRenderer.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/UrlLinkRenderer.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/PictureModelWrapper.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/UrlLinkModelWrapper.java 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 71289376a0..4c9db5a6a0 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 @@ -2,13 +2,33 @@ package com.fr.design.gui.core; import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils; -import com.fr.form.ui.*; +import com.fr.form.ui.Button; +import com.fr.form.ui.CheckBox; +import com.fr.form.ui.CheckBoxGroup; +import com.fr.form.ui.ComboBox; +import com.fr.form.ui.ComboCheckBox; +import com.fr.form.ui.DateEditor; +import com.fr.form.ui.FreeButton; +import com.fr.form.ui.IframeEditor; +import com.fr.form.ui.Label; +import com.fr.form.ui.ListEditor; +import com.fr.form.ui.MultiFileEditor; +import com.fr.form.ui.NumberEditor; +import com.fr.form.ui.Password; +import com.fr.form.ui.PictureWidget; +import com.fr.form.ui.RadioGroup; +import com.fr.form.ui.TextArea; +import com.fr.form.ui.TextEditor; +import com.fr.form.ui.TreeComboBoxEditor; +import com.fr.form.ui.TreeEditor; +import com.fr.form.ui.UserDefinedWidgetConfig; +import com.fr.form.ui.Widget; +import com.fr.form.ui.WidgetConfig; +import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.ComparatorUtils; - - -import javax.swing.*; import java.io.Serializable; import java.util.ArrayList; +import javax.swing.Icon; public abstract class WidgetOption implements Serializable { @@ -124,7 +144,7 @@ public abstract class WidgetOption implements Serializable { */ public static WidgetOption[] getFormWidgetIntance() { return new WidgetOption[]{TEXTEDITOR, LABEL, FREEBUTTON, COMBOBOX, COMBOCHECKBOX, DATEEDITOR, - NUMBEREDITOR, TREECOMBOBOX, RADIOGROUP, CHECKBOXGROUP, TEXTAREA, PASSWORD, CHECKBOX, TREE, MULTI_FILEEDITOR}; + NUMBEREDITOR, TREECOMBOBOX, RADIOGROUP, CHECKBOXGROUP, TEXTAREA, PASSWORD, CHECKBOX, TREE, MULTI_FILEEDITOR,PICTURE}; } public static final WidgetOption DATEEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Date"), @@ -196,4 +216,7 @@ public abstract class WidgetOption implements Serializable { 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); + public static final WidgetOption PICTURE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Image"), IconUtils.readIcon("/com/fr/web/images/form/resources/picture_widget_16.png"), + PictureWidget.class); + } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java index 525bb5b792..be0d8e8523 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java @@ -8,6 +8,8 @@ import com.fr.design.designer.TargetComponent; */ public interface HyperlinkGroupPaneActionProvider { + String XML_TAG = "HyperlinkGroupPane"; + /** * 刷新面板展示 * diff --git a/designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java b/designer-base/src/main/java/com/fr/design/report/SelectImagePane.java similarity index 96% rename from designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java rename to designer-base/src/main/java/com/fr/design/report/SelectImagePane.java index bcad15c76c..7781233aac 100644 --- a/designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java +++ b/designer-base/src/main/java/com/fr/design/report/SelectImagePane.java @@ -13,22 +13,24 @@ import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.painter.CellImagePainter; import com.fr.stable.Constants; - -import javax.swing.BorderFactory; -import javax.swing.ButtonGroup; -import javax.swing.JFileChooser; -import javax.swing.JPanel; -import javax.swing.JScrollPane; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JFileChooser; +import javax.swing.JPanel; +import javax.swing.JScrollPane; /** - * 这个类主要用于插入图片时的设置 - */ + *

这个类主要用于插入图片时的设置

+ *

这个类原本在designer-realize包下面,现在表单也可选择图片,所以应该抽为公用的base包。包名不变,应该不影响插件使用

+ * + * @author Jimmy.Zheng created on 2022/8/11 21:22 + **/ public class SelectImagePane extends BasicPane { private ImagePreviewPane previewPane = null; @@ -39,8 +41,31 @@ public class SelectImagePane extends BasicPane { private UIRadioButton adjustRadioButton = null; private Style imageStyle = null; + ActionListener layoutActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent evt) { + setImageStyle(); + changeImageStyle(); + } + }; private File imageFile; + /** + * Select picture. + */ + ActionListener selectPictureActionListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent evt) { + int returnVal = imageFileChooser + .showOpenDialog(SelectImagePane.this); + if (returnVal != JFileChooser.CANCEL_OPTION) { + File selectedFile = imageFileChooser.getSelectedFile(); + imageFile = selectedFile; + ImgChooseWrapper.getInstance(previewPane, imageFileChooser, imageStyle, null).dealWithImageFile(returnVal); + } + } + }; public SelectImagePane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -102,23 +127,6 @@ public class SelectImagePane extends BasicPane { imageFileChooser.setMultiSelectionEnabled(false); } - /** - * Select picture. - */ - ActionListener selectPictureActionListener = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent evt) { - int returnVal = imageFileChooser - .showOpenDialog(SelectImagePane.this); - if (returnVal != JFileChooser.CANCEL_OPTION) { - File selectedFile = imageFileChooser.getSelectedFile(); - imageFile = selectedFile; - ImgChooseWrapper.getInstance(previewPane, imageFileChooser, imageStyle, null).dealWithImageFile(returnVal); - } - } - }; - // 调整图片样式,只有水平和垂直对齐以及拉伸。相对于背景,平铺不予考虑。 private void changeImageStyle() { previewPane.setImageStyle(this.imageStyle); @@ -137,15 +145,6 @@ public class SelectImagePane extends BasicPane { } } - ActionListener layoutActionListener = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent evt) { - setImageStyle(); - changeImageStyle(); - } - }; - @Override protected String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image"); diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/picture_widget_16.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/picture_widget_16.png new file mode 100644 index 0000000000000000000000000000000000000000..fbf334ad22a2e3a9985830d225959a6ea40379b0 GIT binary patch literal 1061 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 NL`TL%oDNfH{|_#1j literal 0 HcmV?d00001 diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index eb1f3497a3..e52233e0ef 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -46,6 +46,7 @@ import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.NameWidget; import com.fr.form.ui.NumberEditor; import com.fr.form.ui.Password; +import com.fr.form.ui.PictureWidget; import com.fr.form.ui.Radio; import com.fr.form.ui.RadioGroup; import com.fr.form.ui.TextArea; @@ -183,6 +184,7 @@ public class XCreatorUtils { objectMap.put(CardSwitchButton.class, XCardSwitchButton.class); objectMap.put(CardAddButton.class, XCardAddButton.class); objectMap.put(WidgetErrorMarker.class, ErrorCreator.class); + objectMap.put(PictureWidget.class, XPicture.class); } private static void reInitExtra() { diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java b/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java new file mode 100644 index 0000000000..7dd23bd4ce --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java @@ -0,0 +1,74 @@ +package com.fr.design.designer.creator; + +import com.fr.design.designer.ui.ImgPanel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.widget.editors.PictureEditor; +import com.fr.design.mainframe.widget.editors.UrlLinkEditor; +import com.fr.design.mainframe.widget.renderer.PictureRenderer; +import com.fr.design.mainframe.widget.renderer.UrlLinkRenderer; +import com.fr.form.ui.PictureWidget; +import com.fr.general.IOUtils; +import com.fr.stable.ArrayUtils; +import java.awt.Dimension; +import java.awt.Image; +import java.beans.IntrospectionException; +import javax.swing.JComponent; + +/** +* +*

图片控件的creator

+* +* @author Jimmy.Zheng created on 2022/8/11 21:16 +**/ +public class XPicture extends XWidgetCreator { + + public XPicture(PictureWidget widget, Dimension dimension) { + super(widget, dimension); + } + + @Override + protected String getIconName() { + return "picture_widget_16.png"; + } + + @Override + public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[]{ + new CRPropertyDescriptor("picUrl", toData().getClass()) + .setI18NName(Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Image")) + .setEditorClass(PictureEditor.class) + .setRendererClass(PictureRenderer.class) + .putKeyValue("category", "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("urlLink", toData().getClass()) + .setI18NName(Toolkit.i18nText("Fine-Design_Basic_Hyperlink")) + .setEditorClass(UrlLinkEditor.class) + .setRendererClass(UrlLinkRenderer.class) + .putKeyValue( + "category", "Fine-Design_Basic_Advanced")}); + } + + @Override + protected JComponent initEditor() { + PictureWidget pictureWidget = (PictureWidget) this.data; + if (this.editor == null) { + this.editor = FRGUIPaneFactory.createBorderLayout_S_Pane(); + Object value = pictureWidget.getPicUrl().getValue(); + ImgPanel imgPanel = new ImgPanel(); + if (value instanceof Image) { + imgPanel.setBackgroundImage((Image) value); + imgPanel.setImageDisplayMode(pictureWidget.getShowType()); + } else { + imgPanel.setBackgroundImage(IOUtils.readImage("com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png")); + imgPanel.setImageDisplayMode(0); + } + this.editor.add(imgPanel, "Center"); + } + return this.editor; + } + + @Override + public boolean canEnterIntoParaPane() { + return false; + } +} diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java b/designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java new file mode 100644 index 0000000000..05aa8ba465 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java @@ -0,0 +1,111 @@ +package com.fr.design.designer.ui; + +import com.fr.general.ImageWithSuffix; +import java.awt.Graphics; +import java.awt.Image; +import javax.swing.JComponent; + + +/** +* +*

图片控件中的已选图片展示面板

+* +* @author Jimmy.Zheng created on 2022/8/11 21:17 +**/ +public class ImgPanel extends JComponent { + private static final long serialVersionUID = 1L; + private Image backgroundImage; + private int imageDisplayMode; + private int modeIndex; + + public ImgPanel() { + this(null, 0); + } + + public ImgPanel(Image image, int modeName) { + setBackgroundImage(image); + setImageDisplayMode(modeName); + } + + public void setBackgroundImage(Image image) { + this.backgroundImage = image; + repaint(); + } + + public Image getBackgroundImage() { + return this.backgroundImage; + } + + public void setImageDisplayMode(int modeName) { + if (modeName == 1) { + this.modeIndex = 0; + } + + if (modeName == 0) { + this.imageDisplayMode = 0; + this.modeIndex = 1; + } + + if (modeName == 2) { + this.imageDisplayMode = 2; + this.modeIndex = 2; + } + if (modeName == 4) { + this.imageDisplayMode = 4; + this.modeIndex = 3; + } + repaint(); + } + + public int getImageDisplayMode() { + return this.imageDisplayMode; + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + + if (this.backgroundImage != null) { + if (this.backgroundImage instanceof ImageWithSuffix) { + this.backgroundImage = ((ImageWithSuffix) backgroundImage).getImage(); + } + int width = getWidth(); + int height = getHeight(); + int imageWidth = this.backgroundImage.getWidth(this); + int imageHeight = this.backgroundImage.getHeight(this); + + switch (this.modeIndex) { + case 0: + int x = (width - imageWidth) / 2; + int y = (height - imageHeight) / 2; + g.drawImage(this.backgroundImage, x, y, this); + break; + case 1: + for (int ix = 0; ix < width; ix += imageWidth) { + for (int iy = 0; iy < height; iy += imageHeight) { + g.drawImage(this.backgroundImage, ix, iy, this); + } + } + + break; + case 2: + g.drawImage(this.backgroundImage, 0, 0, width, height, this); + break; + case 3: + double sx = 1.0 * width / imageWidth; + double sy = 1.0 * height / imageHeight; + + if (sx > sy) { + sx = sy; + width = (int) (sx * imageWidth); + } else { + sy = sx; + height = (int) (sy * imageHeight); + } + int xx = (getWidth() - width) / 2; + int yy = (getHeight() - height) / 2; + g.drawImage(this.backgroundImage, xx, yy, width, height, this); + } + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java new file mode 100644 index 0000000000..9e72b5c2ac --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java @@ -0,0 +1,77 @@ +package com.fr.design.mainframe.widget.accessibles; + +import com.fr.base.Style; +import com.fr.design.DesignModelAdapter; +import com.fr.design.designer.creator.XPicture; +import com.fr.design.designer.ui.ImgPanel; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.widget.wrappers.PictureModelWrapper; +import com.fr.design.report.SelectImagePane; +import com.fr.form.ui.PictureWidget; +import com.fr.general.ComparatorUtils; +import com.fr.report.cell.FloatElement; +import com.fr.report.cell.cellattr.CellImage; +import javax.swing.JComponent; + + +/** +* +*

图片控件的图片选择、编辑器

+* +* @author Jimmy.Zheng created on 2022/8/11 21:13 +**/ +public class AccessiblePictureModelEditor extends UneditableAccessibleEditor { + protected FloatElement element = new FloatElement(); + private PictureWidget pic; + + public AccessiblePictureModelEditor(PictureWidget pic) { + super(new PictureModelWrapper()); + this.pic = pic; + } + + @Override + public FloatElement getValue() { + return (FloatElement) super.getValue(); + } + + @Override + protected void showEditorPane() { + final SelectImagePane imageEditorPane = new SelectImagePane(); + if (super.getValue() != null) { + this.element = ((FloatElement) super.getValue()); + } + this.element.setStyle(Style.getInstance().deriveImageLayout(this.pic.getShowType())); + imageEditorPane.populate(this.element); + final Object oldValue = this.element.getValue(); + final Style oldStyle = this.element.getStyle(); + final String oldname = this.element.getName(); + imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + CellImage cellImage = imageEditorPane.update(); + if ((!ComparatorUtils.equals(cellImage.getImage(), oldValue)) || (!ComparatorUtils.equals(cellImage.getStyle(), oldStyle))) { + AccessiblePictureModelEditor.this.element.setValue(cellImage.getImage()); + AccessiblePictureModelEditor.this.element.setStyle(cellImage.getStyle()); + AccessiblePictureModelEditor.this.element.setName(imageEditorPane.getSelectedImage() == null ? oldname : imageEditorPane.getSelectedImage().toString()); + AccessiblePictureModelEditor.this.setValue(AccessiblePictureModelEditor.this.element); + AccessiblePictureModelEditor.this.pic.setShowType(cellImage.getStyle().getImageLayout()); + AccessiblePictureModelEditor.this.pic.setPicUrl(element); + ImgPanel p = AccessiblePictureModelEditor.this.getCurrentImgPanel(); + p.setBackgroundImage(cellImage.getBufferImage()); + p.setImageDisplayMode(cellImage.getStyle().getImageLayout()); + AccessiblePictureModelEditor.this.fireStateChanged(); + DesignModelAdapter d = DesignModelAdapter.getCurrentModelAdapter(); + d.fireTargetModified(); + } + } + }).setVisible(true); + } + + private ImgPanel getCurrentImgPanel() { + XPicture xPicture = (XPicture) WidgetPropertyPane.getInstance().getEditingFormDesigner().getSelectionModel().getSelection().getSelectedCreator(); + JComponent editor = (JComponent) xPicture.getComponent(0); + return (ImgPanel) editor.getComponent(0); + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleUrlLinkModelEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleUrlLinkModelEditor.java new file mode 100644 index 0000000000..2dd4b54991 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleUrlLinkModelEditor.java @@ -0,0 +1,57 @@ +package com.fr.design.mainframe.widget.accessibles; + +import com.fr.design.DesignModelAdapter; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; +import com.fr.design.gui.xpane.FormHyperlinkGroupPane; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.widget.wrappers.UrlLinkModelWrapper; +import com.fr.js.NameJavaScriptGroup; +import com.fr.stable.bridge.StableFactory; + +/** + *

表单图片控件的链接编辑器

+ * @author Jimmy + */ +public class AccessibleUrlLinkModelEditor extends UneditableAccessibleEditor { + private FormHyperlinkGroupPane hyperlinkPane; + + public AccessibleUrlLinkModelEditor() { + super(new UrlLinkModelWrapper()); + } + /** + * 原插件使用 + *

DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPaneNoPop( + * HyperlinkGroupPaneActionImpl.getInstance()));

获取{@see this.hyperlinkPane} + * 合并插件依赖不到,换种方式 用{@see DesignerActivator将实例注册了} + */ + @Override + protected void showEditorPane() { + if (this.hyperlinkPane == null) { + HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider = StableFactory.getMarkedInstanceObjectFromClass(HyperlinkGroupPaneActionProvider.XML_TAG,HyperlinkGroupPaneActionProvider.class); + this.hyperlinkPane = (FormHyperlinkGroupPane) DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPaneNoPop( + hyperlinkGroupPaneActionProvider); + } + BasicDialog dialog = this.hyperlinkPane.showWindow(DesignerContext.getDesignerFrame()); + dialog.addDialogActionListener(new DialogActionAdapter() { + @Override + public void doOk() { + super.doOk(); + NameJavaScriptGroup hyperlinks = AccessibleUrlLinkModelEditor.this.hyperlinkPane.updateJSGroup(); + AccessibleUrlLinkModelEditor.this.setValue(hyperlinks); + AccessibleUrlLinkModelEditor.this.fireStateChanged(); + DesignModelAdapter d = DesignModelAdapter.getCurrentModelAdapter(); + d.fireTargetModified(); + } + }); + this.hyperlinkPane.populate(getValue()); + + dialog.setVisible(true); + } + + @Override + public NameJavaScriptGroup getValue() { + return (NameJavaScriptGroup) super.getValue(); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java new file mode 100644 index 0000000000..c7bbff80a3 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java @@ -0,0 +1,17 @@ +package com.fr.design.mainframe.widget.editors; + +import com.fr.design.mainframe.widget.accessibles.AccessiblePictureModelEditor; +import com.fr.design.mainframe.widget.accessibles.AccessiblePropertyEditor; +import com.fr.form.ui.PictureWidget; +/** +* +*

图片控件的图片选择、编辑器

+* +* @author Jimmy.Zheng created on 2022/8/11 21:15 +**/ +public class PictureEditor extends AccessiblePropertyEditor { + + public PictureEditor(Object o) { + super(new AccessiblePictureModelEditor((PictureWidget) o)); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/UrlLinkEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/UrlLinkEditor.java new file mode 100644 index 0000000000..195e8f5250 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/UrlLinkEditor.java @@ -0,0 +1,17 @@ +package com.fr.design.mainframe.widget.editors; + +import com.fr.design.mainframe.widget.accessibles.AccessiblePropertyEditor; +import com.fr.design.mainframe.widget.accessibles.AccessibleUrlLinkModelEditor; + +/** +* +*

图片控件的链接编辑器

+* +* @author Jimmy.Zheng created on 2022/8/11 21:19 +**/ +public class UrlLinkEditor extends AccessiblePropertyEditor { + + public UrlLinkEditor() { + super(new AccessibleUrlLinkModelEditor()); + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/PictureRenderer.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/PictureRenderer.java new file mode 100644 index 0000000000..82fcc85b43 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/PictureRenderer.java @@ -0,0 +1,15 @@ +package com.fr.design.mainframe.widget.renderer; + +import com.fr.design.mainframe.widget.wrappers.PictureModelWrapper; + +/** + *

图片控件的图片编辑器的EncoderCellRenderer

+ * + * @author Jimmy.Zheng created on 2022/8/11 21:29 + **/ +public class PictureRenderer extends EncoderCellRenderer { + + public PictureRenderer() { + super(new PictureModelWrapper()); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/UrlLinkRenderer.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/UrlLinkRenderer.java new file mode 100644 index 0000000000..a81187d2d5 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/UrlLinkRenderer.java @@ -0,0 +1,16 @@ +package com.fr.design.mainframe.widget.renderer; + + +import com.fr.design.mainframe.widget.wrappers.UrlLinkModelWrapper; + +/** + *

图片控件的链接编辑器的EncoderCellRenderer

+ * + * @author Jimmy.Zheng created on 2022/8/11 21:29 + **/ +public class UrlLinkRenderer extends EncoderCellRenderer { + + public UrlLinkRenderer() { + super(new UrlLinkModelWrapper()); + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/PictureModelWrapper.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/PictureModelWrapper.java new file mode 100644 index 0000000000..ed9fd0a4ac --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/PictureModelWrapper.java @@ -0,0 +1,34 @@ +package com.fr.design.mainframe.widget.wrappers; + +import com.fr.design.Exception.ValidationException; +import com.fr.design.designer.properties.Decoder; +import com.fr.design.designer.properties.Encoder; +import com.fr.report.cell.FloatElement; +import com.fr.stable.StringUtils; + +/** + *

图片选择器 {@link com.fr.design.mainframe.widget.accessibles.AccessiblePictureModelEditor}的 Wrapper

+ *

插件中直接移入,未作改动

+ * + * @author Jimmy.Zheng created on 2022/8/11 21:25 + **/ +public class PictureModelWrapper implements Encoder, Decoder { + + @Override + public FloatElement decode(String txt) { + return null; + } + + @Override + public void validate(String txt) throws ValidationException { + // do nothing + } + + @Override + public String encode(FloatElement v) { + if (v != null) { + return v.getName(); + } + return StringUtils.EMPTY; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/UrlLinkModelWrapper.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/UrlLinkModelWrapper.java new file mode 100644 index 0000000000..a892065ad7 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/UrlLinkModelWrapper.java @@ -0,0 +1,33 @@ +package com.fr.design.mainframe.widget.wrappers; + +import com.fr.design.Exception.ValidationException; +import com.fr.design.designer.properties.Decoder; +import com.fr.design.designer.properties.Encoder; +import com.fr.js.NameJavaScriptGroup; + +/** + *

链接选择器 {@link com.fr.design.mainframe.widget.accessibles.AccessibleUrlLinkModelEditor}的 Wrapper

+ *

插件中直接移入,未作改动

+ * + * @author Jimmy.Zheng created on 2022/8/11 21:28 + **/ +public class UrlLinkModelWrapper implements Encoder, Decoder { + + @Override + public NameJavaScriptGroup decode(String txt) { + return null; + } + + @Override + public void validate(String txt) throws ValidationException { + // do nothing + } + + @Override + public String encode(NameJavaScriptGroup v) { + if (v.size() > 0) { + return v.getNameHyperlink(0).getName(); + } + return null; + } +} \ No newline at end of file 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 8e8b5b519a..a5ff9fc391 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 @@ -40,6 +40,7 @@ import com.fr.design.form.parameter.FormParaDesigner; import com.fr.design.fun.ElementUIProvider; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.hyperlink.ReportletHyperlinkPane; import com.fr.design.hyperlink.WebHyperlinkPane; import com.fr.design.hyperlink.popup.MobilePopupPane; @@ -54,6 +55,7 @@ import com.fr.design.login.message.DesignerMessageHelper; import com.fr.design.login.socketio.LoginAuthServer; import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.FormHierarchyTreePane; +import com.fr.design.mainframe.HyperlinkGroupPaneActionImpl; import com.fr.design.mainframe.InformationCollector; import com.fr.design.mainframe.JTemplateEvent; import com.fr.design.mainframe.WidgetPropertyPane; @@ -142,14 +144,13 @@ import com.fr.start.common.DesignerStartupPool; import com.fr.task.Once; import com.fr.workspace.WorkContext; import com.fr.xml.ReportXMLUtils; - -import javax.swing.SwingWorker; import java.awt.Image; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.concurrent.CompletableFuture; +import javax.swing.SwingWorker; /** * Created by juhaoyu on 2018/1/31. @@ -400,6 +401,7 @@ public class DesignerActivator extends Activator implements Prepare { private static void registerOtherPane() { StableFactory.registerMarkedClass(BBSGuestPaneProvider.XML_TAG, BBSGuestPane.class); + StableFactory.registerMarkedObject(HyperlinkGroupPaneActionProvider.XML_TAG, HyperlinkGroupPaneActionImpl.getInstance()); } /** 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 24d23565c0..aad478348f 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 @@ -242,6 +242,7 @@ public class ImagePreLoader { "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/web/images/form/resources/picture_widget_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", From 567adaddb6c9a57eeb4424aa22bc991b427c14bb Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 1 Sep 2022 11:17:21 +0800 Subject: [PATCH 02/21] =?UTF-8?q?REPORT-77649=20feat:fvs=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E8=B6=85=E9=93=BE=E7=95=8C=E9=9D=A2populate=E4=B8=8Drefresh?= =?UTF-8?q?=E8=B6=85=E9=93=BE=E7=B1=BB=E5=9E=8B=EF=BC=8Cps=EF=BC=9Arefresh?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E9=83=BD=E6=B2=A1=E6=9C=89=E5=BF=85=E8=A6=81?= =?UTF-8?q?=20=E5=85=88=E5=8F=AA=E6=94=B9fvs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartHyperLinkPane.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java index f3a19a41e3..6e5b346a18 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java @@ -6,6 +6,7 @@ import com.fr.chart.web.ChartHyperPoplink; import com.fr.chart.web.ChartHyperRelateCellLink; import com.fr.chart.web.ChartHyperRelateFloatLink; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chart.javascript.ChartEmailPane; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane; @@ -78,14 +79,11 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane { constructor = creator.getUpdatePane().getConstructor(HashMap.class, boolean.class); return constructor.newInstance(getHyperLinkEditorMap(), false); - } catch (InstantiationException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } catch (IllegalAccessException e) { + } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } catch (NoSuchMethodException e) { + FineLoggerFactory.getLogger().warn(e.getMessage(), e); return super.createPaneByCreators(creator); - } catch (InvocationTargetException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); } return null; } @@ -144,9 +142,11 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane { return new NameJavaScriptGroup(res_array); } - public void populate(Plot plot) { - setPlot(plot); - HashMap paneMap = getHyperlinkMap(plot); + private void refreshNameableCreator() { + if (DesignModeContext.isDuchampMode()) { + return; + } + HashMap paneMap = getHyperlinkMap(); //安装平台内打开插件时,添加相应按钮 Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); @@ -166,6 +166,12 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane { } refreshNameableCreator(creators); + } + + public void populate(Plot plot) { + setPlot(plot); + + refreshNameableCreator(); java.util.List nameObjects = new ArrayList(); @@ -174,8 +180,7 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane { NameJavaScript javaScript = nameGroup.getNameHyperlink(i); if (javaScript != null && javaScript.getJavaScript() != null) { JavaScript script = javaScript.getJavaScript(); - UIMenuNameableCreator uiMenuNameableCreator = new UIMenuNameableCreator(javaScript.getName(), script, getUseMap(paneMap, script.getClass())); - nameObjects.add(new NameObject(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj())); + nameObjects.add(new NameObject(javaScript.getName(), script)); } } @@ -188,7 +193,7 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane { return plot.getHotHyperLink(); } - protected HashMap getHyperlinkMap(Plot plot) { + protected HashMap getHyperlinkMap() { HashMap map = new HashMap(); map.put(ReportletHyperlink.class, ReportletHyperlinkPane.class); From 4c05a9f48b1b9682072c463c616f759a66d6235a Mon Sep 17 00:00:00 2001 From: Lanlan Date: Fri, 2 Sep 2022 11:33:22 +0800 Subject: [PATCH 03/21] =?UTF-8?q?REPORT-79345=20=E3=80=90=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E5=88=87=E6=8D=A2=E8=BF=9C=E7=A8=8B=EF=BC=8C?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=88=B7=E6=8A=A5=E9=94=99write=20failed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/start/module/DesignerActivator.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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 8e8b5b519a..9787a12158 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 @@ -173,7 +173,7 @@ public class DesignerActivator extends Activator implements Prepare { @Override public void start() { - + List markers = findMutable(InterMutableKey.Path); for (LocaleMarker marker : markers) { @@ -208,8 +208,10 @@ public class DesignerActivator extends Activator implements Prepare { CompletableFuture resourcePrepare = CompletableFuture.runAsync(() -> { pushUpdateTask.run(); - PluginResourceLoader.INSTANCE.checkOldShopFile(); - UpmResourceLoader.INSTANCE.checkOldShopFile(); + if (WorkContext.getCurrent().isLocal()) { + PluginResourceLoader.INSTANCE.checkOldShopFile(); + UpmResourceLoader.INSTANCE.checkOldShopFile(); + } }, DesignerStartupPool.common()); CompletableFuture @@ -552,7 +554,7 @@ public class DesignerActivator extends Activator implements Prepare { } private void startBBSLoginAuthServer() { - + OptimizeUtil.open(() -> { // 设计器启动后启动 EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { From 1c5d2aa983c3b1a61359184abf463bf2e60761b7 Mon Sep 17 00:00:00 2001 From: "Jimmy.Zheng" Date: Fri, 2 Sep 2022 20:59:49 +0800 Subject: [PATCH 04/21] =?UTF-8?q?REPORT-70593=20=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E5=8E=9F=E6=8F=92=E4=BB=B6=E7=A6=81=E7=94=A8=E3=80=82?= =?UTF-8?q?=E6=96=B9=E6=A1=88=E5=8F=82=E8=80=83https://kms.fineres.com/pag?= =?UTF-8?q?es/viewpage.action=3FpageId=3D457117391?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/module/DesignerActivator.java | 2 ++ 1 file changed, 2 insertions(+) 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 0f7a614052..b69eda7993 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 @@ -161,6 +161,7 @@ public class DesignerActivator extends Activator implements Prepare { private LogHandler logHandler = null; private static final String PLUGIN_EXPORT_IMAGE_SETTING = "com.fr.plugin.exportimagesettings.v11"; + private static final String PICTURE_WIDGET_PLUGIN_ID = "com.fr.plugin.widget.picture.v11"; private final Once pushUpdateTask = new Once(new Runnable() { @Override public void run() { @@ -553,6 +554,7 @@ public class DesignerActivator extends Activator implements Prepare { private void prepareDefaultEmbedPluginInfo() { addMutable(PluginEmbedInfo.KEY, DefaultPluginEmbedInfo.create(PLUGIN_EXPORT_IMAGE_SETTING)); + addMutable(PluginEmbedInfo.KEY, DefaultPluginEmbedInfo.create(PICTURE_WIDGET_PLUGIN_ID)); } private void startBBSLoginAuthServer() { From 19bd30d0f611b2c7fa53ee4dd59652538559f227 Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Mon, 5 Sep 2022 12:02:46 +0800 Subject: [PATCH 05/21] =?UTF-8?q?REPORT-79344=E3=80=90=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=8C=96=E4=BA=8C=E6=9C=9F=E3=80=91=E5=9F=8B?= =?UTF-8?q?=E7=82=B9=E6=9A=82=E4=B8=8D=E7=94=9F=E6=95=88=201=E3=80=81relea?= =?UTF-8?q?se=E6=8F=90=E4=BA=A4=E4=B8=80=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/action/StartUseAction.java | 8 ++++++-- .../alphafine/cell/model/DocumentModel.java | 14 ++++++++++---- .../alphafine/model/TemplateResource.java | 13 +++++++++++++ .../impl/TemplateResourceSearchManager.java | 4 +++- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java index de813883f8..4a7375f74e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java @@ -2,7 +2,6 @@ package com.fr.design.mainframe.alphafine.action; import com.fr.common.util.Strings; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.download.FineMarketConstants; import com.fr.design.mainframe.alphafine.download.FineMarketDownloadManager; @@ -80,7 +79,12 @@ public class StartUseAction implements ActionListener { } // 打开模板 - DesignerContext.getDesignerFrame().openTemplate(new FileFILE(fileNeedOpen)); + if (fileNeedOpen == null) { + //有可能压缩包解压出来还是压缩包 + FineLoggerFactory.getLogger().error("AlphaFine open resource error: " + fileName); + } else { + DesignerContext.getDesignerFrame().openTemplate(new FileFILE(fileNeedOpen)); + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java index e83b4be764..7456daffce 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java @@ -2,11 +2,10 @@ package com.fr.design.mainframe.alphafine.cell.model; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.CellType; -import com.fr.log.FineLoggerFactory; -import com.fr.json.JSONException; import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; -import java.awt.*; +import java.awt.Desktop; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -60,8 +59,15 @@ public class DocumentModel extends AlphaCellModel { @Override public void doAction() { + openInBrowser(getDocumentUrl()); + } + + /** + * 方便埋点 + * */ + void openInBrowser(String url) { try { - Desktop.getDesktop().browse(new URI(getDocumentUrl())); + Desktop.getDesktop().browse(new URI(url)); } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } catch (URISyntaxException e) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResource.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResource.java index 56cc25a0c0..b7ace8a3fc 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResource.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResource.java @@ -63,6 +63,7 @@ public class TemplateResource { private String fileName; private int pkgSize; private List recommendSearchKey; + private boolean embed; public static List createByJson(JSONArray jsonArray) { List list = new ArrayList<>(); @@ -158,6 +159,18 @@ public class TemplateResource { return this; } + + /** + * 判断是否为内置模板资源 + * */ + public boolean isEmbed() { + return embed; + } + + public void setEmbed(boolean embed) { + this.embed = embed; + } + public String getName() { return name; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/TemplateResourceSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/TemplateResourceSearchManager.java index 2a8c767518..61dceaa008 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/TemplateResourceSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/TemplateResourceSearchManager.java @@ -69,7 +69,9 @@ public class TemplateResourceSearchManager { List resourceList = new ArrayList<>(); JSONArray jsonArray = getEmbedResourceJSONArray(); for (int i = 0; i < jsonArray.size(); i++) { - resourceList.add(TemplateResource.createByJson(jsonArray.getJSONObject(i))); + TemplateResource resource = TemplateResource.createByJson(jsonArray.getJSONObject(i)); + resource.setEmbed(true); + resourceList.add(resource); } return resourceList; } From 295034b3599e02564d77d12be1d6f8c8f028eae2 Mon Sep 17 00:00:00 2001 From: "Jimmy.Zheng" Date: Mon, 5 Sep 2022 16:45:16 +0800 Subject: [PATCH 06/21] =?UTF-8?q?REPORT-70593=20=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E4=BB=85=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=EF=BC=8C=E6=8C=AA=E4=B8=AA=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/gui/core/WidgetOption.java | 2 +- .../main/java/com/fr/design/designer/creator/XCreatorUtils.java | 2 +- .../src/main/java/com/fr/design/designer/creator/XPicture.java | 2 +- .../widget/accessibles/AccessiblePictureModelEditor.java | 2 +- .../com/fr/design/mainframe/widget/editors/PictureEditor.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) 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 4c9db5a6a0..21e9836136 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 @@ -15,7 +15,7 @@ import com.fr.form.ui.ListEditor; import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.NumberEditor; import com.fr.form.ui.Password; -import com.fr.form.ui.PictureWidget; +import com.fr.form.ui.widget.PictureWidget; import com.fr.form.ui.RadioGroup; import com.fr.form.ui.TextArea; import com.fr.form.ui.TextEditor; diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index e52233e0ef..208656597d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -46,7 +46,7 @@ import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.NameWidget; import com.fr.form.ui.NumberEditor; import com.fr.form.ui.Password; -import com.fr.form.ui.PictureWidget; +import com.fr.form.ui.widget.PictureWidget; import com.fr.form.ui.Radio; import com.fr.form.ui.RadioGroup; import com.fr.form.ui.TextArea; diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java b/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java index 7dd23bd4ce..9592e436e9 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java @@ -7,7 +7,7 @@ import com.fr.design.mainframe.widget.editors.PictureEditor; import com.fr.design.mainframe.widget.editors.UrlLinkEditor; import com.fr.design.mainframe.widget.renderer.PictureRenderer; import com.fr.design.mainframe.widget.renderer.UrlLinkRenderer; -import com.fr.form.ui.PictureWidget; +import com.fr.form.ui.widget.PictureWidget; import com.fr.general.IOUtils; import com.fr.stable.ArrayUtils; import java.awt.Dimension; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java index 9e72b5c2ac..d2c8f7c30a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java @@ -9,7 +9,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.wrappers.PictureModelWrapper; import com.fr.design.report.SelectImagePane; -import com.fr.form.ui.PictureWidget; +import com.fr.form.ui.widget.PictureWidget; import com.fr.general.ComparatorUtils; import com.fr.report.cell.FloatElement; import com.fr.report.cell.cellattr.CellImage; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java index c7bbff80a3..b366b7d75a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java @@ -2,7 +2,7 @@ package com.fr.design.mainframe.widget.editors; import com.fr.design.mainframe.widget.accessibles.AccessiblePictureModelEditor; import com.fr.design.mainframe.widget.accessibles.AccessiblePropertyEditor; -import com.fr.form.ui.PictureWidget; +import com.fr.form.ui.widget.PictureWidget; /** * *

图片控件的图片选择、编辑器

From 9b047e5159a0c545e91741bd92115094601be258 Mon Sep 17 00:00:00 2001 From: "Jimmy.Zheng" Date: Mon, 5 Sep 2022 17:03:55 +0800 Subject: [PATCH 07/21] =?UTF-8?q?Revert=20"REPORT-70593=20=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=8E=A7=E4=BB=B6=E4=BB=85=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E4=BD=BF=E7=94=A8=EF=BC=8C=E6=8C=AA=E4=B8=AA=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 295034b3 --- .../main/java/com/fr/design/designer/creator/XCreatorUtils.java | 2 +- .../src/main/java/com/fr/design/designer/creator/XPicture.java | 2 +- .../widget/accessibles/AccessiblePictureModelEditor.java | 2 +- .../com/fr/design/mainframe/widget/editors/PictureEditor.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 208656597d..e52233e0ef 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -46,7 +46,7 @@ import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.NameWidget; import com.fr.form.ui.NumberEditor; import com.fr.form.ui.Password; -import com.fr.form.ui.widget.PictureWidget; +import com.fr.form.ui.PictureWidget; import com.fr.form.ui.Radio; import com.fr.form.ui.RadioGroup; import com.fr.form.ui.TextArea; diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java b/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java index 9592e436e9..7dd23bd4ce 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java @@ -7,7 +7,7 @@ import com.fr.design.mainframe.widget.editors.PictureEditor; import com.fr.design.mainframe.widget.editors.UrlLinkEditor; import com.fr.design.mainframe.widget.renderer.PictureRenderer; import com.fr.design.mainframe.widget.renderer.UrlLinkRenderer; -import com.fr.form.ui.widget.PictureWidget; +import com.fr.form.ui.PictureWidget; import com.fr.general.IOUtils; import com.fr.stable.ArrayUtils; import java.awt.Dimension; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java index d2c8f7c30a..9e72b5c2ac 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java @@ -9,7 +9,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.wrappers.PictureModelWrapper; import com.fr.design.report.SelectImagePane; -import com.fr.form.ui.widget.PictureWidget; +import com.fr.form.ui.PictureWidget; import com.fr.general.ComparatorUtils; import com.fr.report.cell.FloatElement; import com.fr.report.cell.cellattr.CellImage; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java index b366b7d75a..c7bbff80a3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java @@ -2,7 +2,7 @@ package com.fr.design.mainframe.widget.editors; import com.fr.design.mainframe.widget.accessibles.AccessiblePictureModelEditor; import com.fr.design.mainframe.widget.accessibles.AccessiblePropertyEditor; -import com.fr.form.ui.widget.PictureWidget; +import com.fr.form.ui.PictureWidget; /** * *

图片控件的图片选择、编辑器

From 5d5204e3acc0fa2c05afbabe9830a6b6ef26befd Mon Sep 17 00:00:00 2001 From: "Jimmy.Zheng" Date: Mon, 5 Sep 2022 17:33:36 +0800 Subject: [PATCH 08/21] =?UTF-8?q?REPORT-70593=20=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E4=BB=85=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=EF=BC=8C=E6=8C=AA=E4=B8=AA=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/gui/core/WidgetOption.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 21e9836136..4c9db5a6a0 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 @@ -15,7 +15,7 @@ import com.fr.form.ui.ListEditor; import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.NumberEditor; import com.fr.form.ui.Password; -import com.fr.form.ui.widget.PictureWidget; +import com.fr.form.ui.PictureWidget; import com.fr.form.ui.RadioGroup; import com.fr.form.ui.TextArea; import com.fr.form.ui.TextEditor; From ceb1fbc6ab55b80dad9e0cb17b5a3908664744b2 Mon Sep 17 00:00:00 2001 From: Yvan Date: Wed, 7 Sep 2022 11:49:02 +0800 Subject: [PATCH 09/21] =?UTF-8?q?REPORT-79111=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=88=86=E7=BB=84=E6=8F=92=E4=BB=B6-=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E4=B9=8B=E5=90=8E=EF=BC=8C=E5=A4=8D=E5=88=B6=E5=86=B3?= =?UTF-8?q?=E7=AD=96=E6=8A=A5=E8=A1=A8=E7=9A=84=E6=8A=A5=E8=A1=A8=E5=9D=97?= =?UTF-8?q?=EF=BC=8C=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E4=B8=80=E8=B5=B7=E5=A4=8D=E5=88=B6=20=E3=80=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91=E7=B2=98=E8=B4=B4=E7=9A=84?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E9=87=8C=E5=B0=86BasicTableDataTreePane?= =?UTF-8?q?=E5=BC=BA=E8=BD=AC=E6=88=90=E4=BA=86TableDataTreePane=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=8F=92=E4=BB=B6=E9=87=8C=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E7=9A=84BasicTableDataTreePane=E7=9A=84=E5=AD=90=E7=B1=BB?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E5=BC=BA=E8=BD=AC=E5=A4=B1=E8=B4=A5=E6=8A=A5?= =?UTF-8?q?=E9=94=99=20=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF?= =?UTF-8?q?=E3=80=91=E5=88=A0=E6=8E=89=E5=BC=BA=E8=BD=AC=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E5=90=8E=E7=BB=AD=E7=9A=84=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E4=B9=9F=E5=9D=87=E4=B8=BA=E6=8A=BD=E8=B1=A1=E7=B1=BB=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E6=8A=BD=E8=B1=A1=E6=96=B9=E6=B3=95=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E4=BF=9D=E8=AF=81=E4=B8=8D=E5=BD=B1=E5=93=8D=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=20=E3=80=90review=E5=BB=BA=E8=AE=AE=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/tabledata/paste/TableDataFollowingPasteUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java b/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java index 4c39e28545..b82423fe71 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java @@ -5,6 +5,7 @@ import com.fr.base.chart.BaseChartCollection; import com.fr.data.TableDataSource; import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.design.DesignModelAdapter; +import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; @@ -22,7 +23,6 @@ import com.fr.form.ui.DictionaryContainer; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.concept.data.ValueInitializer; -import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.report.cell.FloatElement; import com.fr.report.cell.tabledata.ElementUsedTableDataProvider; @@ -57,7 +57,7 @@ public class TableDataFollowingPasteUtils { } // 获取当前的TableDataTreePane DesignModelAdapter currentModelAdapter = DesignModelAdapter.getCurrentModelAdapter(); - TableDataTreePane tableDataTreePane = (TableDataTreePane) TableDataTreePane.getInstanceWithoutRefreshEverytime(currentModelAdapter); + BasicTableDataTreePane tableDataTreePane = TableDataTreePane.getInstanceWithoutRefreshEverytime(currentModelAdapter); // 粘贴(添加)数据集 for (Map.Entry dataWrapperEntry : tableDataWrapperMap.entrySet()) { String dsName = dataWrapperEntry.getKey(); From e42c9bd885991453b834f918b22b51339651f655 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 7 Sep 2022 16:32:31 +0800 Subject: [PATCH 10/21] =?UTF-8?q?REPORT-79909=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E5=A4=B1=E8=B4=A5=EF=BC=8C=E6=9C=89?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=90=8D=E7=A7=B0=E5=8F=ABWorkBook8888888888?= =?UTF-8?q?8888.cpt=E5=AF=BC=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/JTemplateNameHelper.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java index 22d5985ba9..6a593734bf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java @@ -5,6 +5,7 @@ import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.stable.StringUtils; import javax.swing.tree.DefaultMutableTreeNode; +import java.math.BigInteger; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -27,19 +28,19 @@ public class JTemplateNameHelper { DefaultMutableTreeNode gen = (DefaultMutableTreeNode) tt.getModel().getRoot(); String[] str = new String[gen.getChildCount()]; - List reportNum = new ArrayList<>(); + List reportNum = new ArrayList<>(); for (int j = 0; j < gen.getChildCount(); j++) { str[j] = gen.getChildAt(j).toString(); //返回文件名中的index(算法中没有再匹配文件后缀了,因为DefaultMutableTreeNode中已经匹配过了) - Integer index = getFileNameIndex(prefix, str[j]); + BigInteger index = getFileNameIndex(prefix, str[j]); if (index != null) { reportNum.add(index); } } Collections.sort(reportNum); - int idx = reportNum.size() > 0 ? reportNum.get(reportNum.size() - 1) + 1 : 1; + BigInteger idx = reportNum.size() > 0 ? reportNum.get(reportNum.size() - 1).add(BigInteger.valueOf(1)) : BigInteger.valueOf(1); - idx = idx + currentIndex; + idx = idx.add(BigInteger.valueOf(currentIndex)); currentIndex++; return prefix + idx; } @@ -52,7 +53,7 @@ public class JTemplateNameHelper { * @Author Henry.Wang * @Date 2021/4/9 11:13 **/ - private static Integer getFileNameIndex(String prefix, String fileName) { + private static BigInteger getFileNameIndex(String prefix, String fileName) { if (fileName.length() <= prefix.length()) { return null; } @@ -78,9 +79,10 @@ public class JTemplateNameHelper { } } String s = new String(chars).substring(0, i - prefix.length()); + BigInteger integer = new BigInteger(s,10); if (StringUtils.isBlank(s)) { return null; } - return Integer.valueOf(s); + return integer; } } From c871018ac6c908a1823b0e23d3a056916bbc1596 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 7 Sep 2022 17:02:06 +0800 Subject: [PATCH 11/21] =?UTF-8?q?REPORT-79909=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E5=A4=B1=E8=B4=A5=EF=BC=8C=E6=9C=89?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=90=8D=E7=A7=B0=E5=8F=ABWorkBook8888888888?= =?UTF-8?q?8888.cpt=E5=AF=BC=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/JTemplateNameHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java index 6a593734bf..c1f9f9be8f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java @@ -79,7 +79,7 @@ public class JTemplateNameHelper { } } String s = new String(chars).substring(0, i - prefix.length()); - BigInteger integer = new BigInteger(s,10); + BigInteger integer = new BigInteger(s, 10); if (StringUtils.isBlank(s)) { return null; } From 7a07ff6fbd2c35e799d6edd4811bfacb735ca584 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 7 Sep 2022 20:53:32 +0800 Subject: [PATCH 12/21] =?UTF-8?q?=E9=87=8D=E6=9E=84getFileNameIndex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/JTemplateNameHelper.java | 47 ++++++++++--------- .../mainframe/JTemplateNameHelperTest.java | 23 +++++++++ 2 files changed, 48 insertions(+), 22 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java index c1f9f9be8f..696e971687 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java @@ -39,7 +39,6 @@ public class JTemplateNameHelper { } Collections.sort(reportNum); BigInteger idx = reportNum.size() > 0 ? reportNum.get(reportNum.size() - 1).add(BigInteger.valueOf(1)) : BigInteger.valueOf(1); - idx = idx.add(BigInteger.valueOf(currentIndex)); currentIndex++; return prefix + idx; @@ -54,35 +53,39 @@ public class JTemplateNameHelper { * @Date 2021/4/9 11:13 **/ private static BigInteger getFileNameIndex(String prefix, String fileName) { - if (fileName.length() <= prefix.length()) { + //如果文件名长度小于等于前缀长度或者匹配前缀失败,直接返回就可以了 + if ((prefix.length() >= fileName.length()) || (!StringUtils.equals(prefix, fileName.substring(0, prefix.length())))) { return null; } - char[] chars = new char[fileName.length()]; - int i = 0; - for (; i < fileName.length(); i++) { + BigInteger integer = null; + integer = matchFileNameIndex(prefix, fileName); + return integer; + } + + private static BigInteger matchFileNameIndex(String prefix, String fileName) { + StringBuilder result = new StringBuilder(); + for (int i = prefix.length(); i < fileName.length(); i++) { char c = fileName.charAt(i); - //匹配前缀 - if (i < prefix.length()) { - if (c != prefix.charAt(i)) { - return null; - } + if (isDot(c)) { + break; } else { - if (c == '.') { - break; - } else { - //匹配0~9 - if (c < 48 || c > 57) { - return null; - } - chars[i - prefix.length()] = c; + if (isNotNumber(c)) { + return null; } + result.append(c); } } - String s = new String(chars).substring(0, i - prefix.length()); - BigInteger integer = new BigInteger(s, 10); - if (StringUtils.isBlank(s)) { + if (StringUtils.isBlank(result.toString())) { return null; } - return integer; + return new BigInteger(result.toString(), 10); + } + + private static boolean isNotNumber(char c) { + return c < 48 || c > 57; + } + + private static boolean isDot(char c) { + return c == '.'; } } diff --git a/designer-base/src/test/java/com/fr/design/mainframe/JTemplateNameHelperTest.java b/designer-base/src/test/java/com/fr/design/mainframe/JTemplateNameHelperTest.java index 032e715f60..0202028480 100644 --- a/designer-base/src/test/java/com/fr/design/mainframe/JTemplateNameHelperTest.java +++ b/designer-base/src/test/java/com/fr/design/mainframe/JTemplateNameHelperTest.java @@ -2,6 +2,8 @@ package com.fr.design.mainframe; import junit.framework.TestCase; +import com.fr.invoke.Reflect; + /** * @author shine * @version 10.0 @@ -18,6 +20,27 @@ public class JTemplateNameHelperTest extends TestCase { String name1 = JTemplateNameHelper.newTemplateNameByIndex("TEST"); assertEquals("TEST2", name1); + } + + public void testGetFileNameIndex() { + //正常情况 + assertEquals("1", Reflect.on(JTemplateNameHelper.class).call("getFileNameIndex", "WorkBook", "WorkBook1").toString()); + + //正常情况 + assertEquals("8888888888", Reflect.on(JTemplateNameHelper.class).call("getFileNameIndex", "WorkBook", "WorkBook8888888888").toString()); + + //正常情况 + assertEquals("88812214128888881231238123123", Reflect.on(JTemplateNameHelper.class).call("getFileNameIndex", "WorkBook", "WorkBook88812214128888881231238123123").toString()); + + //前缀不匹配 + assertNull(Reflect.on(JTemplateNameHelper.class).call("getFileNameIndex", "Work123", "WorkBook8888888888").get()); + + //前缀为空 + assertNull(Reflect.on(JTemplateNameHelper.class).call("getFileNameIndex", "", "WorkBook8888888888").get()); + + //文件长度小于前缀 + assertNull(Reflect.on(JTemplateNameHelper.class).call("getFileNameIndex", "WorkBook", "").get()); + } } From 03523e13c5b76315aef34a845cd7ff81d4344958 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 7 Sep 2022 21:00:27 +0800 Subject: [PATCH 13/21] =?UTF-8?q?REPORT-79909=20=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/JTemplateNameHelper.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java index 696e971687..96ca5b4843 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java @@ -62,6 +62,12 @@ public class JTemplateNameHelper { return integer; } + /** + * 匹配文件名称的数字后缀Index + * @param prefix 前缀 + * @param fileName 文件名称全名 + * @return 返回对应的数字后缀Index + */ private static BigInteger matchFileNameIndex(String prefix, String fileName) { StringBuilder result = new StringBuilder(); for (int i = prefix.length(); i < fileName.length(); i++) { @@ -81,10 +87,20 @@ public class JTemplateNameHelper { return new BigInteger(result.toString(), 10); } + /** + * 是否不属于数字0-9 + * @param c 用于判断的char + * @return 返回对应判断结果 + */ private static boolean isNotNumber(char c) { return c < 48 || c > 57; } + /** + * 是否属于'.' + * @param c 用于判断的char + * @return 返回对应判断结果 + */ private static boolean isDot(char c) { return c == '.'; } From 3b701870da3f35c0defe1a1e283b51816e30ca1b Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 9 Sep 2022 11:42:02 +0800 Subject: [PATCH 14/21] =?UTF-8?q?REPORT-79934=20=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=9A=84A0=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=B8=8E=E6=A8=A1=E6=9D=BF=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E7=9A=84=E9=BB=98=E8=AE=A4=E5=8D=95=E5=85=83=E6=A0=BC=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 在模板A打开时,新建模板B,模板B新建过程中,使用 HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() 来获取当前正在编辑的模板,从而获取正在编辑模板的主题,从而获取主题内的默认单元格样式, 以初始化[0,0]单元格样式. 但由于B还在创建过程中,currentEditingTemplate没有更新,currentEditingTemplate 依然是模板A,所以最终使用了模板A的主题的默认单元格样式,来初始化B的[0,0]单元格 【改动思路】 B在初始化单元格[0,0]前,已经设置好自己的主题了,只需要要某种方式,从里面取出来就可以了, 不过因为currentEditingTemplate不可靠了,所以需要在HistoryTemplateListCache中引入 新的属性openingOrEditingTemplate 在正在打开的模板或切换模板时,更新openingOrEditingTemplate. --- .../fr/design/file/HistoryTemplateListCache.java | 14 ++++++++++++-- .../java/com/fr/design/mainframe/JTemplate.java | 1 + .../DefaultThemedTemplateCellElementCase.java | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 0b093e4ef1..d7f46ea76b 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -41,6 +41,8 @@ public class HistoryTemplateListCache implements CallbackEvent { private List> historyList; private JTemplate editingTemplate; + private JTemplate openingOrEditingTemplate; + public static HistoryTemplateListCache getInstance() { return Holder.INSTANCE; } @@ -98,8 +100,15 @@ public class HistoryTemplateListCache implements CallbackEvent { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - - + + public void setCurrentOpeningTemplate(JTemplate jt) { + this.openingOrEditingTemplate = jt; + } + + public JTemplate getCurrentOpeningOrEditingTemplate() { + return openingOrEditingTemplate; + } + /** * 需要使用 {@link JTemplate#isValid(JTemplate)} 来判断空 * @@ -116,6 +125,7 @@ public class HistoryTemplateListCache implements CallbackEvent { */ public void setCurrentEditingTemplate(JTemplate jt) { this.editingTemplate = jt; + this.openingOrEditingTemplate = jt; if (!JTemplate.isValid(jt)) { return; 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 a445621146..fe0e4ee4ff 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 @@ -190,6 +190,7 @@ public abstract class JTemplate> public JTemplate(T t, FILE file, boolean isNewFile, Parameter[] parameters) { super(t); + HistoryTemplateListCache.getInstance().setCurrentOpeningTemplate(this); if (isNewFile) { // REPORT-58486: 必须在初始的UndoState创建前设置主题,使得初始的UndoState就包含了主题效果 setUpTheme4NewTemplate(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java index 123875eefc..8b1abe71b4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java @@ -32,7 +32,7 @@ public class DefaultThemedTemplateCellElementCase { } private static DefaultTemplateCellElement themingCellElement(DefaultTemplateCellElement cellElement) { - JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentOpeningOrEditingTemplate(); if (JTemplate.isValid(template)) { TemplateTheme theme = template.getTemplateTheme(); ThemedCellStyle themedCellStyle = theme.getCellStyleList().getUse4Default(); From 911ca18f71722cbbeb8d5fe483e4d4b93d482938 Mon Sep 17 00:00:00 2001 From: "Jimmy.Zheng" Date: Wed, 14 Sep 2022 12:47:51 +0800 Subject: [PATCH 15/21] =?UTF-8?q?Revert=20"REPORT-70593=20=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=8E=A7=E4=BB=B6=E5=90=88=E5=B9=B6=E4=B8=BB=E4=BB=A3?= =?UTF-8?q?=E7=A0=81"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit a786a983 --- .../com/fr/design/gui/core/WidgetOption.java | 7 +- .../HyperlinkGroupPaneActionProvider.java | 2 - .../buttonicon/widget/picture_widget_16.png | Bin 1061 -> 0 bytes .../widget/picture_widget_designer_bg.png | Bin 4933 -> 0 bytes .../designer/creator/XCreatorUtils.java | 2 - .../fr/design/designer/creator/XPicture.java | 74 ------------ .../com/fr/design/designer/ui/ImgPanel.java | 111 ------------------ .../AccessiblePictureModelEditor.java | 77 ------------ .../AccessibleUrlLinkModelEditor.java | 57 --------- .../widget/editors/PictureEditor.java | 17 --- .../widget/editors/UrlLinkEditor.java | 17 --- .../widget/renderer/PictureRenderer.java | 15 --- .../widget/renderer/UrlLinkRenderer.java | 16 --- .../widget/wrappers/PictureModelWrapper.java | 34 ------ .../widget/wrappers/UrlLinkModelWrapper.java | 33 ------ .../com/fr/design/report/SelectImagePane.java | 67 +++++------ .../fr/start/module/DesignerActivator.java | 6 +- .../com/fr/start/preload/ImagePreLoader.java | 1 - 18 files changed, 37 insertions(+), 499 deletions(-) delete mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/picture_widget_16.png delete mode 100644 designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png delete mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleUrlLinkModelEditor.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/editors/UrlLinkEditor.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/PictureRenderer.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/UrlLinkRenderer.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/PictureModelWrapper.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/UrlLinkModelWrapper.java rename {designer-base => designer-realize}/src/main/java/com/fr/design/report/SelectImagePane.java (96%) 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 4c9db5a6a0..258f558a71 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,6 @@ package com.fr.design.gui.core; import com.fr.base.BaseUtils; -import com.fr.base.svg.IconUtils; import com.fr.form.ui.Button; import com.fr.form.ui.CheckBox; import com.fr.form.ui.CheckBoxGroup; @@ -15,7 +14,6 @@ import com.fr.form.ui.ListEditor; import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.NumberEditor; import com.fr.form.ui.Password; -import com.fr.form.ui.PictureWidget; import com.fr.form.ui.RadioGroup; import com.fr.form.ui.TextArea; import com.fr.form.ui.TextEditor; @@ -144,7 +142,7 @@ public abstract class WidgetOption implements Serializable { */ public static WidgetOption[] getFormWidgetIntance() { return new WidgetOption[]{TEXTEDITOR, LABEL, FREEBUTTON, COMBOBOX, COMBOCHECKBOX, DATEEDITOR, - NUMBEREDITOR, TREECOMBOBOX, RADIOGROUP, CHECKBOXGROUP, TEXTAREA, PASSWORD, CHECKBOX, TREE, MULTI_FILEEDITOR,PICTURE}; + NUMBEREDITOR, TREECOMBOBOX, RADIOGROUP, CHECKBOXGROUP, TEXTAREA, PASSWORD, CHECKBOX, TREE, MULTI_FILEEDITOR}; } public static final WidgetOption DATEEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Date"), @@ -216,7 +214,4 @@ public abstract class WidgetOption implements Serializable { 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); - public static final WidgetOption PICTURE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Image"), IconUtils.readIcon("/com/fr/web/images/form/resources/picture_widget_16.png"), - PictureWidget.class); - } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java index be0d8e8523..525bb5b792 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java @@ -8,8 +8,6 @@ import com.fr.design.designer.TargetComponent; */ public interface HyperlinkGroupPaneActionProvider { - String XML_TAG = "HyperlinkGroupPane"; - /** * 刷新面板展示 * diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/picture_widget_16.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/picture_widget_16.png deleted file mode 100644 index fbf334ad22a2e3a9985830d225959a6ea40379b0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1061 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 NL`TL%oDNfH{|_#1j diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index e52233e0ef..eb1f3497a3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -46,7 +46,6 @@ import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.NameWidget; import com.fr.form.ui.NumberEditor; import com.fr.form.ui.Password; -import com.fr.form.ui.PictureWidget; import com.fr.form.ui.Radio; import com.fr.form.ui.RadioGroup; import com.fr.form.ui.TextArea; @@ -184,7 +183,6 @@ public class XCreatorUtils { objectMap.put(CardSwitchButton.class, XCardSwitchButton.class); objectMap.put(CardAddButton.class, XCardAddButton.class); objectMap.put(WidgetErrorMarker.class, ErrorCreator.class); - objectMap.put(PictureWidget.class, XPicture.class); } private static void reInitExtra() { diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java b/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java deleted file mode 100644 index 7dd23bd4ce..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.fr.design.designer.creator; - -import com.fr.design.designer.ui.ImgPanel; -import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.widget.editors.PictureEditor; -import com.fr.design.mainframe.widget.editors.UrlLinkEditor; -import com.fr.design.mainframe.widget.renderer.PictureRenderer; -import com.fr.design.mainframe.widget.renderer.UrlLinkRenderer; -import com.fr.form.ui.PictureWidget; -import com.fr.general.IOUtils; -import com.fr.stable.ArrayUtils; -import java.awt.Dimension; -import java.awt.Image; -import java.beans.IntrospectionException; -import javax.swing.JComponent; - -/** -* -*

图片控件的creator

-* -* @author Jimmy.Zheng created on 2022/8/11 21:16 -**/ -public class XPicture extends XWidgetCreator { - - public XPicture(PictureWidget widget, Dimension dimension) { - super(widget, dimension); - } - - @Override - protected String getIconName() { - return "picture_widget_16.png"; - } - - @Override - public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[]{ - new CRPropertyDescriptor("picUrl", toData().getClass()) - .setI18NName(Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Image")) - .setEditorClass(PictureEditor.class) - .setRendererClass(PictureRenderer.class) - .putKeyValue("category", "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("urlLink", toData().getClass()) - .setI18NName(Toolkit.i18nText("Fine-Design_Basic_Hyperlink")) - .setEditorClass(UrlLinkEditor.class) - .setRendererClass(UrlLinkRenderer.class) - .putKeyValue( - "category", "Fine-Design_Basic_Advanced")}); - } - - @Override - protected JComponent initEditor() { - PictureWidget pictureWidget = (PictureWidget) this.data; - if (this.editor == null) { - this.editor = FRGUIPaneFactory.createBorderLayout_S_Pane(); - Object value = pictureWidget.getPicUrl().getValue(); - ImgPanel imgPanel = new ImgPanel(); - if (value instanceof Image) { - imgPanel.setBackgroundImage((Image) value); - imgPanel.setImageDisplayMode(pictureWidget.getShowType()); - } else { - imgPanel.setBackgroundImage(IOUtils.readImage("com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png")); - imgPanel.setImageDisplayMode(0); - } - this.editor.add(imgPanel, "Center"); - } - return this.editor; - } - - @Override - public boolean canEnterIntoParaPane() { - return false; - } -} diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java b/designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java deleted file mode 100644 index 05aa8ba465..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.fr.design.designer.ui; - -import com.fr.general.ImageWithSuffix; -import java.awt.Graphics; -import java.awt.Image; -import javax.swing.JComponent; - - -/** -* -*

图片控件中的已选图片展示面板

-* -* @author Jimmy.Zheng created on 2022/8/11 21:17 -**/ -public class ImgPanel extends JComponent { - private static final long serialVersionUID = 1L; - private Image backgroundImage; - private int imageDisplayMode; - private int modeIndex; - - public ImgPanel() { - this(null, 0); - } - - public ImgPanel(Image image, int modeName) { - setBackgroundImage(image); - setImageDisplayMode(modeName); - } - - public void setBackgroundImage(Image image) { - this.backgroundImage = image; - repaint(); - } - - public Image getBackgroundImage() { - return this.backgroundImage; - } - - public void setImageDisplayMode(int modeName) { - if (modeName == 1) { - this.modeIndex = 0; - } - - if (modeName == 0) { - this.imageDisplayMode = 0; - this.modeIndex = 1; - } - - if (modeName == 2) { - this.imageDisplayMode = 2; - this.modeIndex = 2; - } - if (modeName == 4) { - this.imageDisplayMode = 4; - this.modeIndex = 3; - } - repaint(); - } - - public int getImageDisplayMode() { - return this.imageDisplayMode; - } - - @Override - protected void paintComponent(Graphics g) { - super.paintComponent(g); - - if (this.backgroundImage != null) { - if (this.backgroundImage instanceof ImageWithSuffix) { - this.backgroundImage = ((ImageWithSuffix) backgroundImage).getImage(); - } - int width = getWidth(); - int height = getHeight(); - int imageWidth = this.backgroundImage.getWidth(this); - int imageHeight = this.backgroundImage.getHeight(this); - - switch (this.modeIndex) { - case 0: - int x = (width - imageWidth) / 2; - int y = (height - imageHeight) / 2; - g.drawImage(this.backgroundImage, x, y, this); - break; - case 1: - for (int ix = 0; ix < width; ix += imageWidth) { - for (int iy = 0; iy < height; iy += imageHeight) { - g.drawImage(this.backgroundImage, ix, iy, this); - } - } - - break; - case 2: - g.drawImage(this.backgroundImage, 0, 0, width, height, this); - break; - case 3: - double sx = 1.0 * width / imageWidth; - double sy = 1.0 * height / imageHeight; - - if (sx > sy) { - sx = sy; - width = (int) (sx * imageWidth); - } else { - sy = sx; - height = (int) (sy * imageHeight); - } - int xx = (getWidth() - width) / 2; - int yy = (getHeight() - height) / 2; - g.drawImage(this.backgroundImage, xx, yy, width, height, this); - } - } - } -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java deleted file mode 100644 index 9e72b5c2ac..0000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.fr.design.mainframe.widget.accessibles; - -import com.fr.base.Style; -import com.fr.design.DesignModelAdapter; -import com.fr.design.designer.creator.XPicture; -import com.fr.design.designer.ui.ImgPanel; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.WidgetPropertyPane; -import com.fr.design.mainframe.widget.wrappers.PictureModelWrapper; -import com.fr.design.report.SelectImagePane; -import com.fr.form.ui.PictureWidget; -import com.fr.general.ComparatorUtils; -import com.fr.report.cell.FloatElement; -import com.fr.report.cell.cellattr.CellImage; -import javax.swing.JComponent; - - -/** -* -*

图片控件的图片选择、编辑器

-* -* @author Jimmy.Zheng created on 2022/8/11 21:13 -**/ -public class AccessiblePictureModelEditor extends UneditableAccessibleEditor { - protected FloatElement element = new FloatElement(); - private PictureWidget pic; - - public AccessiblePictureModelEditor(PictureWidget pic) { - super(new PictureModelWrapper()); - this.pic = pic; - } - - @Override - public FloatElement getValue() { - return (FloatElement) super.getValue(); - } - - @Override - protected void showEditorPane() { - final SelectImagePane imageEditorPane = new SelectImagePane(); - if (super.getValue() != null) { - this.element = ((FloatElement) super.getValue()); - } - this.element.setStyle(Style.getInstance().deriveImageLayout(this.pic.getShowType())); - imageEditorPane.populate(this.element); - final Object oldValue = this.element.getValue(); - final Style oldStyle = this.element.getStyle(); - final String oldname = this.element.getName(); - imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - @Override - public void doOk() { - CellImage cellImage = imageEditorPane.update(); - if ((!ComparatorUtils.equals(cellImage.getImage(), oldValue)) || (!ComparatorUtils.equals(cellImage.getStyle(), oldStyle))) { - AccessiblePictureModelEditor.this.element.setValue(cellImage.getImage()); - AccessiblePictureModelEditor.this.element.setStyle(cellImage.getStyle()); - AccessiblePictureModelEditor.this.element.setName(imageEditorPane.getSelectedImage() == null ? oldname : imageEditorPane.getSelectedImage().toString()); - AccessiblePictureModelEditor.this.setValue(AccessiblePictureModelEditor.this.element); - AccessiblePictureModelEditor.this.pic.setShowType(cellImage.getStyle().getImageLayout()); - AccessiblePictureModelEditor.this.pic.setPicUrl(element); - ImgPanel p = AccessiblePictureModelEditor.this.getCurrentImgPanel(); - p.setBackgroundImage(cellImage.getBufferImage()); - p.setImageDisplayMode(cellImage.getStyle().getImageLayout()); - AccessiblePictureModelEditor.this.fireStateChanged(); - DesignModelAdapter d = DesignModelAdapter.getCurrentModelAdapter(); - d.fireTargetModified(); - } - } - }).setVisible(true); - } - - private ImgPanel getCurrentImgPanel() { - XPicture xPicture = (XPicture) WidgetPropertyPane.getInstance().getEditingFormDesigner().getSelectionModel().getSelection().getSelectedCreator(); - JComponent editor = (JComponent) xPicture.getComponent(0); - return (ImgPanel) editor.getComponent(0); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleUrlLinkModelEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleUrlLinkModelEditor.java deleted file mode 100644 index 2dd4b54991..0000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleUrlLinkModelEditor.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.fr.design.mainframe.widget.accessibles; - -import com.fr.design.DesignModelAdapter; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; -import com.fr.design.gui.xpane.FormHyperlinkGroupPane; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.widget.wrappers.UrlLinkModelWrapper; -import com.fr.js.NameJavaScriptGroup; -import com.fr.stable.bridge.StableFactory; - -/** - *

表单图片控件的链接编辑器

- * @author Jimmy - */ -public class AccessibleUrlLinkModelEditor extends UneditableAccessibleEditor { - private FormHyperlinkGroupPane hyperlinkPane; - - public AccessibleUrlLinkModelEditor() { - super(new UrlLinkModelWrapper()); - } - /** - * 原插件使用 - *

DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPaneNoPop( - * HyperlinkGroupPaneActionImpl.getInstance()));

获取{@see this.hyperlinkPane} - * 合并插件依赖不到,换种方式 用{@see DesignerActivator将实例注册了} - */ - @Override - protected void showEditorPane() { - if (this.hyperlinkPane == null) { - HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider = StableFactory.getMarkedInstanceObjectFromClass(HyperlinkGroupPaneActionProvider.XML_TAG,HyperlinkGroupPaneActionProvider.class); - this.hyperlinkPane = (FormHyperlinkGroupPane) DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPaneNoPop( - hyperlinkGroupPaneActionProvider); - } - BasicDialog dialog = this.hyperlinkPane.showWindow(DesignerContext.getDesignerFrame()); - dialog.addDialogActionListener(new DialogActionAdapter() { - @Override - public void doOk() { - super.doOk(); - NameJavaScriptGroup hyperlinks = AccessibleUrlLinkModelEditor.this.hyperlinkPane.updateJSGroup(); - AccessibleUrlLinkModelEditor.this.setValue(hyperlinks); - AccessibleUrlLinkModelEditor.this.fireStateChanged(); - DesignModelAdapter d = DesignModelAdapter.getCurrentModelAdapter(); - d.fireTargetModified(); - } - }); - this.hyperlinkPane.populate(getValue()); - - dialog.setVisible(true); - } - - @Override - public NameJavaScriptGroup getValue() { - return (NameJavaScriptGroup) super.getValue(); - } -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java deleted file mode 100644 index c7bbff80a3..0000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.fr.design.mainframe.widget.editors; - -import com.fr.design.mainframe.widget.accessibles.AccessiblePictureModelEditor; -import com.fr.design.mainframe.widget.accessibles.AccessiblePropertyEditor; -import com.fr.form.ui.PictureWidget; -/** -* -*

图片控件的图片选择、编辑器

-* -* @author Jimmy.Zheng created on 2022/8/11 21:15 -**/ -public class PictureEditor extends AccessiblePropertyEditor { - - public PictureEditor(Object o) { - super(new AccessiblePictureModelEditor((PictureWidget) o)); - } -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/UrlLinkEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/UrlLinkEditor.java deleted file mode 100644 index 195e8f5250..0000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/UrlLinkEditor.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.fr.design.mainframe.widget.editors; - -import com.fr.design.mainframe.widget.accessibles.AccessiblePropertyEditor; -import com.fr.design.mainframe.widget.accessibles.AccessibleUrlLinkModelEditor; - -/** -* -*

图片控件的链接编辑器

-* -* @author Jimmy.Zheng created on 2022/8/11 21:19 -**/ -public class UrlLinkEditor extends AccessiblePropertyEditor { - - public UrlLinkEditor() { - super(new AccessibleUrlLinkModelEditor()); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/PictureRenderer.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/PictureRenderer.java deleted file mode 100644 index 82fcc85b43..0000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/PictureRenderer.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.fr.design.mainframe.widget.renderer; - -import com.fr.design.mainframe.widget.wrappers.PictureModelWrapper; - -/** - *

图片控件的图片编辑器的EncoderCellRenderer

- * - * @author Jimmy.Zheng created on 2022/8/11 21:29 - **/ -public class PictureRenderer extends EncoderCellRenderer { - - public PictureRenderer() { - super(new PictureModelWrapper()); - } -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/UrlLinkRenderer.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/UrlLinkRenderer.java deleted file mode 100644 index a81187d2d5..0000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/UrlLinkRenderer.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.fr.design.mainframe.widget.renderer; - - -import com.fr.design.mainframe.widget.wrappers.UrlLinkModelWrapper; - -/** - *

图片控件的链接编辑器的EncoderCellRenderer

- * - * @author Jimmy.Zheng created on 2022/8/11 21:29 - **/ -public class UrlLinkRenderer extends EncoderCellRenderer { - - public UrlLinkRenderer() { - super(new UrlLinkModelWrapper()); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/PictureModelWrapper.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/PictureModelWrapper.java deleted file mode 100644 index ed9fd0a4ac..0000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/PictureModelWrapper.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.fr.design.mainframe.widget.wrappers; - -import com.fr.design.Exception.ValidationException; -import com.fr.design.designer.properties.Decoder; -import com.fr.design.designer.properties.Encoder; -import com.fr.report.cell.FloatElement; -import com.fr.stable.StringUtils; - -/** - *

图片选择器 {@link com.fr.design.mainframe.widget.accessibles.AccessiblePictureModelEditor}的 Wrapper

- *

插件中直接移入,未作改动

- * - * @author Jimmy.Zheng created on 2022/8/11 21:25 - **/ -public class PictureModelWrapper implements Encoder, Decoder { - - @Override - public FloatElement decode(String txt) { - return null; - } - - @Override - public void validate(String txt) throws ValidationException { - // do nothing - } - - @Override - public String encode(FloatElement v) { - if (v != null) { - return v.getName(); - } - return StringUtils.EMPTY; - } -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/UrlLinkModelWrapper.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/UrlLinkModelWrapper.java deleted file mode 100644 index a892065ad7..0000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/UrlLinkModelWrapper.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.fr.design.mainframe.widget.wrappers; - -import com.fr.design.Exception.ValidationException; -import com.fr.design.designer.properties.Decoder; -import com.fr.design.designer.properties.Encoder; -import com.fr.js.NameJavaScriptGroup; - -/** - *

链接选择器 {@link com.fr.design.mainframe.widget.accessibles.AccessibleUrlLinkModelEditor}的 Wrapper

- *

插件中直接移入,未作改动

- * - * @author Jimmy.Zheng created on 2022/8/11 21:28 - **/ -public class UrlLinkModelWrapper implements Encoder, Decoder { - - @Override - public NameJavaScriptGroup decode(String txt) { - return null; - } - - @Override - public void validate(String txt) throws ValidationException { - // do nothing - } - - @Override - public String encode(NameJavaScriptGroup v) { - if (v.size() > 0) { - return v.getNameHyperlink(0).getName(); - } - return null; - } -} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/report/SelectImagePane.java b/designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java similarity index 96% rename from designer-base/src/main/java/com/fr/design/report/SelectImagePane.java rename to designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java index 7781233aac..bcad15c76c 100644 --- a/designer-base/src/main/java/com/fr/design/report/SelectImagePane.java +++ b/designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java @@ -13,24 +13,22 @@ import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.painter.CellImagePainter; import com.fr.stable.Constants; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JFileChooser; +import javax.swing.JPanel; +import javax.swing.JScrollPane; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; -import javax.swing.BorderFactory; -import javax.swing.ButtonGroup; -import javax.swing.JFileChooser; -import javax.swing.JPanel; -import javax.swing.JScrollPane; /** - *

这个类主要用于插入图片时的设置

- *

这个类原本在designer-realize包下面,现在表单也可选择图片,所以应该抽为公用的base包。包名不变,应该不影响插件使用

- * - * @author Jimmy.Zheng created on 2022/8/11 21:22 - **/ + * 这个类主要用于插入图片时的设置 + */ public class SelectImagePane extends BasicPane { private ImagePreviewPane previewPane = null; @@ -41,31 +39,8 @@ public class SelectImagePane extends BasicPane { private UIRadioButton adjustRadioButton = null; private Style imageStyle = null; - ActionListener layoutActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent evt) { - setImageStyle(); - changeImageStyle(); - } - }; private File imageFile; - /** - * Select picture. - */ - ActionListener selectPictureActionListener = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent evt) { - int returnVal = imageFileChooser - .showOpenDialog(SelectImagePane.this); - if (returnVal != JFileChooser.CANCEL_OPTION) { - File selectedFile = imageFileChooser.getSelectedFile(); - imageFile = selectedFile; - ImgChooseWrapper.getInstance(previewPane, imageFileChooser, imageStyle, null).dealWithImageFile(returnVal); - } - } - }; public SelectImagePane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -127,6 +102,23 @@ public class SelectImagePane extends BasicPane { imageFileChooser.setMultiSelectionEnabled(false); } + /** + * Select picture. + */ + ActionListener selectPictureActionListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent evt) { + int returnVal = imageFileChooser + .showOpenDialog(SelectImagePane.this); + if (returnVal != JFileChooser.CANCEL_OPTION) { + File selectedFile = imageFileChooser.getSelectedFile(); + imageFile = selectedFile; + ImgChooseWrapper.getInstance(previewPane, imageFileChooser, imageStyle, null).dealWithImageFile(returnVal); + } + } + }; + // 调整图片样式,只有水平和垂直对齐以及拉伸。相对于背景,平铺不予考虑。 private void changeImageStyle() { previewPane.setImageStyle(this.imageStyle); @@ -145,6 +137,15 @@ public class SelectImagePane extends BasicPane { } } + ActionListener layoutActionListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent evt) { + setImageStyle(); + changeImageStyle(); + } + }; + @Override protected String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image"); 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 b69eda7993..e7a00a4f19 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 @@ -40,7 +40,6 @@ import com.fr.design.form.parameter.FormParaDesigner; import com.fr.design.fun.ElementUIProvider; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; -import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.hyperlink.ReportletHyperlinkPane; import com.fr.design.hyperlink.WebHyperlinkPane; import com.fr.design.hyperlink.popup.MobilePopupPane; @@ -55,7 +54,6 @@ import com.fr.design.login.message.DesignerMessageHelper; import com.fr.design.login.socketio.LoginAuthServer; import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.FormHierarchyTreePane; -import com.fr.design.mainframe.HyperlinkGroupPaneActionImpl; import com.fr.design.mainframe.InformationCollector; import com.fr.design.mainframe.JTemplateEvent; import com.fr.design.mainframe.WidgetPropertyPane; @@ -144,13 +142,14 @@ import com.fr.start.common.DesignerStartupPool; import com.fr.task.Once; import com.fr.workspace.WorkContext; import com.fr.xml.ReportXMLUtils; + +import javax.swing.SwingWorker; import java.awt.Image; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.concurrent.CompletableFuture; -import javax.swing.SwingWorker; /** * Created by juhaoyu on 2018/1/31. @@ -404,7 +403,6 @@ public class DesignerActivator extends Activator implements Prepare { private static void registerOtherPane() { StableFactory.registerMarkedClass(BBSGuestPaneProvider.XML_TAG, BBSGuestPane.class); - StableFactory.registerMarkedObject(HyperlinkGroupPaneActionProvider.XML_TAG, HyperlinkGroupPaneActionImpl.getInstance()); } /** 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 aad478348f..24d23565c0 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 @@ -242,7 +242,6 @@ public class ImagePreLoader { "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/web/images/form/resources/picture_widget_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", From 042b9e659f4194096e1e0b9034c0bdcacea468ab Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 19 Sep 2022 16:46:19 +0800 Subject: [PATCH 16/21] =?UTF-8?q?REPORT-80511=20=E5=90=AF=E5=A7=8B?= =?UTF-8?q?=E9=A1=B5=E5=90=AF=E5=8A=A8=E9=80=9F=E5=BA=A6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=201-=E8=AE=B0=E5=BD=95=E6=97=B6=E9=97=B4=E4=B8=8D=E5=87=86?= =?UTF-8?q?=EF=BC=8C=E8=A6=81=E4=BB=8E=E5=A4=B4=E5=BC=80=E5=A7=8B=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=202-=E5=8E=BB=E6=8E=89=E9=A2=84=E7=83=AD=E7=9A=84?= =?UTF-8?q?=E5=BD=B1=E5=93=8D=EF=BC=8C=E5=AF=B9=E7=9B=B4=E6=8E=A5=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E7=9A=84=E5=AE=A2=E6=88=B7=E4=B8=8D=E5=8F=8B=E5=A5=BD?= =?UTF-8?q?=203-=E4=B8=8D=E5=8E=BB=E6=AF=8F=E6=AC=A1=E9=83=BD=E8=AF=BB?= =?UTF-8?q?=E5=9B=BE=E7=89=87=EF=BC=8C=E5=9C=A8=E7=AD=89=E5=BE=85=E6=97=B6?= =?UTF-8?q?=E5=80=99=EF=BC=8CIO=20=E9=A2=91=E7=8E=87=E6=9E=81=E9=AB=98?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/startup/ui/StartupPageWindow.java | 5 +++-- .../src/main/java/com/fr/start/MainDesigner.java | 5 +++-- .../optimized/DesignerStartupPageActivator.java | 16 ++++------------ 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java index cb0442abd8..f15de856e9 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java @@ -74,6 +74,8 @@ public class StartupPageWindow extends JFrame { private static final Dimension SCREEN_SIZE = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); + private static final BufferedImage BACKGROUND_IMAGE = IOUtils.readImage("com/fr/design/startup/startup_page_background.jpg"); + private StartupPageWorkspacePanel workspacePanel; private JPanel recentOpenPanel; @@ -136,8 +138,7 @@ public class StartupPageWindow extends JFrame { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); - BufferedImage image = IOUtils.readImage("com/fr/design/startup/startup_page_background.jpg"); - g.drawImage(image, 0, 0, SCREEN_SIZE.width, SCREEN_SIZE.height, this); + g.drawImage(BACKGROUND_IMAGE, 0, 0, SCREEN_SIZE.width, SCREEN_SIZE.height, this); } }; this.contentPane.setLayout(getCenterLayout(body)); 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 122f5f9183..24c02893bc 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -119,12 +119,13 @@ public class MainDesigner extends BaseDesigner { * @param args 参数 */ public static void main(String[] args) { + StopWatch watch = new StopWatch(); + watch.start(); + DesignerStartupContext.getRecorder().start(); showSplash(); startPreload0(); - StopWatch watch = new StopWatch(); - watch.start(); DesignerLifecycleMonitorContext.getMonitor().beforeStart(); //启动运行时 FineRuntime.start(); diff --git a/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java b/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java index ccae1a19a6..e41dafcc8f 100644 --- a/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java @@ -9,7 +9,6 @@ import com.fr.start.SplashContext; import com.fr.start.common.DesignerStartupContext; import com.fr.start.module.StartupArgs; import com.fr.start.util.DesignerStartupPageUtil; -import com.fr.start.warmup.DesignerPreWarmTask; import com.fr.startup.metric.DesignerMetrics; import com.fr.startup.metric.DesignerStartupModel; import com.fr.startup.ui.StartupPageModel; @@ -63,10 +62,6 @@ public class DesignerStartupPageActivator extends Activator { // 启动页关闭 SplashContext.getInstance().hide(); - // 预热任务启动 - DesignerPreWarmTask warmTask = new DesignerPreWarmTask(); - warmTask.start(); - // 即时暂停 suspendRecorder(context); @@ -79,21 +74,21 @@ public class DesignerStartupPageActivator extends Activator { model.setOpenLastTemplateRunnable(() -> { context.setOpenLastFile(true); handleModel(model); - launchAfterWarmup(warmTask); + launchAfterWarmup(); }); // selectAndOpenEmpty model.setOpenEmptyTemplateRunnable(() -> { context.setOpenEmpty(true); handleModel(model); - launchAfterWarmup(warmTask); + launchAfterWarmup(); }); // selectAndCreateNew model.setCreateNewTemplateRunnable(() -> { context.setCreateNew(true); handleModel(model); - launchAfterWarmup(warmTask); + launchAfterWarmup(); }); StartupPageWindow window = new StartupPageWindow(model); @@ -123,7 +118,7 @@ public class DesignerStartupPageActivator extends Activator { }); } - private void launchAfterWarmup(DesignerPreWarmTask warmTask) { + private void launchAfterWarmup() { StopWatch stopWatch = StopWatch.createStarted(); @@ -133,9 +128,6 @@ public class DesignerStartupPageActivator extends Activator { // 等待中切换 DesignerStartupContext.getInstance().setOnWaiting(false); - warmTask.join(); - - FineLoggerFactory.getLogger().debug("designer-startup-page warm up cost {} ms", stopWatch.getTime(TimeUnit.MILLISECONDS)); DesignerStartupContext.getInstance().setOnStartup(true); DesignerStartupPageUtil.enterWorkspace(); } finally { From 4267f0a4c85a98ab8321cfebf7213ae7bde109f3 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 21 Sep 2022 13:22:05 +0800 Subject: [PATCH 17/21] =?UTF-8?q?REPORT-79767=20=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=88=B7=E5=A4=8D=E5=88=B6=E8=83=8C=E6=99=AF=E9=A2=9C=E8=89=B2?= =?UTF-8?q?-=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=98=BE=E7=A4=BA=E4=B8=8E?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E9=A2=9C=E8=89=B2=E4=B8=8D=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 复制粘贴,剪切粘贴,格式刷,三种场景下,单元格内样式和主题色的使用比较混乱, 需要进一步规范下。 比如 什么情况下需要使用原来的样式, 什么情况下需要转换为自定义样式, 什么情况下需要清除主题色,将主题色变为自定义色 【改动思路】 1. 当复制样式的模板和粘贴样式模板相同时,保持样式和主题色不变,不做任何转换 2. 当复制样式的模板和粘贴样式的模板不同时,如果两个模板对应的主题样式单元格不同, 那么需要转换主题单元格样式为自定义样式,以保持被复制的样式。 3. 当复制样式的模板和粘贴样式的模板不同时,清除单元格内的主题色 --- .../fr/design/mainframe/DesignerContext.java | 10 ++ .../theme/utils/CellElementStylePaster.java | 99 +++++++++++++++++++ .../cell/clipboard/CellElementsClip.java | 20 ++++ .../design/mainframe/FormatBrushAction.java | 26 ++++- .../java/com/fr/grid/GridMouseAdapter.java | 2 +- 5 files changed, 153 insertions(+), 4 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/theme/utils/CellElementStylePaster.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerContext.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerContext.java index 49fffa6cef..4079ae7b22 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerContext.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerContext.java @@ -7,6 +7,7 @@ import com.fr.base.Style; import com.fr.design.base.clipboard.DesignerClipboard; import com.fr.design.designer.TargetComponent; import com.fr.design.dialog.BasicDialog; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; @@ -25,6 +26,8 @@ public class DesignerContext { private static Clipboard clipboard = null; //当前的剪贴板. private static int formatState = FORMAT_STATE_NULL; private static Style[][] referencedStyle = null; + private static String referencedStyleFromTemplatePath = null; + private static TargetComponent referencedElementCasePane; private static int referencedIndex = 0; private static ThreadLocal reportWriteThread = new ThreadLocal(); @@ -114,12 +117,19 @@ public class DesignerContext { public static void setReferencedStyle(Style[][] styles) { referencedStyle = styles; + + JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + referencedStyleFromTemplatePath = currentTemplate != null ? currentTemplate.getPath() : null; } public static Style[][] getReferencedStyle() { return referencedStyle; } + public static String getReferencedStyleFromTemplatePath() { + return referencedStyleFromTemplatePath; + } + public static void setReferencedElementCasePane(TargetComponent t) { referencedElementCasePane = t; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/utils/CellElementStylePaster.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/utils/CellElementStylePaster.java new file mode 100644 index 0000000000..983beda5e8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/utils/CellElementStylePaster.java @@ -0,0 +1,99 @@ +package com.fr.design.mainframe.theme.utils; + +import com.fr.base.CloneTransformer; +import com.fr.base.NameStyle; +import com.fr.base.Style; +import com.fr.base.theme.FineColorSynchronizer; +import com.fr.base.theme.TemplateTheme; +import com.fr.base.theme.settings.ThemedCellStyle; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.JTemplate; +import com.fr.log.FineLoggerFactory; +import com.fr.report.cell.TemplateCellElement; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2022/9/21 + * + * 如果粘贴到的模板主题单元格样式与复制过来的主题单元格样式不同,那么需要转换复制过来的主题单元格样式为自定义样式,以保持被复制的样式。 + * 转换非主题单元格样式内的主题色,以及单元格内的其他主题色,为自定义色 + */ +public class CellElementStylePaster { + + /** + * 为没有实现FCloneable接口的类而抽象出的clone方法包装接口, + * 使用者需要实现此接口方法,调用真正的clone方法. + * @param + */ + private interface CloneExecutor { + T clone(T o) throws Exception; + } + private static boolean needConvertThemedStyleToCustomStyle(NameStyle nameStyle) { + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentOpeningOrEditingTemplate(); + if (template != null) { + TemplateTheme theme = template.getTemplateTheme(); + if (theme != null) { + ThemedCellStyle themedCellStyle = theme.getCellStyleList().find(nameStyle.getName()); + return !nameStyle.getRealStyle().equals(themedCellStyle.getStyle()); + } + } + return false; + } + + + private static T convertThemedColorToCustomColor(T o, CloneExecutor executor) { + CloneTransformer.setTransformer(new FineColorSynchronizer.FineColorTransformer(fineColor -> { + fineColor.setHor(-1); + fineColor.setVer(-1); + })); + + Object cloned = null; + try { + cloned = executor.clone(o); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + + CloneTransformer.clearTransformer(); + return (T) cloned; + } + + /** + * + * @param cellElement 粘贴到的单元格 + * @return + * 如果粘贴到的模板主题单元格样式与复制过来的主题单元格样式不同,那么需要转换复制过来的主题单元格样式为自定义样式,以保持被复制的样式。 + * 转换非主题单元格样式内的主题色,以及单元格内的其他主题色,为自定义色 + */ + public static TemplateCellElement convertStyleAndColor(TemplateCellElement cellElement) { + Style backupStyle = cellElement.getStyle(); + cellElement = convertThemedColorToCustomColor(cellElement, o -> (TemplateCellElement) o.clone()); + + Style style = convertStyleAndColor(backupStyle); + cellElement.setStyle(style); + + return cellElement; + } + + /** + * + * @param style + * @return + * 如果粘贴到的模板主题单元格样式与复制过来的主题单元格样式不同,那么需要转换复制过来的主题单元格样式为自定义样式,以保持被复制的样式。 + * 转换非主题单元格样式内的主题色 + */ + public static Style convertStyleAndColor(Style style) { + if (style instanceof NameStyle) { + NameStyle nameStyle = (NameStyle) style; + if (needConvertThemedStyleToCustomStyle(nameStyle)) { + style = nameStyle.getRealStyle(); + } + } + if (!(style instanceof NameStyle)) { + style = convertThemedColorToCustomColor(style, o -> (Style) o.clone()); + } + + return style; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java b/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java index b54c871e0a..cef0d1d841 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java +++ b/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java @@ -6,6 +6,9 @@ package com.fr.design.cell.clipboard; import com.fr.base.TableData; import com.fr.design.base.clipboard.ClipboardHelper; import com.fr.design.data.tabledata.paste.TableDataFollowingPasteUtils; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.theme.utils.CellElementStylePaster; import com.fr.grid.selection.CellSelection; import com.fr.log.FineLoggerFactory; import com.fr.report.cell.CellElement; @@ -20,11 +23,13 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Objects; /** * The clip of CellElement. */ public class CellElementsClip implements Cloneable, java.io.Serializable { + private String copyFromTemplatePath; private int columnSpan = 0; private int rowSpan = 0; private FU[] columnWidth; @@ -39,6 +44,7 @@ public class CellElementsClip implements Cloneable, java.io.Serializable { this.rowHeight = rowHeight; this.clips = clips; this.elementUsedTableDatas = TableDataFollowingPasteUtils.transferProvider2TableDataMap(clips); + this.copyFromTemplatePath = this.getCurrentTemplatePath(); } public CellElementsClip(int columnSpan, int rowSpan, TemplateCellElement[] clips) { @@ -46,6 +52,7 @@ public class CellElementsClip implements Cloneable, java.io.Serializable { this.rowSpan = rowSpan; this.clips = clips; this.elementUsedTableDatas = TableDataFollowingPasteUtils.transferProvider2TableDataMap(clips); + this.copyFromTemplatePath = this.getCurrentTemplatePath(); } public int getColumnSpan() { @@ -133,6 +140,12 @@ public class CellElementsClip implements Cloneable, java.io.Serializable { return null; } + String pasteToTemplatePath = this.getCurrentTemplatePath(); + boolean pastingToDifferentTemplate = copyFromTemplatePath != null && pasteToTemplatePath != null && !Objects.equals(copyFromTemplatePath, pasteToTemplatePath); + if (pastingToDifferentTemplate) { + cellElement = CellElementStylePaster.convertStyleAndColor(cellElement); + } + // peter:因为前面已经将这个位置的元素删除了,所以不需要override了. ec.addCellElement((TemplateCellElement) cellElement.deriveCellElement( column + cellElement.getColumn(), row + cellElement.getRow() @@ -176,6 +189,11 @@ public class CellElementsClip implements Cloneable, java.io.Serializable { } } + private String getCurrentTemplatePath() { + JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + return currentTemplate != null ? currentTemplate.getPath() : null; + } + /** * Clone. */ @@ -183,6 +201,8 @@ public class CellElementsClip implements Cloneable, java.io.Serializable { public Object clone() throws CloneNotSupportedException { CellElementsClip cloned = (CellElementsClip) super.clone(); + cloned.copyFromTemplatePath = this.copyFromTemplatePath; + if (this.clips != null) { cloned.clips = new TemplateCellElement[this.clips.length]; for (int i = 0; i < this.clips.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 1256c76644..9ec053bd01 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 @@ -4,6 +4,8 @@ import com.fr.base.Style; import com.fr.design.actions.ElementCaseAction; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.theme.utils.CellElementStylePaster; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.Selection; @@ -13,6 +15,7 @@ import com.fr.report.elementcase.TemplateElementCase; import javax.swing.*; import java.awt.*; import java.awt.event.KeyEvent; +import java.util.Objects; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; @@ -48,7 +51,7 @@ public class FormatBrushAction extends ElementCaseAction { if (cellRectangleCount > 1) { //格式刷只支持单次选择的区域,如果用ctrl复选选中了多片区域,点击格式刷按钮时弹出提示 //判断是不是连续区域 - //荣国是连续区域,那么这些长方形的长加起来应该等于 + //如果是连续区域,那么这些长方形的长加起来应该等于 if (!isContinueArea()) { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Can_Not_Use_Format_Brush")); ePane.setFormatState(DesignerContext.FORMAT_STATE_NULL); @@ -103,7 +106,14 @@ public class FormatBrushAction extends ElementCaseAction { } - public void updateFormatBrush(Style[][] referencedStyle, CellSelection cs, ElementCasePane reportPane) { + /** + * 将格式刷获取到的样式,应用到指定单元格区域 + * @param referencedStyleFromTemplatePath 格式刷获取到的样式来自哪张模板 + * @param referencedStyle 格式刷获取到的样式 + * @param cs 应用格式刷区域的指定单元格区域 + * @param reportPane 应用格式刷的报表块面板 + */ + public void updateFormatBrush(String referencedStyleFromTemplatePath, Style[][] referencedStyle, CellSelection cs, ElementCasePane reportPane) { //得到被参照的单元格的行列数 if (referencedStyle == null) { return; @@ -132,7 +142,17 @@ public class FormatBrushAction extends ElementCaseAction { cellElement = DefaultThemedTemplateCellElementCase.createInstance(column, row); elementCase.addCellElement(cellElement); } - cellElement.setStyle(referencedStyle[i % columnSpan][j % rowSpan]); + Style style = referencedStyle[i % columnSpan][j % rowSpan]; + + JTemplate pasteToTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + String pasteToTemplatePath = pasteToTemplate != null ? pasteToTemplate.getPath() : null; + boolean pastingToDifferentTemplate = referencedStyleFromTemplatePath != null && pasteToTemplatePath != null && !Objects.equals(referencedStyleFromTemplatePath, pasteToTemplatePath); + + if (pastingToDifferentTemplate) { + style = CellElementStylePaster.convertStyleAndColor(style); + } + + cellElement.setStyle(style); } } 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 61e6484c65..c213a90e46 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -295,7 +295,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous } if (reportPane.getCellNeedTOFormat() != null) { - reportPane.getFormatBrushAction().updateFormatBrush(DesignerContext.getReferencedStyle(), reportPane.getCellNeedTOFormat(), reportPane); + reportPane.getFormatBrushAction().updateFormatBrush(DesignerContext.getReferencedStyleFromTemplatePath(), DesignerContext.getReferencedStyle(), reportPane.getCellNeedTOFormat(), reportPane); reportPane.fireTargetModified(); } From 24a86f5afe090da1ae199732d7a4d7963b47dd54 Mon Sep 17 00:00:00 2001 From: rinoux Date: Fri, 23 Sep 2022 09:46:52 +0800 Subject: [PATCH 18/21] =?UTF-8?q?REPORT-80922=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E4=B8=8B=E5=AD=98=E5=82=A8=E8=BF=87=E7=A8=8B?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E5=8A=A0=E8=BD=BD=E7=8A=B6=E6=80=81NPE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wrapper/MultiResultTableDataWrapper.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java index ae68bd112b..c72baf4356 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java @@ -187,18 +187,20 @@ public final class MultiResultTableDataWrapper implements TableDataWrapper { protected Void doInBackground() throws Exception { loadingBar.close(); PreviewTablePane.resetPreviewTable(); - connectionBar.start(); // 存储过程需要先测试一下连接 if (tableData instanceof StoreProcedure) { - boolean status = DataOperator.getInstance().testConnection(((StoreProcedure) getTableData()).getDatabaseConnection()); - if (!status) { + try { + connectionBar.start(); + boolean success = DataOperator.getInstance().testConnection(((StoreProcedure) getTableData()).getDatabaseConnection()); + if (!success) { + throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed")); + } + } finally { connectionBar.close(); - throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed")); } } - connectionBar.close(); tableData.resetDataModelList(); // 获取结果 From 9d39612afbc341f37e6afe3cf4337871aa29806b Mon Sep 17 00:00:00 2001 From: rinoux Date: Sun, 25 Sep 2022 16:37:54 +0800 Subject: [PATCH 19/21] =?UTF-8?q?REPORT-80583=20=E5=A4=9A=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E9=A2=84=E8=A7=88=E5=8F=82=E6=95=B0=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/data/DesignTableDataManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index 35a539a50c..2b654b6f49 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -637,8 +637,9 @@ public abstract class DesignTableDataManager { // 存储过程有些特殊处理 // 这个就简单直接获取暂存列表吧 - // TODO 参数处理? if (needLoadingBar) { + ParameterProvider[] parameters = DataOperator.getInstance().getTableDataParameters(tableData); + showParaWindow(parameterMap, parameters); MultiResultTableDataWrapper.loadingBar.start(); } return DataOperator.getInstance().previewMultiResultTableData(tableData, parameterMap, 0); From 177af481bea505bef6ff05677d46684ca25c0b68 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 26 Sep 2022 12:52:18 +0800 Subject: [PATCH 20/21] =?UTF-8?q?REPORT-80491=20linux=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E8=B0=83=E7=94=A8=E7=B3=BB=E7=BB=9F=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=97=AA=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/os/impl/SupportOSImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java index 5751c3ecb9..d8eda915b7 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -152,7 +152,13 @@ public enum SupportOSImpl implements SupportOS { @Override public boolean support() { - return (OperatingSystem.isLinux() && Arch.getArch() == Arch.ARM) || MACOS_12_VERSION_ADAPTER.support(); + boolean javafxExist = true; + try { + Class.forName("javafx.stage.FileChooser"); + } catch (ClassNotFoundException e) { + javafxExist = false; + } + return !javafxExist || (OperatingSystem.isLinux() && Arch.getArch() == Arch.ARM) || MACOS_12_VERSION_ADAPTER.support(); } }, From 92bd5476c6fe342a0f7d7959d6a4b24aac912193 Mon Sep 17 00:00:00 2001 From: rinoux Date: Mon, 26 Sep 2022 15:00:47 +0800 Subject: [PATCH 21/21] =?UTF-8?q?REPORT-80583=20=E5=A4=9A=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=95=B0=E6=8D=AE=E9=9B=86=E9=A2=84=E8=A7=88=E8=A6=81?= =?UTF-8?q?=E5=BC=B9=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/data/DesignTableDataManager.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index 2b654b6f49..2ce2a7d828 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -625,6 +625,8 @@ public abstract class DesignTableDataManager { // 把storeProcedure写成xml文件到out DataCoreXmlUtils.writeXMLStoreProcedure(writer, storeProcedure, null); if (storeProcedure.getDataModelList().size() > 0 && !storeProcedure.isFirstExpand()) { + // 存储过程有些特殊处理 + // 这个就简单直接获取暂存列表吧 return storeProcedure.getDataModelList().toArray(new ProcedureDataModel[0]); } ParameterProvider[] inParameters = DataOperator.getInstance().getStoreProcedureParameters(storeProcedure); @@ -633,13 +635,14 @@ public abstract class DesignTableDataManager { showParaWindow(parameterMap, inParameters); } storeProcedure.setFirstExpand(false); + } else { + ParameterProvider[] parameters = DataOperator.getInstance().getTableDataParameters(tableData); + if (parameters.length > 0) { + showParaWindow(parameterMap, parameters); + } } - // 存储过程有些特殊处理 - // 这个就简单直接获取暂存列表吧 if (needLoadingBar) { - ParameterProvider[] parameters = DataOperator.getInstance().getTableDataParameters(tableData); - showParaWindow(parameterMap, parameters); MultiResultTableDataWrapper.loadingBar.start(); } return DataOperator.getInstance().previewMultiResultTableData(tableData, parameterMap, 0);