Browse Source

Merge pull request #3944 in DESIGN/design from feature/10.0 to feature/x

* commit 'c99794ce4c42f4b3c2b3bb1f43893e97bd599b9d':
  KERNEL-7376 优化设计器上一些性能问题
  KERNEL-7376 优化设计器上一些性能问题
  REPORT-50598 数字文本框输入有问题
  KERNEL-7376 优化设计器上一些性能问题
  KERNEL-7376 优化设计器上一些性能问题
  KERNEL-7376 优化设计器上一些性能问题
  REPORT-50096 数据填充时不需要触发监听
research/11.0
superman 4 years ago
parent
commit
9950029e15
  1. 21
      designer-base/src/main/java/com/fr/base/svg/SVGIcon.java
  2. 2
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  3. 7
      designer-base/src/main/java/com/fr/design/gui/chart/BaseChartPropertyPane.java
  4. 43
      designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java
  5. 68
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  6. 12
      designer-base/src/main/java/com/fr/design/selection/SelectableElement.java
  7. 147
      designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java
  8. 165
      designer-chart/src/main/java/com/fr/design/mainframe/MiddleChartPropertyPane.java
  9. 2
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  10. 14
      designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java
  11. 11
      designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java
  12. 5
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

21
designer-base/src/main/java/com/fr/base/svg/SVGIcon.java

@ -7,6 +7,8 @@ import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* SVG转化而来的Icon * SVG转化而来的Icon
@ -28,6 +30,8 @@ public class SVGIcon implements Icon {
this.image = image; this.image = image;
} }
private static Map<String, Icon> iconCache = new ConcurrentHashMap<>();
@Override @Override
public void paintIcon(Component c, Graphics g, int x, int y) { public void paintIcon(Component c, Graphics g, int x, int y) {
if (HI_DPI_SURPORT) { if (HI_DPI_SURPORT) {
@ -58,11 +62,26 @@ public class SVGIcon implements Icon {
* @return * @return
*/ */
public static Icon readSVGIcon(String url) { public static Icon readSVGIcon(String url) {
return readSVGIconWithCache(url, true);
}
public static Icon readSVGIconWithCache(String url, boolean cacheRead) {
Icon icon = null;
if (cacheRead) {
icon = iconCache.get(url);
}
if (icon == null) {
if (!url.startsWith(ICON_PREFIX)) { if (!url.startsWith(ICON_PREFIX)) {
url = ICON_PREFIX + url; url = ICON_PREFIX + url;
} }
BufferedImage image = (BufferedImage) SVGLoader.load(url); BufferedImage image = (BufferedImage) SVGLoader.load(url);
return image == null ? IOUtils.readIcon(url) : new SVGIcon(image); icon = image == null ? IOUtils.readIcon(url) : new SVGIcon(image);
//只缓存svg图标
if (image != null){
iconCache.put(url, icon);
}
}
return icon;
} }
/** /**

2
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -205,6 +205,7 @@ public class JDBCDefPane extends JPanel {
jdbcDatabase = new JDBCDatabaseConnection(); jdbcDatabase = new JDBCDatabaseConnection();
} }
this.jdbcDatabase = jdbcDatabase; this.jdbcDatabase = jdbcDatabase;
this.dbtypeComboBox.removeActionListener(dbtypeActionListener);
if (ComparatorUtils.equals(jdbcDatabase.getDriver(), "sun.jdbc.odbc.JdbcOdbcDriver") if (ComparatorUtils.equals(jdbcDatabase.getDriver(), "sun.jdbc.odbc.JdbcOdbcDriver")
&& jdbcDatabase.getURL().startsWith("jdbc:odbc:Driver={Microsoft")) { && jdbcDatabase.getURL().startsWith("jdbc:odbc:Driver={Microsoft")) {
this.dbtypeComboBox.setSelectedItem("Access"); this.dbtypeComboBox.setSelectedItem("Access");
@ -229,6 +230,7 @@ public class JDBCDefPane extends JPanel {
this.dbtypeComboBox.setSelectedItem(OTHER_DB); this.dbtypeComboBox.setSelectedItem(OTHER_DB);
} }
} }
this.dbtypeComboBox.addActionListener(dbtypeActionListener);
this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver());
this.urlTextField.setText(jdbcDatabase.getURL()); this.urlTextField.setText(jdbcDatabase.getURL());
this.userNameTextField.setText(jdbcDatabase.getUser()); this.userNameTextField.setText(jdbcDatabase.getUser());

7
designer-base/src/main/java/com/fr/design/gui/chart/BaseChartPropertyPane.java

@ -10,9 +10,6 @@ import com.fr.design.mainframe.DockingView;
* @version 创建时间2013-7-10 上午09:12:11 * @version 创建时间2013-7-10 上午09:12:11
*/ */
public abstract class BaseChartPropertyPane extends DockingView { public abstract class BaseChartPropertyPane extends DockingView {
public abstract void setSureProperty();
/** /**
* 设置是否支持单元格数据. * 设置是否支持单元格数据.
*/ */
@ -22,7 +19,5 @@ public abstract class BaseChartPropertyPane extends DockingView {
public abstract ChartEditPaneProvider getChartEditPane(); public abstract ChartEditPaneProvider getChartEditPane();
public abstract void addChartEditPane(String plotID); public abstract void updateChartEditPane(String plotID);
//public abstract void clear();
} }

43
designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java

@ -4,16 +4,11 @@ import com.fr.base.Utils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.text.AttributeSet; import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument; import javax.swing.text.PlainDocument;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.event.InputMethodEvent;
import java.awt.event.InputMethodListener;
/** /**
* Number Field. * Number Field.
@ -39,11 +34,6 @@ public class UINumberField extends UITextField {
private boolean isContentChanged = false; private boolean isContentChanged = false;
private boolean fillNegativeNumber = true; private boolean fillNegativeNumber = true;
/**
* 输入法输入完成一个字符输入过程的标记开始输入的时候是true输入完矫正光标后为false
*/
private boolean isInputMethodOnceInserting = false;
private int insertOffset = 0;
public UINumberField() { public UINumberField() {
this(MAX_INTEGERLENGTH_32, MAX_DECIMALLENGTH); this(MAX_INTEGERLENGTH_32, MAX_DECIMALLENGTH);
@ -64,7 +54,6 @@ public class UINumberField extends UITextField {
this.minValue = minValue; this.minValue = minValue;
this.maxValue = maxValue; this.maxValue = maxValue;
setFieldDocument(); setFieldDocument();
initFieldListener();
} }
public void setFieldDocument() { public void setFieldDocument() {
@ -72,31 +61,6 @@ public class UINumberField extends UITextField {
initListener(); initListener();
} }
private void initFieldListener() {
addInputMethodListener(new InputMethodListener() {
@Override
public void inputMethodTextChanged(InputMethodEvent event) {
isInputMethodOnceInserting = true;
}
@Override
public void caretPositionChanged(InputMethodEvent event) {
}
});
addCaretListener(new CaretListener() {
@Override
public void caretUpdate(CaretEvent e) {
if (isInputMethodOnceInserting) {
isInputMethodOnceInserting = false;
setCaretPosition(insertOffset);
} else {
insertOffset = e.getDot();
}
}
});
}
public void canFillNegativeNumber(boolean fillNegativeNumber) { public void canFillNegativeNumber(boolean fillNegativeNumber) {
this.fillNegativeNumber = fillNegativeNumber; this.fillNegativeNumber = fillNegativeNumber;
} }
@ -221,13 +185,6 @@ public class UINumberField extends UITextField {
super.insertString(offset, s, a); super.insertString(offset, s, a);
} }
public void remove(int offs, int len) throws BadLocationException {
if (isInputMethodOnceInserting) {
return;
}
super.remove(offs, len);
}
// kunsnat: 这种限制输入 有个不好的地方, 比如删除时: 10.1 最大值限定100, 那么就删除中间的小数点之后变为101, 超出了100. // kunsnat: 这种限制输入 有个不好的地方, 比如删除时: 10.1 最大值限定100, 那么就删除中间的小数点之后变为101, 超出了100.
// 但是直接限制不能删除中间类似小数点, 那么也可能遇到: 最小值10 , 从100变化到其中的19, 就很难.. // 但是直接限制不能删除中间类似小数点, 那么也可能遇到: 最小值10 , 从100变化到其中的19, 就很难..
private boolean notChange(String strNew) { private boolean notChange(String strNew) {

68
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -87,9 +87,9 @@ import javax.swing.JOptionPane;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Collections;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.regex.Pattern;
import java.awt.BorderLayout; import java.awt.BorderLayout;
/** /**
@ -860,33 +860,61 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
TemplateFileTree tt = TemplateTreePane.getInstance().getTemplateFileTree(); TemplateFileTree tt = TemplateTreePane.getInstance().getTemplateFileTree();
DefaultMutableTreeNode gen = (DefaultMutableTreeNode) tt.getModel().getRoot(); DefaultMutableTreeNode gen = (DefaultMutableTreeNode) tt.getModel().getRoot();
String[] str = new String[gen.getChildCount()]; String[] str = new String[gen.getChildCount()];
ArrayList<String> al = new ArrayList<String>();
List<Integer> reportNum = new ArrayList<>();
for (int j = 0; j < gen.getChildCount(); j++) { for (int j = 0; j < gen.getChildCount(); j++) {
str[j] = gen.getChildAt(j).toString(); str[j] = gen.getChildAt(j).toString();
if (str[j].contains(prefix) && str[j].contains(".")) { //返回文件名中的index(算法中没有再匹配文件后缀了,因为DefaultMutableTreeNode中已经匹配过了)
for (int i = 0; i < PREFIX_NUM; i++) { Integer index = getFileNameIndex(prefix, str[j]);
if (ComparatorUtils.equals(str[j].split("[.]")[0], (prefix + i))) { if (index != null) {
al.add(str[j]); reportNum.add(index);
}
}
} }
} }
Collections.sort(reportNum);
int idx = reportNum.size() > 0 ? reportNum.get(reportNum.size() - 1) + 1 : 1;
int[] reportNum = new int[al.size()];
for (int i = 0; i < al.size(); i++) {
Pattern pattern = Pattern.compile("[" + prefix + ".]+");
String[] strs = pattern.split(al.get(i).toString());
reportNum[i] = Integer.parseInt(strs[1]);
}
Arrays.sort(reportNum);
int idx = reportNum.length > 0 ? reportNum[reportNum.length - 1] + 1 : 1;
idx = idx + currentIndex; idx = idx + currentIndex;
currentIndex++; currentIndex++;
return prefix + idx; return prefix + idx;
} }
/**
* @Description 返回文件名中的index
* @param: prefix 前缀
* @param: fileName 文件名称全名
* @return java.lang.Integer WorkBook11.cpt则返回11如果没有找到index返回null
* @Author Henry.Wang
* @Date 2021/4/9 11:13
**/
private static Integer getFileNameIndex(String prefix, String fileName) {
char[] chars = new char[fileName.length()];
int i = 0;
for (; i < fileName.length(); i++) {
char c = fileName.charAt(i);
//匹配前缀
if (i < prefix.length()) {
if (c != prefix.charAt(i)) {
return null;
}
} else {
if (c == '.') {
break;
} else {
//匹配0~9
if (c < 48 || c > 57) {
return null;
}
chars[i - prefix.length()] = c;
}
}
}
String s = new String(chars).substring(0, i - prefix.length());
if (StringUtils.isBlank(s)) {
return null;
}
return Integer.valueOf(s);
}
// /////////////////////////////toolbarMenuDock////////////////////////////////// // /////////////////////////////toolbarMenuDock//////////////////////////////////
/** /**
@ -1371,7 +1399,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return getEditingFILE().getName(); return getEditingFILE().getName();
} }
public String getTemplatePredefinedStyle(){ public String getTemplatePredefinedStyle() {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }

12
designer-base/src/main/java/com/fr/design/selection/SelectableElement.java

@ -15,6 +15,16 @@ public interface SelectableElement {
* @return * @return
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public QuickEditor getQuickEditor(TargetComponent tc); QuickEditor getQuickEditor(TargetComponent tc);
/**
* @Description 有些实现类中getQuickEditor会在获取editor后再填充面板这个方法只会获取editor不会填充面板
* @param: tc
* @return com.fr.design.selection.QuickEditor
* @Author Henry.Wang
* @Date 2021/4/2 15:02
**/
default QuickEditor getQuickEditorWithoutPopulate(TargetComponent tc){
return null;
}
} }

147
designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java

@ -3,45 +3,162 @@
*/ */
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.design.gui.ilable.UILabel;
import com.fr.base.BaseUtils;
import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.designer.TargetComponent;
import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.ChartEditPaneProvider;
import com.fr.design.gui.frpane.UITitlePanel;
import com.fr.design.mainframe.chart.ChartEditPane;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
public class ChartPropertyPane extends MiddleChartPropertyPane{ public class ChartPropertyPane extends BaseChartPropertyPane {
/** /**
* 创建图表属性表实例. * 创建图表属性表实例.
*/ */
private synchronized static ChartPropertyPane getInstance() { private synchronized static ChartPropertyPane getInstance() {
//todo
//创建新图表时,创建属性表配置面板 //创建新图表时,创建属性表配置面板
if (singleton == null) {
singleton = new ChartPropertyPane(); singleton = new ChartPropertyPane();
}
return singleton; return singleton;
} }
private static ChartPropertyPane singleton; private static ChartPropertyPane singleton;
protected TargetComponentContainer container = new TargetComponentContainer();
protected ChartEditPane chartEditPane;
private ChartPropertyPane() {
initComponent();
}
protected void initComponent() {
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
@Override @Override
protected void createNameLabel() { public void updateChartEditPane(String plotID) {
nameLabel = new UILabel() { chartEditPane = ChartTypeInterfaceManager.getInstance().getChartEditPane(plotID);
chartEditPane.setContainer(container);
resetChartEditPane();
}
@Override @Override
public Dimension getPreferredSize() { public ChartEditPaneProvider getChartEditPane() {
return new Dimension(super.getPreferredSize().width, 18); return chartEditPane;
} }
};
nameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0));
nameLabel.setHorizontalAlignment(SwingConstants.CENTER); protected void resetChartEditPane() {
removeChartEditPane();
addChartEditPane(this.chartEditPane);
validate();
repaint();
revalidate();
} }
@Override /**
protected void createMainPane() { * @Description 去除BorderLayout.CENTER位置的元素
* @return void
* @Author Henry.Wang
* @Date 2021/4/9 13:54
**/
private void removeChartEditPane() {
BorderLayout layout = (BorderLayout) this.getLayout();
Component component = layout.getLayoutComponent(BorderLayout.CENTER);
if (component != null)
this.remove(component);
}
/**
* @Description 把chartEditPane加到BorderLayout.CENTER中
* @param: chartEditPane
* @return void
* @Author Henry.Wang
* @Date 2021/4/9 13:55
**/
private void addChartEditPane(ChartEditPane chartEditPane) {
this.add(chartEditPane, BorderLayout.CENTER); this.add(chartEditPane, BorderLayout.CENTER);
} }
@Override /**
protected JComponent createNorthComponent() { * 感觉ChartCollection加载图表属性界面.
return nameLabel; * @param collection 收集图表
* @param ePane 面板
*/
public void populateChartPropertyPane(ChartCollection collection, TargetComponent<?> ePane) {
updateChartEditPane(collection.getSelectedChartProvider(ChartProvider.class).getID());
setSupportCellData(true);
this.container.setEPane(ePane);
chartEditPane.populate(collection);
}
/**
* 感觉ChartCollection加载图表属性界面.
* @param collection 收集图表
* @param ePane 面板
*/
public void populateChartPropertyPane(BaseChartCollection collection, TargetComponent<?> ePane) {
if (collection instanceof ChartCollection) {
populateChartPropertyPane((ChartCollection) collection, ePane);
}
}
/**
* 返回View的标题.
*/
public String getViewTitle() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cell_Element_Property_Table");
}
/**
* 返回View的Icon地址.
*/
public Icon getViewIcon() {
return BaseUtils.readIcon("/com/fr/design/images/m_report/qb.png");
}
/**
* 预定义定位
* @return 定位
*/
public Location preferredLocation() {
return Location.WEST_BELOW;
}
/**
* 创建标题Panel
* @return 标题panel
*/
public UITitlePanel createTitlePanel() {
return new UITitlePanel(this);
}
/**
* 刷新Dockview
*/
public void refreshDockingView() {
// TODO Auto-generated method stub
}
/**
* 设置是否支持单元格数据.
*/
public void setSupportCellData(boolean supportCellData) {
if (chartEditPane != null) {
chartEditPane.setSupportCellData(supportCellData);
}
} }
public synchronized static void clear() { public synchronized static void clear() {

165
designer-chart/src/main/java/com/fr/design/mainframe/MiddleChartPropertyPane.java

@ -1,165 +0,0 @@
/*
* Copyright(c) 2001-2011, FineReport Inc, All Rights Reserved.
*/
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.designer.TargetComponent;
import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.ChartEditPaneProvider;
import com.fr.design.gui.frpane.UITitlePanel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.stable.StableUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import java.awt.BorderLayout;
public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{
protected TargetComponentContainer container = new TargetComponentContainer();
protected UILabel nameLabel;
protected ChartEditPane chartEditPane;
public MiddleChartPropertyPane() {
initComponenet();
}
protected void initComponenet() {
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));
createNameLabel();
//去掉上方名字,先注释掉
// this.add(createNorthComponent(), BorderLayout.NORTH);
chartEditPane = StableUtils.construct(ChartEditPane.class);
chartEditPane.setSupportCellData(true);
}
public void addChartEditPane(String plotID){
chartEditPane = ChartTypeInterfaceManager.getInstance().getChartEditPane(plotID);
chartEditPane.setSupportCellData(true);
this.createMainPane();
setSureProperty();
}
protected abstract void createNameLabel();
protected abstract JComponent createNorthComponent();
protected abstract void createMainPane();
@Override
public ChartEditPaneProvider getChartEditPane() {
return chartEditPane;
}
public void setSureProperty() {
chartEditPane.setContainer(container);
chartEditPane.addTitleChangeListener(titleListener);
String tabname = chartEditPane.getSelectedTabName();
nameLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Property_Table") + (tabname != null ? ('-' + chartEditPane.getSelectedTabName()) : ""));
resetChartEditPane();
}
protected void resetChartEditPane() {
remove(chartEditPane);
add(chartEditPane, BorderLayout.CENTER);
validate();
repaint();
revalidate();
}
protected TitleChangeListener titleListener = new TitleChangeListener() {
@Override
public void fireTitleChange(String addName) {
nameLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Property_Table") + '-' + addName);
}
};
/**
* 感觉ChartCollection加载图表属性界面.
* @param collection 收集图表
* @param ePane 面板
*/
public void populateChartPropertyPane(ChartCollection collection, TargetComponent<?> ePane) {
addChartEditPane(collection.getSelectedChartProvider(ChartProvider.class).getID());
setSupportCellData(true);
this.container.setEPane(ePane);
chartEditPane.populate(collection);
}
/**
* 感觉ChartCollection加载图表属性界面.
* @param collection 收集图表
* @param ePane 面板
*/
public void populateChartPropertyPane(BaseChartCollection collection, TargetComponent<?> ePane) {
if (collection instanceof ChartCollection) {
populateChartPropertyPane((ChartCollection)collection, ePane);
}
}
// public void clear() {
// this.container.setEPane(null);
// chartEditPane.clear();
// getParent().remove(this);
// }
/**
* 返回View的标题.
*/
public String getViewTitle() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cell_Element_Property_Table");
}
/**
* 返回View的Icon地址.
*/
public Icon getViewIcon() {
return BaseUtils.readIcon("/com/fr/design/images/m_report/qb.png");
}
/**
* 预定义定位
* @return 定位
*/
public Location preferredLocation() {
return Location.WEST_BELOW;
}
/**
* 创建标题Panel
* @return 标题panel
*/
public UITitlePanel createTitlePanel() {
return new UITitlePanel(this);
}
/**
* 刷新Dockview
*/
public void refreshDockingView() {
// TODO Auto-generated method stub
}
/**
* 设置是否支持单元格数据.
*/
public void setSupportCellData(boolean supportCellData) {
if(chartEditPane != null) {
chartEditPane.setSupportCellData(supportCellData);
}
}
}

2
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -530,7 +530,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
|| DesignModeContext.isAuthorityEditing()) { || DesignModeContext.isAuthorityEditing()) {
try { try {
//旧选中内容编辑器释放模板对象 //旧选中内容编辑器释放模板对象
QuickEditor editor = this.getCurrentEditor(); QuickEditor editor = this.selection.getQuickEditorWithoutPopulate(this);
if (editor != null) { if (editor != null) {
editor.release(); editor.release();
} }

14
designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java

@ -733,6 +733,16 @@ public class CellSelection extends Selection {
@Override @Override
public QuickEditor getQuickEditor(TargetComponent tc) { public QuickEditor getQuickEditor(TargetComponent tc) {
QuickEditor editor = getQuickEditorWithoutPopulate(tc);
if (editor == null) {
return null;
}
editor.populate(tc);
return editor;
}
@Override
public QuickEditor getQuickEditorWithoutPopulate(TargetComponent tc) {
ElementCasePane ePane = (ElementCasePane) tc; ElementCasePane ePane = (ElementCasePane) tc;
TemplateElementCase tplEC = ePane.getEditingElementCase(); TemplateElementCase tplEC = ePane.getEditingElementCase();
TemplateCellElement cellElement = tplEC.getTemplateCellElement(column, row); TemplateCellElement cellElement = tplEC.getTemplateCellElement(column, row);
@ -744,10 +754,6 @@ public class CellSelection extends Selection {
value = value == null ? StringUtils.EMPTY : value; value = value == null ? StringUtils.EMPTY : value;
//之前是少了个bigInteger,刚kunsnat又发现少了个bigDecimal,数字类型的都用stringEditor,没必要那个样子 //之前是少了个bigInteger,刚kunsnat又发现少了个bigDecimal,数字类型的都用stringEditor,没必要那个样子
QuickEditor editor = ActionFactory.getCellEditor((value instanceof Number) ? (Number.class) : (value.getClass())); QuickEditor editor = ActionFactory.getCellEditor((value instanceof Number) ? (Number.class) : (value.getClass()));
if (editor == null) {
return null;
}
editor.populate(tc);
return editor; return editor;
} }

11
designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java

@ -236,6 +236,15 @@ public class FloatSelection extends Selection {
@Override @Override
public QuickEditor getQuickEditor(TargetComponent tc) { public QuickEditor getQuickEditor(TargetComponent tc) {
QuickEditor editor = getQuickEditorWithoutPopulate(tc);
if (editor == null)
return null;
editor.populate(tc);
return editor;
}
@Override
public QuickEditor getQuickEditorWithoutPopulate(TargetComponent tc) {
ElementCasePane ePane = (ElementCasePane) tc; ElementCasePane ePane = (ElementCasePane) tc;
FloatElement selectedFloat = ePane.getEditingElementCase().getFloatElement(selectedFloatName); FloatElement selectedFloat = ePane.getEditingElementCase().getFloatElement(selectedFloatName);
Object value = null; Object value = null;
@ -246,10 +255,10 @@ public class FloatSelection extends Selection {
value = value == null ? "" : value; value = value == null ? "" : value;
value = value instanceof Number ? value.toString() : value; value = value instanceof Number ? value.toString() : value;
QuickEditor editor = ActionFactory.getFloatEditor(value.getClass()); QuickEditor editor = ActionFactory.getFloatEditor(value.getClass());
editor.populate(tc);
return editor; return editor;
} }
@Override @Override
public void populatePropertyPane(ElementCasePane ePane) { public void populatePropertyPane(ElementCasePane ePane) {
CellElementPropertyPane.getInstance().removeAll(); CellElementPropertyPane.getInstance().removeAll();

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

@ -163,6 +163,9 @@ public class DesignerActivator extends Activator {
@Override @Override
public void afterAllStart() { public void afterAllStart() {
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE); DesignerLaunchStatus.setStatus(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE);
//生成BasicChartQuickEditor对象,需要用到ChartDesignerActivator的注册信息(DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);)
//所以不能在registerCellEditor函数中进行注册
ActionFactory.registerCellEditor(ChartCollection.class, new BasicChartQuickEditor());
} }
private void loadLogAppender() { private void loadLogAppender() {
@ -347,8 +350,6 @@ public class DesignerActivator extends Activator {
ActionFactory.registerCellEditor(BiasTextPainter.class, new CellBiasTextPainterEditor()); ActionFactory.registerCellEditor(BiasTextPainter.class, new CellBiasTextPainterEditor());
ActionFactory.registerCellEditor(BufferedImage.class, new CellImageQuickEditor()); ActionFactory.registerCellEditor(BufferedImage.class, new CellImageQuickEditor());
ActionFactory.registerCellEditor(CellImagePainter.class, new CellImageQuickEditor()); ActionFactory.registerCellEditor(CellImagePainter.class, new CellImageQuickEditor());
//todo 图表编辑器populate没能实现刷新面板显示
ActionFactory.registerCellEditorClass(ChartCollection.class, BasicChartQuickEditor.class);
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) { for (ElementUIProvider provider : providers) {

Loading…
Cancel
Save