Browse Source

Merge remote-tracking branch 'origin/feature/x' into feature/x

feature/x
Link.Zhao 2 years ago
parent
commit
5ee07f700b
  1. 7
      designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java
  2. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java
  3. 67
      designer-base/src/main/java/com/fr/design/report/SelectImagePane.java
  4. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/picture_widget_16.png
  5. BIN
      designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png
  6. 21
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  7. 74
      designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java
  8. 113
      designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java
  9. 77
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java
  10. 57
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleUrlLinkModelEditor.java
  11. 17
      designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java
  12. 17
      designer-form/src/main/java/com/fr/design/mainframe/widget/editors/UrlLinkEditor.java
  13. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/PictureRenderer.java
  14. 16
      designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/UrlLinkRenderer.java
  15. 34
      designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/PictureModelWrapper.java
  16. 33
      designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/UrlLinkModelWrapper.java
  17. 32
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java
  18. 29
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaAction.java
  19. 7
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/template/SearchTemplateFormulaAction.java
  20. 9
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/DictionaryType.java
  21. 20
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchWebJSAction.java
  22. 16
      designer-realize/src/main/java/com/fr/design/actions/replace/info/FormulaInfo.java
  23. 60
      designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java
  24. 16
      designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java
  25. 78
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  26. 9
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java
  27. 44
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java
  28. 112
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java
  29. 4
      designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java
  30. 6
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  31. 1
      designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java

7
designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java

@ -1,6 +1,7 @@
package com.fr.design.gui.core;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.form.ui.Button;
import com.fr.form.ui.CheckBox;
import com.fr.form.ui.CheckBoxGroup;
@ -14,6 +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.RadioGroup;
import com.fr.form.ui.TextArea;
import com.fr.form.ui.TextEditor;
@ -142,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"),
@ -214,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";
/**
* 刷新面板展示
*

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

21
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -19,6 +19,7 @@ import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fit.common.TemplateTool;
import com.fr.design.fun.ChartWidgetOptionProvider;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.fun.ParameterWidgetOptionProvider;
@ -39,6 +40,7 @@ import com.fr.form.ui.ComboCheckBox;
import com.fr.form.ui.DateEditor;
import com.fr.form.ui.EditorHolder;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.FieldEditor;
import com.fr.form.ui.FileEditor;
import com.fr.form.ui.FreeButton;
import com.fr.form.ui.IframeEditor;
@ -47,10 +49,12 @@ 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;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.ToggleButton;
import com.fr.form.ui.TreeComboBoxEditor;
import com.fr.form.ui.TreeEditor;
import com.fr.form.ui.Widget;
@ -183,6 +187,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() {
@ -236,14 +241,30 @@ public class XCreatorUtils {
}
public static XCreator createThemedXCreator(Widget widget) {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
TemplateTheme theme = template.getTemplateTheme();
if (theme instanceof FormTheme) {
widget = setupTemplateTheme(widget, true, (FormTheme) theme, TemplateThemeCompatible.NONE);
}
if (TemplateTool.isCurrentEditingNewJForm()){
resetWidgetDefaultProperty(widget);
}
return createXCreator(widget);
}
/**
* 新表单下控件的字体默认都为9pt
* @param widget 控件
*/
private static void resetWidgetDefaultProperty(Widget widget) {
if (widget.acceptType(FieldEditor.class)) {
((FieldEditor) widget).setFontSize(Widget.DEFAULT_FONT_PT_SIZE);
} else if (widget.acceptType(ToggleButton.class)) {
((ToggleButton) widget).setFontSize(Widget.DEFAULT_FONT_PT_SIZE);
}
}
/**
* 创建creator
*

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

113
designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java

@ -0,0 +1,113 @@
package com.fr.design.designer.ui;
import com.fr.general.ImageWithSuffix;
import com.fr.stable.Constants;
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 Image getBackgroundImage() {
return this.backgroundImage;
}
public void setBackgroundImage(Image image) {
this.backgroundImage = image;
repaint();
}
public int getImageDisplayMode() {
return this.imageDisplayMode;
}
public void setImageDisplayMode(int modeName) {
switch (modeName) {
case Constants.IMAGE_CENTER:
this.modeIndex = 0;
break;
case Constants.IMAGE_TILED:
this.imageDisplayMode = 0;
this.modeIndex = 1;
break;
case Constants.IMAGE_EXTEND:
this.imageDisplayMode = 2;
this.modeIndex = 2;
break;
case Constants.IMAGE_ADJUST:
this.imageDisplayMode = 4;
this.modeIndex = 3;
break;
default:
}
repaint();
}
@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);
default:
}
}
}
}

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

32
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java

@ -2,6 +2,7 @@ package com.fr.design.actions.replace.action.content.formula;
import com.fr.chart.chartdata.MeterReportDefinition;
import com.fr.data.VerifyItem;
import com.fr.data.impl.FormulaDictionary;
import com.fr.design.actions.replace.info.DealWithInfoValue;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.info.base.SearchTag;
@ -9,6 +10,7 @@ import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.general.GeneralUtils;
import com.fr.main.impl.WorkBook;
import com.fr.plugin.chart.map.data.VanMapReportDefinition;
import com.fr.report.cell.cellattr.CellGUIAttr;
import com.fr.stable.collections.combination.Pair;
import org.jetbrains.annotations.Nullable;
@ -120,6 +122,36 @@ public enum FormulaTag implements DealWithInfoValue {
workBook.setReportName(sheetId, ShowValueUtils.replaceAll(name, findStr, replaceStr));
}
}
},
/**
* 单元格属性-其他-内容提示
*/
CELL_TOOL_TIP(SearchTag.CELL_TOOL_TIP) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof CellGUIAttr) {
CellGUIAttr attr = (CellGUIAttr) info.getContent().getHoldObject();
attr.setTooltipText(ShowValueUtils.replaceAll(attr.getTooltipText(), findStr, replaceStr));
}
}
},
DICT_EXCUTE(SearchTag.DICT_EXCUTE) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof FormulaDictionary) {
FormulaDictionary dictionary = (FormulaDictionary) info.getContent().getHoldObject();
dictionary.setExcuteFormula(ShowValueUtils.replaceAll(dictionary.getExcuteFormula(), findStr, replaceStr));
}
}
},
DICT_PRODUCE(SearchTag.DICT_PRODUCE) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof FormulaDictionary) {
FormulaDictionary dictionary = (FormulaDictionary) info.getContent().getHoldObject();
dictionary.setProduceFormula(ShowValueUtils.replaceAll(dictionary.getProduceFormula(), findStr, replaceStr));
}
}
};
int index;

29
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaAction.java

@ -14,18 +14,21 @@ import com.fr.design.actions.replace.info.CellInfo;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.info.base.SearchTag;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.data.Condition;
import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellGUIAttr;
import com.fr.report.cell.cellattr.highlight.DefaultHighlight;
import com.fr.report.cell.cellattr.highlight.HighlightAction;
import com.fr.report.cell.cellattr.highlight.HighlightGroup;
import com.fr.report.core.sort.common.CellSortAttr;
import com.fr.report.core.sort.sortexpression.FormulaSortExpression;
import com.fr.report.core.sort.sortexpression.SortExpression;
import com.fr.stable.CommonUtils;
import java.util.List;
@ -69,6 +72,8 @@ public class SearchCellFormulaAction implements SearchCellFormula {
searchCellSortAttr4Formula(cellInfo, formulaInfos);
//单元格属性-形态
searchCellPresent4Formula(cellInfo, formulaInfos);
//单元格属性-其他-内容提示-自定义
searchCellToolTip4Formula(cellInfo, formulaInfos);
//单元格属性-其他-插入策略
searchCellInsertPolicy4Formula(cellInfo, formulaInfos);
//单元格条件属性-参数-公式
@ -84,6 +89,30 @@ public class SearchCellFormulaAction implements SearchCellFormula {
}
private void searchCellToolTip4Formula(CellInfo cellInfo, List<FormulaInfo> formulaInfos) {
if (cellInfo.getContent().getReplaceObject() instanceof TemplateCellElement) {
TemplateCellElement cellElement = (TemplateCellElement) cellInfo.getContent().getReplaceObject();
if (isCellGUIAttrValid(cellElement.getCellGUIAttr())) {
CellGUIAttr attr = cellElement.getCellGUIAttr();
ITContent attrContent = ITContent.copy(cellInfo.getContent());
attrContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Cell_Attributes"),
Toolkit.i18nText("Fine-Design_Report_Other"),
Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip"),
Toolkit.i18nText("Fine-Design_Basic_Custom")
);
attrContent.setReplaceObject(attr.getTooltipText());
attrContent.setHoldObject(attr);
attrContent.setTag(SearchTag.CELL_TOOL_TIP);
formulaInfos.add(new FormulaInfo(attrContent));
}
}
}
private boolean isCellGUIAttrValid(CellGUIAttr attr) {
return attr != null && attr.isCustomTooltip() && CommonUtils.canBeFormula(attr.getTooltipText());
}
private void searchCellHyperLink4Formula(CellInfo cellInfo, List<FormulaInfo> formulaInfos) {
NameJavaScriptGroup nameJavaScriptGroup = ((CellElement) cellInfo.getContent().getReplaceObject()).getNameHyperlinkGroup();
if (nameJavaScriptGroup != null) {

7
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/template/SearchTemplateFormulaAction.java

@ -66,7 +66,10 @@ public class SearchTemplateFormulaAction implements SearchTemplateFormula {
String name = workBook.getReportName(i);
if (CommonUtils.canBeFormula(name)) {
ITContent sheetContent = ITContent.copy(content);
sheetContent.addOtherPos(Toolkit.i18nText("Fine-Design_Replace_Sheet"));
sheetContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Replace_Sheet"),
name
);
sheetContent.setReplaceObject(name);
sheetContent.setHoldObject(workBook);
sheetContent.setTag(SearchTag.SHEET_NAME);
@ -104,7 +107,7 @@ public class SearchTemplateFormulaAction implements SearchTemplateFormula {
}
//数据校验
for (int i = 0, len = attr.getValueVerifierCount(); i < len; i++) {
for (int i = 0, len = attr.getVerifierCount(); i < len; i++) {
Verifier verifier = attr.getVerifier(i);
if (verifier instanceof ValueVerifier) {
ITContent content = ITContent.copy(sheetContent);

9
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/DictionaryType.java

@ -6,6 +6,7 @@ import com.fr.data.impl.FormulaDictionary;
import com.fr.data.impl.TableDataDictionary;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.info.base.SearchTag;
import com.fr.design.i18n.Toolkit;
import org.jetbrains.annotations.Nullable;
@ -32,23 +33,27 @@ public enum DictionaryType implements DictionaryAction {
//显示值
if (formulaDictionary.getExcuteFormula() != null) {
ITContent excuteContent = ITContent.copy(content);
excuteContent.setReplaceObject(dictionary);
excuteContent.setReplaceObject(formulaDictionary.getExcuteFormula());
excuteContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"),
Toolkit.i18nText("Fine-Design_Basic_Formula"),
Toolkit.i18nText("Fine-Design_Basic_Display_Value")
);
excuteContent.setHoldObject(dictionary);
excuteContent.setTag(SearchTag.DICT_EXCUTE);
formulaInfos.add(new FormulaInfo(excuteContent));
}
//实际值
if (formulaDictionary.getProduceFormula() != null) {
ITContent produceContent = ITContent.copy(content);
produceContent.setReplaceObject(dictionary);
produceContent.setReplaceObject(formulaDictionary.getProduceFormula());
produceContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"),
Toolkit.i18nText("Fine-Design_Basic_Formula"),
Toolkit.i18nText("Fine-Design_Basic_Actual_Value")
);
produceContent.setHoldObject(dictionary);
produceContent.setTag(SearchTag.DICT_PRODUCE);
formulaInfos.add(new FormulaInfo(produceContent));
}
}

20
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchWebJSAction.java

@ -4,6 +4,7 @@ import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.info.base.SearchTag;
import com.fr.design.actions.replace.utils.SearchJSUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
@ -19,6 +20,7 @@ import com.fr.report.web.util.ReportEngineEventMapping;
import com.fr.web.attr.ReportWebAttr;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -86,12 +88,30 @@ public class SearchWebJSAction implements SearchJS {
content.setTemplateName(jTemplate.getTemplateName());
content.setJumpAble(false);
addWebContent2Array(webAttr);
//处理引用JS
dealImportJS(content,jsInfos,webAttr);
for (int i = 0; i < arrayList.size(); i++) {
addJSInfos2ListFromArray(content, jsInfos, arrayList.get(i));
}
}
}
private void dealImportJS(ITContent content, List<JSInfo> jsInfos, ReportWebAttr webAttr) {
if (webAttr != null){
for (String jsStr : webAttr.getJSImport()){
ITContent jsContent = ITContent.copy(content);
jsContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Report_Web_Attributes"),
Toolkit.i18nText("Fine-Design_Report_Import_JavaScript")
);
jsContent.setReplaceObject(jsStr);
jsContent.setHoldObject(webAttr);
jsContent.setTag(SearchTag.IMPORT_JS);
jsInfos.add(new JSInfo(jsContent));
}
}
}
private void addJSInfos2ListFromServerWebAttr(ITContent content, List<JSInfo> jsInfos, WebContent webContent) {
ITContent newContent = ITContent.copy(content);
if (SERVER_MAP.containsKey(webContent.getClass().getSimpleName())) {

16
designer-realize/src/main/java/com/fr/design/actions/replace/info/FormulaInfo.java

@ -40,14 +40,7 @@ public class FormulaInfo implements Info {
@Override
public Map<String, String> getValue(Object... o) {
Map<String, String> map = new HashMap<>();
//这边比较特殊,存的都是FormulaDictionary ,特殊判断一下
if (this.content.getOtherPos().contains(DISPLAY)) {
map.put("content", ((FormulaDictionary) this.getContent().getReplaceObject()).getExcuteFormula());
} else if (this.content.getOtherPos().contains(ACTUAL)) {
map.put("content", ((FormulaDictionary) this.getContent().getReplaceObject()).getProduceFormula());
} else {
map = getCommonValue();
}
map = getCommonValue();
return map;
}
@ -70,11 +63,8 @@ public class FormulaInfo implements Info {
@Override
public Boolean checkValid() {
FormulaReplaceObject formulaReplaceObject = FormulaReplaceObject.match(this.content.getReplaceObject().getClass().getSimpleName());
if (formulaReplaceObject != null) {
return formulaReplaceObject.check(this);
}
return false;
//校验二期才完善,目前都给过
return true;
}
private Map<String, String> getCommonValue() {

60
designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java

@ -1,15 +1,21 @@
package com.fr.design.actions.replace.info;
import com.fr.data.impl.DBTableData;
import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.form.event.Listener;
import com.fr.general.GeneralUtils;
import com.fr.js.JavaScriptImpl;
import com.fr.js.NameJavaScript;
import com.fr.plugin.chart.base.VanChartHtmlLabel;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import com.fr.web.attr.ReportWebAttr;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -184,33 +190,75 @@ public enum ReplaceObject implements DealWithInfoValue {
return StringUtils.equals(javaScript.getContent(), info.getContent().getOldShowStr());
}
},
/**
* 模板Web属性引用JS
*/
IMPORT_JS("String") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
addValue2Map(contentKey, GeneralUtils.objectToString(o[0]), map);
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof ReportWebAttr) {
ReportWebAttr attr = (ReportWebAttr) info.getContent().getHoldObject();
List<String> jsImports = Arrays.asList(attr.getJSImport());
String jsName = GeneralUtils.objectToString(info.getContent().getReplaceObject());
for (int i = 0, len = jsImports.size(); i < len; i++) {
if (StringUtils.equals(jsImports.get(i), jsName)) {
jsImports.set(i, ShowValueUtils.replaceAll(jsName, findStr, replaceStr));
}
}
attr.clearJSImportList();
for (int i = 0, len = jsImports.size(); i < len; i++) {
attr.addJSImport(jsImports.get(i));
}
}
}
@Override
public String getInfoShowStr(Info info) {
return GeneralUtils.objectToString(info.getContent().getReplaceObject());
}
@Override
boolean check(Info info) {
return true;
}
},
/**
* DBTableDataSQL
*/
DB_TABLE_DATA("DBTableData") {
@Override
boolean check(Info info) {
boolean check (Info info){
DBTableData dbTableData = (DBTableData) info.getContent().getReplaceObject();
return StringUtils.equals(dbTableData.getQuery(), info.getContent().getOldShowStr());
}
@Override
public Map<String, String> getValue(Object... o) {
public Map<String, String> getValue (Object...o){
HashMap<String, String> map = new HashMap<>();
addValue2Map(contentKey, ((DBTableData) o[0]).getQuery(), map);
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
public void setValue (Info info, String findStr, String replaceStr, List < Pair < Integer, Integer >> operatorArray){
DBTableData dbTableData = (DBTableData) info.getContent().getReplaceObject();
info.updateOldStr(dbTableData.getQuery(), findStr);
dbTableData.setQuery(ShowValueUtils.replaceAll(dbTableData.getQuery(), findStr, replaceStr));
//todo DesignTableDataManager
//清除缓存
DesignTableDataManager.removeSelectedColumnNames(dbTableData.getName());
//收缩菜单
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
}
@Override
public String getInfoShowStr(Info info) {
public String getInfoShowStr (Info info){
return info.getInfoShowStr(info);
}
};
@ -256,4 +304,4 @@ public enum ReplaceObject implements DealWithInfoValue {
abstract boolean check(Info info);
}
}

16
designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java

@ -40,6 +40,22 @@ public class SearchTag {
* sheet名称
*/
public static final int SHEET_NAME = 7;
/**
* 单元格属性-其他-内容提示
*/
public static final int CELL_TOOL_TIP = 8;
/**
* 数据字典-公式-显示值
*/
public static final int DICT_EXCUTE = 9;
/**
* 数据字典-公式-实际值
*/
public static final int DICT_PRODUCE = 10;
/**
* 引用JS
*/
public static final int IMPORT_JS = 11;

78
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java

@ -9,6 +9,7 @@ import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
@ -22,6 +23,7 @@ import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent;
@ -46,13 +48,14 @@ public class ITReplaceMainDialog extends UIDialog {
private static boolean matched = false;
private static volatile ITReplaceMainDialog instance = null;
private static String templateID;
private static String templateName;
private ITReplaceNorthPanel northPane;
private ITReplaceSouthPanel southPanel;
private ITReplaceWestPanel westPanel;
private boolean searchFlag;
private String searchStr;
private static final int FIRST_ROW = 0;
public static int selectCount = 0;
public static int selectCount = 0;
public ITReplaceMainDialog() {
super(DesignerContext.getDesignerFrame());
@ -117,8 +120,10 @@ public class ITReplaceMainDialog extends UIDialog {
JPanel center = new JPanel(new BorderLayout());
UIComboBox replaceComboBox = northPane.getReplaceInputCombobox();
northPane.getFindInputCombobox().setEditable(true);
northPane.getReplaceInputCombobox().setEditable(false);
replaceComboBox.setEnabled(false);
replaceComboBox.setEditable(true);
northPane.getReplaceButton().setEnabled(false);
((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).setPlaceholder(Toolkit.i18nText("Fine-Design_Replace_Search_Input"));
@ -160,8 +165,10 @@ public class ITReplaceMainDialog extends UIDialog {
private void replace() {
String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText();
String replaceStr = ((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).getText();
if (StringUtils.equals(getSearchStr(), searchStr)) {
if (isITReplaceValid() && checkTemplateChanged(searchResultList)) {
//替换内容为空需要触发搜索
if (isITReplaceValid() && checkTemplateChanged(searchResultList)) {
if (StringUtils.equals(getSearchStr(), searchStr) && StringUtils.isNotEmpty(replaceStr)) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
for (Info info : searchResultList) {
if (info.getContent().isSelected()) {
info.setValue(info, searchStr, replaceStr, info.getContent().getOperatorArray());
@ -170,29 +177,26 @@ public class ITReplaceMainDialog extends UIDialog {
southPanel.getTableEditorPane().update();
northPane.refreshReplaceInputComboBoxItems();
ITTableEditorPane.getEditTable().repaint();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
setSearchFlag(false);
search();
} else {
Object[] options = new Object[]{Toolkit.i18nText("Fine-Design_Replace_Search_Again"), Toolkit.i18nText("Fine-Design_Basic_Cancel")};
int optionSelected = FineJOptionPane.showOptionDialog(
ITReplaceMainDialog.this,
Toolkit.i18nText("Fine-Design_Replace_Message"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.ERROR_MESSAGE,
null,
// 如果传null, 则按钮为 optionType 类型所表示的按钮(也就是确认对话框)
options,
options[0]
);
//如果选择了重新查找,则再查找一遍
if (optionSelected == 0) {
search();
}
}
} else {
search();
} else {
Object[] options = new Object[]{Toolkit.i18nText("Fine-Design_Replace_Search_Again"), Toolkit.i18nText("Fine-Design_Basic_Cancel")};
int optionSelected = FineJOptionPane.showOptionDialog(
ITReplaceMainDialog.this,
Toolkit.i18nText("Fine-Design_Replace_Message"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.ERROR_MESSAGE,
null,
// 如果传null, 则按钮为 optionType 类型所表示的按钮(也就是确认对话框)
options,
options[0]
);
//如果选择了重新查找,则再查找一遍
if (optionSelected == 0) {
search();
}
}
@ -215,7 +219,8 @@ public class ITReplaceMainDialog extends UIDialog {
*/
public boolean isITReplaceValid() {
if (JTemplate.isValid(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate())) {
return StringUtils.equals(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget().getTemplateID(), templateID);
return StringUtils.equals(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget().getTemplateID(), templateID)
&& StringUtils.equals(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplateName(), templateName);
} else {
return false;
}
@ -283,6 +288,7 @@ public class ITReplaceMainDialog extends UIDialog {
if (JTemplate.isValid(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate())) {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
templateID = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget().getTemplateID();
templateName = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplateName();
itTableEditor.clear();
String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText();
//更新搜索内容
@ -298,26 +304,26 @@ public class ITReplaceMainDialog extends UIDialog {
northPane.getResultLabel().setText("<html>" + Toolkit.i18nText("Fine-Design_Replace_Search_Finish") + "<font color = 'rgb(61,153,249)'>" + searchResultList.size() + "</font>" + Toolkit.i18nText("Fine-Design_Replace_Result"));
}
ITTableEditorPane.ITHeaderRenderer renderer = (ITTableEditorPane.ITHeaderRenderer) getEditTable().getTableHeader().getDefaultRenderer();
renderer.refreshHeader(getEditTable());
//刷新表头,并且重新勾选中表头全选框
renderer.refreshHeader(getEditTable(), true);
itTableEditor.fireTableDataChanged();
northPane.refreshFindInputComboBoxItems();
setSearchFlag(true);
selectCount = searchResultList.size();
//如果有结果,默认选中第一行
if (searchResultList.size() > 0){
getEditTable().addRowSelectionInterval(FIRST_ROW,FIRST_ROW);
northPane.getReplaceButton().setEnabled(true);
if (searchResultList.size() > 0) {
getEditTable().addRowSelectionInterval(FIRST_ROW, FIRST_ROW);
}
//设置替换输入框的可用性
if (StringUtils.isNotEmpty(searchStr)) {
((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setEditable(true);
northPane.getReplaceInputCombobox().setEditable(true);
//更新替换按钮可用性
if (StringUtils.isEmpty(searchStr) || searchResultList.size() == 0) {
northPane.getReplaceButton().setEnabled(false);
} else {
((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setEditable(false);
northPane.getReplaceInputCombobox().setEditable(false);
northPane.getReplaceButton().setEnabled(true);
}
//设置替换输入框的可用性
northPane.getReplaceInputCombobox().setEnabled(StringUtils.isNotEmpty(searchStr));
} else {
//todo
}

9
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java

@ -6,13 +6,14 @@ import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ReportComponentComposite;
import com.fr.file.FILEFactory;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.Component;
@ -42,7 +43,9 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
ITContent content = (ITContent) getEditTable().getValueAt(getEditTable().getEditingRow(), 6);
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(content.getTrlString()))) {
ITReplaceMainDialog.setITReplaceFlag(true);
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().navigate(new TRL(GeneralUtils.objectToString(content.getTrlString())));
TRL trl = new TRL(GeneralUtils.objectToString(content.getTrlString()));
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(ProjectConstants.REPORTLETS_NAME + FILEFactory.SEPARATOR + content.getTemplateName()));
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().navigate(trl);
}
ITReplaceMainDialog.setITReplaceFlag(false);
}

44
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java

@ -72,17 +72,8 @@ public class ITTableEditorPane<T> extends BasicPane {
int col = ((JTable) e.getSource()).columnAtPoint(e.getPoint());
if (col == ITReplaceSouthPanel.CHECKBOX_INDEX) {
ITContent content = (ITContent) editTable.getValueAt(row, ITReplaceSouthPanel.CONTENT_INDEX);
if (content.isSelected()) {
content.setSelected(false);
editTable.setValueAt(content.isSelected(), row, col);
ITReplaceMainDialog.selectCount--;
ITReplaceMainDialog.getInstance().getNorthPane().getReplaceButton().setEnabled(ITReplaceMainDialog.selectCount > 0);
} else {
content.setSelected(true);
editTable.setValueAt(content.isSelected(), row, col);
ITReplaceMainDialog.selectCount++;
ITReplaceMainDialog.getInstance().getNorthPane().getReplaceButton().setEnabled(true);
}
//改变面板的各个状态
changeComponentStatus(content, row, col);
}
}
@ -90,10 +81,35 @@ public class ITTableEditorPane<T> extends BasicPane {
UIScrollPane scrollPane = new UIScrollPane(editTable);
scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC));
pane.add(scrollPane, BorderLayout.CENTER);
}
/**
* 改变面板的各个状态替换按钮表头勾选框
* @param content
* @param row
* @param col
*/
public void changeComponentStatus(ITContent content, int row, int col) {
if (content.isSelected()) {
content.setSelected(false);
editTable.setValueAt(content.isSelected(), row, col);
ITReplaceMainDialog.selectCount--;
//如果没有选中,替换按钮需要置灰
ITReplaceMainDialog.getInstance().getNorthPane().getReplaceButton().setEnabled(ITReplaceMainDialog.selectCount > 0);
} else {
content.setSelected(true);
editTable.setValueAt(content.isSelected(), row, col);
ITReplaceMainDialog.selectCount++;
ITReplaceMainDialog.getInstance().getNorthPane().getReplaceButton().setEnabled(true);
}
//更新表头的勾选框状态
if (editTable.getTableHeader().getDefaultRenderer() instanceof ITHeaderRenderer) {
ITHeaderRenderer renderer = (ITHeaderRenderer) editTable.getTableHeader().getDefaultRenderer();
renderer.refreshHeader(editTable, ITReplaceMainDialog.selectCount >= editTable.getRowCount());
}
}
public UITableModelAdapter<T> getTableModel() {
return tableModel;
}
@ -142,8 +158,8 @@ public class ITTableEditorPane<T> extends BasicPane {
*
* @param table
*/
public void refreshHeader(JTable table) {
selectBox.setSelected(true);
public void refreshHeader(JTable table, boolean value) {
selectBox.setSelected(value);
int rowHeight = table.getRowHeight();
table.updateUI();
table.setRowHeight(rowHeight);

112
designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java

@ -28,6 +28,33 @@ public class ShowValueUtils {
public static final String ANY_THING_REGEX = ".";
public static final String NUMBER_REGEX = "[0-9]";
public static final String ENGLISH_REGEX = "[a-zA-Z]";
public static final char LEFT_HTML_CHAR = '<';
public static final char RIGHT_HTML_CHAR = '>';
public static final String HEAD = "<html><nobr>";
public static final String TAIL = "</nobr></html>";
public static final String FONT_HEAD = "<font color = 'rgb(61,153,249)'>";
public static final String FONT_TAIL = "</font>";
public static final String HTML = "<html>";
public static final String NOBR = "<nobr>";
public static final String HTML_TAIL = "</html>";
public static final String NOBR_TAIL = "</nobr>";
public static final int HEAD_LEN = HEAD.length();
public static final int TAIL_LEN = TAIL.length();
public static final int FONT_HEAD_LEN = FONT_HEAD.length();
public static final int FONT_TAIL_LEN = FONT_TAIL.length();
public static final int HTML_LEN = HTML.length();
public static final int HTML_TAIL_LEN = HTML_TAIL.length();
public static final int NOBR_LEN = NOBR.length();
public static final int NOBR_TAIL_LEN = NOBR_TAIL.length();
/**
* <转变为&lt;的长度差
*/
public static final int LEFT_DIFFERENT = 3;
/**
* >转变为&gt的长度差
*/
public static final int RIGHT_DIFFERENT = 2;
public static Pattern containPattern;
private static List<String> specialCharList = new ArrayList<>();
@ -135,33 +162,93 @@ public class ShowValueUtils {
String result = str;
Pattern pattern = containPattern;
Matcher matcher = pattern.matcher(str);
String head = "<font color = 'rgb(61,153,249)'>";
String tail = "</font>";
int size = head.length() + tail.length();
int size = FONT_HEAD.length() + FONT_TAIL.length();
int index = 0;
StringBuilder builder = new StringBuilder(str);
while (matcher.find()) {
builder.replace(matcher.start() + index, matcher.end() + index, head + changeHtmlStr(matcher.group()) + tail);
builder.replace(matcher.start() + index, matcher.end() + index, FONT_HEAD + changeHtmlStr(matcher.group()) + FONT_TAIL);
index += size;
index += getIncreaseCount(matcher.group());
}
return "<html><body><div><nobr>" +
builder.toString() +
"</nobr></div></body></html>";
return changeOriginHtmlStr(HEAD + builder.toString() + TAIL);
} else {
return "<html><body><div><nobr>" +
replaceAll(str, searchStr, "<font color = 'rgb(61,153,249)'>" + changeHtmlStr(searchStr) + "</font>") +
"</nobr></div></body></html>";
String ans = HEAD + replaceAll(str, searchStr, FONT_HEAD + changeHtmlStr(searchStr) + FONT_TAIL) + TAIL;
return changeOriginHtmlStr(ans);
}
}
/**
* 用于处理原字符串中的尖括号
*/
private static String changeOriginHtmlStr(String str) {
int count = 0;
StringBuilder builder = new StringBuilder(str);
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (c == LEFT_HTML_CHAR) {
if (!checkValid(str, i)) {
builder.replace(i + count, i + count + 1, "&lt;");
count += LEFT_DIFFERENT;
}
}
}
return builder.toString();
}
private static boolean checkValid(String str, int i) {
int leftLen = str.length() - (i + 1);
return checkStrValid(str, i, leftLen, HTML_LEN, HTML) ||
checkStrValid(str, i, leftLen, HTML_TAIL_LEN, HTML_TAIL) ||
checkStrValid(str, i, leftLen, FONT_HEAD_LEN, FONT_HEAD) ||
checkStrValid(str, i, leftLen, FONT_TAIL_LEN, FONT_TAIL) ||
checkStrValid(str, i, leftLen, NOBR_LEN, NOBR) ||
checkStrValid(str, i, leftLen, NOBR_TAIL_LEN, NOBR_TAIL);
}
/**
* 是否是所指定的字符串
*
* @param str
* @param i
* @param leftLen
* @return
*/
private static boolean checkStrValid(String str, int i, int leftLen, int len, String checkStr) {
if (leftLen < len - 1) {
return false;
} else {
return StringUtils.equals(str.substring(i, i + len), checkStr);
}
}
private static String changeHtmlStr(String searchStr){
/**
* 用于处理搜索的字符中的尖括号
*
* @param searchStr
* @return
*/
private static String changeHtmlStr(String searchStr) {
String showStr = searchStr;
showStr = showStr.replace("<","&lt;");
showStr = showStr.replace("<", "&lt;");
showStr = showStr.replace(">", "&gt");
return showStr;
}
private static int getIncreaseCount(String str) {
int count = 0;
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) == LEFT_HTML_CHAR) {
count += LEFT_DIFFERENT;
}
if (str.charAt(i) == RIGHT_HTML_CHAR) {
count += RIGHT_DIFFERENT;
}
}
return count;
}
/**
* 集合是否不为空
*
@ -193,6 +280,7 @@ public class ShowValueUtils {
/**
* 支持通配符的contains
*
* @param originStr
* @param matchStr
* @return

4
designer-realize/src/main/java/com/fr/design/mainframe/WorkSheetDesigner.java

@ -217,9 +217,9 @@ public class WorkSheetDesigner extends ReportComponent<WorkSheet, ElementCasePan
horizontalBar = getHorizontalScrollBar();
int m = columnRow.getColumn(), n = columnRow.getRow();
verticalBar.setMaximum(n);
verticalBar.setValue(n < 21 ? verticalBar.getValue() : n - 20);
verticalBar.setValue(n < 1 ? verticalBar.getValue() : n );
horizontalBar.setMaximum(m);
horizontalBar.setValue(m < 13 ? horizontalBar.getValue() : m - 12);
horizontalBar.setValue(m < 1 ? horizontalBar.getValue() : m );
// 选中
setSelection(cellSelection);
}

6
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -42,6 +42,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;
@ -56,6 +57,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;
@ -144,14 +146,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.
@ -405,6 +406,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