From a786a9833882c2af5317b8af05cfdaca2d18b07c Mon Sep 17 00:00:00 2001
From: "Jimmy.Zheng"
Date: Wed, 31 Aug 2022 15:02:49 +0800
Subject: [PATCH] =?UTF-8?q?REPORT-70593=20=E5=9B=BE=E7=89=87=E6=8E=A7?=
=?UTF-8?q?=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
zcmXw%drVUY6v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=TWj;~I#*&nnp$FHs%@2OjRR0X$6^Uxr
zHb@uhO`$cr6aDHncu(~RiK)k(TYQe4Iqcc)Lv?V=dHa||$N`}|J^h9RmkutMTlex0
zb_+-Wz=;2XGEB)hUBiIjvw|rx3A<^Fae^kgwqZt>Sn%}!&I(@eqK>>O0P#_3i3N8e
z!c`omdC);_9xc5W&aCz+)-e?bNg_el(oUF%IGRam0kg<|_Pp$0?kmP?QF_U}kl7GE
zG9t2QZJ{Tf9qT6v>v7Ae^@ax*82`qddo$4)&_x%
z9^yakTI#~=vvS`*w+>21_E}{PAc=QEtTw;p2jJ;Caa51mgd)5|)Ng_3NyP6ua6b|I
zn1Jk?sl3b5akP&fPy({dx34C|K7aq>E-L*rwq<|6CqBDJoGm1+nIfKtZCiJe^Ur%s
z@SLzMKjL$=cD8V$Kr?zHOPopx5X{V6URVqT9rT3{
zXA=56q*7_nEY?K5If4&_e%Qsiihh#UhU~bv90KM9*@!S^w#$-RAPYa
zBT{@|bEy1}1x$q_yR?blL-O`+74Yw^y
za-s(~totjXcY3RuNxI<3K@Ai0QW>ns0SD;=6uV6^yIoCrScP1>dX?s8sMUbFLxpzo
z%RtgbU)}>Jyno>wJnRx~!POn3RtKz8v+BP<1^pZcfr-iOx6LkMmhxQW1Hs!c_p$wd
z7TZhl-&L7g37L;FtSTh<)=qC*-%3Rk{F9^s@uaK3={EWQ|D?$im~5W&*A!s!8h;K3
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",