Browse Source

Merge pull request #9924 in DESIGN/design from release/11.0 to bugfix/11.0

* commit 'fa93558161592d266fbad558f2cffc99e8f92a5c':
  REPORT-79345 【冒烟】切换远程,日志刷报错write failed
  KERNEL-12469 js引擎j2v8剥离成独立插件
  KERNEL-12469 js引擎j2v8剥离成独立插件
  REPORT-77649 feat:fvs图表超链界面populate不refresh超链类型,ps:refresh应该都没有必要 先只改fvs
  REPORT-79440 找不到驱动的话可以保存数据连接
  REPORT-70593 图片控件合并主代码
bugfix/11.0
superman 2 years ago
parent
commit
bc8037fbf3
  1. 3
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  2. 33
      designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java
  3. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java
  4. 31
      designer-base/src/main/java/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java
  5. 67
      designer-base/src/main/java/com/fr/design/report/SelectImagePane.java
  6. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/picture_widget_16.png
  7. BIN
      designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png
  8. 27
      designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java
  9. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  10. 74
      designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java
  11. 111
      designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java
  12. 77
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java
  13. 57
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleUrlLinkModelEditor.java
  14. 17
      designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java
  15. 17
      designer-form/src/main/java/com/fr/design/mainframe/widget/editors/UrlLinkEditor.java
  16. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/PictureRenderer.java
  17. 16
      designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/UrlLinkRenderer.java
  18. 34
      designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/PictureModelWrapper.java
  19. 33
      designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/UrlLinkModelWrapper.java
  20. 12
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  21. 1
      designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java

3
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -1,6 +1,7 @@
package com.fr.design.data.datapane.connect;
import com.fr.config.RemoteConfigEvent;
import com.fr.data.driver.DriverClassNotFoundException;
import com.fr.data.impl.Connection;
import com.fr.data.impl.ConnectionBean;
import com.fr.data.impl.JDBCDatabaseConnection;
@ -231,6 +232,8 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
Connection connection = connectionBean.getConnection();
try {
DataOperator.getInstance().validateConnectionSettings(connection);
} catch (DriverClassNotFoundException e) {
FineLoggerFactory.getLogger().info(e.getMessage());
} catch (Exception e) {
throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", connectionBean.getName()) + ", " + e.getMessage(), e.getCause());
}

33
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);
}

2
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";
/**
* 刷新面板展示
*

31
designer-base/src/main/java/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java

@ -1,6 +1,13 @@
package com.fr.design.javascript.beautify;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import java.io.InputStream;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class JavaScriptFormatHelper {
@ -23,24 +30,16 @@ public class JavaScriptFormatHelper {
* @see <a href="https://github.com/beautify-web/js-beautify">JSBeautify<a/>
*/
public static String beautify(String jsCode, BeautifyOption option) {
/* InputStream resourceAsStream = IOUtils.readResource("com/fr/design/javascript/beautify/beautify.js");
String result = jsCode;
V8 v8 = V8.createV8Runtime();
try {
v8.executeVoidScript(IOUtils.inputStream2String(resourceAsStream, EncodeConstants.ENCODING_UTF_8));
V8Array parameters = new V8Array(v8);
parameters.push(jsCode);
V8Object arg = V8ObjectUtils.toV8Object(v8, option.toFormatArgument());
parameters.push(arg);
result = v8.executeStringFunction("js_beautify_global", parameters);
parameters.release();
arg.release();
} catch (UnsupportedEncodingException e) {
try (InputStream resourceAsStream = IOUtils.readResource("com/fr/design/javascript/beautify/beautify.js")) {
ScriptEngine nashorn = new ScriptEngineManager().getEngineByName("JavaScript");
nashorn.eval(IOUtils.inputStream2String(resourceAsStream, EncodeConstants.ENCODING_UTF_8));
Invocable invocable = (Invocable) nashorn;
result = (String) invocable.invokeFunction("js_beautify_global", new Object[]{jsCode, option.toFormatArgument()});
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
v8.release(true);
}*/
return jsCode;
}
return result;
}
public static void main(String[] args) {

67
designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java → 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;
/**
* 这个类主要用于插入图片时的设置
*/
* <p>这个类主要用于插入图片时的设置</p>
* <p>这个类原本在designer-realize包下面现在表单也可选择图片所以应该抽为公用的base包包名不变应该不影响插件使用</p>
*
* @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");

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/picture_widget_16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

27
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<HyperlinkProvider> 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<NameObject> nameObjects = new ArrayList<NameObject>();
@ -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<Class, Class> map = new HashMap<Class, Class>();
map.put(ReportletHyperlink.class, ReportletHyperlinkPane.class);

2
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() {

74
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;
/**
*
* <p>图片控件的creator</p>
*
* @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;
}
}

111
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;
/**
*
* <p>图片控件中的已选图片展示面板</p>
*
* @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);
}
}
}
}

77
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;
/**
*
* <p>图片控件的图片选择编辑器</p>
*
* @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);
}
}

57
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;
/**
* <p>表单图片控件的链接编辑器</p>
* @author Jimmy
*/
public class AccessibleUrlLinkModelEditor extends UneditableAccessibleEditor {
private FormHyperlinkGroupPane hyperlinkPane;
public AccessibleUrlLinkModelEditor() {
super(new UrlLinkModelWrapper());
}
/**
* 原插件使用
* <p>DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPaneNoPop(
* HyperlinkGroupPaneActionImpl.getInstance()));</p>获取{@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();
}
}

17
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;
/**
*
* <p>图片控件的图片选择编辑器</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:15
**/
public class PictureEditor extends AccessiblePropertyEditor {
public PictureEditor(Object o) {
super(new AccessiblePictureModelEditor((PictureWidget) o));
}
}

17
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;
/**
*
* <p><p>图片控件的链接编辑器</p></p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:19
**/
public class UrlLinkEditor extends AccessiblePropertyEditor {
public UrlLinkEditor() {
super(new AccessibleUrlLinkModelEditor());
}
}

15
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;
/**
* <p>图片控件的图片编辑器的EncoderCellRenderer</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:29
**/
public class PictureRenderer extends EncoderCellRenderer {
public PictureRenderer() {
super(new PictureModelWrapper());
}
}

16
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;
/**
* <p>图片控件的链接编辑器的EncoderCellRenderer</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:29
**/
public class UrlLinkRenderer extends EncoderCellRenderer {
public UrlLinkRenderer() {
super(new UrlLinkModelWrapper());
}
}

34
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;
/**
* <p>图片选择器 {@link com.fr.design.mainframe.widget.accessibles.AccessiblePictureModelEditor} Wrapper</p>
* <p>插件中直接移入未作改动</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:25
**/
public class PictureModelWrapper implements Encoder<FloatElement>, Decoder<FloatElement> {
@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;
}
}

33
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;
/**
* <p>链接选择器 {@link com.fr.design.mainframe.widget.accessibles.AccessibleUrlLinkModelEditor} Wrapper</p>
* <p>插件中直接移入未作改动</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:28
**/
public class UrlLinkModelWrapper implements Encoder<NameJavaScriptGroup>, Decoder<NameJavaScriptGroup> {
@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;
}
}

12
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.
@ -208,8 +209,10 @@ public class DesignerActivator extends Activator implements Prepare {
CompletableFuture<Void> resourcePrepare = CompletableFuture.runAsync(() -> {
pushUpdateTask.run();
PluginResourceLoader.INSTANCE.checkOldShopFile();
UpmResourceLoader.INSTANCE.checkOldShopFile();
if (WorkContext.getCurrent().isLocal()) {
PluginResourceLoader.INSTANCE.checkOldShopFile();
UpmResourceLoader.INSTANCE.checkOldShopFile();
}
}, DesignerStartupPool.common());
CompletableFuture
@ -400,6 +403,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());
}
/**

1
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",

Loading…
Cancel
Save