Browse Source

Merge pull request #4464 in DESIGN/design from feature/10.0 to feature/big-screen

* commit '298c614eb00055b9aa5e84d418e6db8847b2a77c':
  REPORT-53157 【智能联动】组件拖入时,单元格位置引用数据集的地方未修改
  REPORT-53156 【智能联动】组件拖入时,控件引用模板数据集的地方没有发生替换
  REPORT-52928 埋点只统计有特殊配置的组件
feature/big-screen
superman 3 years ago
parent
commit
e3ed254439
  1. 7
      designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java
  2. 6
      designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java
  3. 34
      designer-base/src/main/java/com/fr/design/mod/impl/change/DSColumnContentChange.java
  4. 34
      designer-base/src/main/java/com/fr/design/mod/impl/change/NameTableDataContentChange.java
  5. 34
      designer-base/src/main/java/com/fr/design/mod/impl/change/SimpleDSColumnContentChange.java
  6. 20
      designer-base/src/main/java/com/fr/design/mod/impl/repalce/DSColumnContentReplacer.java
  7. 17
      designer-base/src/main/java/com/fr/design/mod/impl/repalce/NameTableDataContentReplacer.java
  8. 20
      designer-base/src/main/java/com/fr/design/mod/impl/repalce/SimpleDSColumnContentReplacer.java
  9. 7
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  10. 14
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  11. 16
      designer-realize/src/main/java/com/fr/design/share/SharableInitManager.java
  12. 49
      designer-realize/src/main/java/com/fr/design/share/SharableManager.java
  13. 5
      designer-realize/src/main/java/com/fr/design/share/utils/EffectItemUtils.java
  14. 2
      designer-realize/src/main/java/com/fr/start/MainDesigner.java
  15. 4
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

7
designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java

@ -3,10 +3,12 @@ package com.fr.design.mod;
import com.fr.base.Formula;
import com.fr.chart.web.ChartHyperRelateCellLink;
import com.fr.chart.web.ChartHyperRelateFloatLink;
import com.fr.design.file.filter.ClassFilter;
import com.fr.data.SimpleDSColumn;
import com.fr.data.impl.NameTableData;
import com.fr.invoke.ClassHelper;
import com.fr.js.JavaScriptImpl;
import com.fr.plugin.chart.base.VanChartHtmlLabel;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.stable.Filter;
import java.util.HashSet;
import java.util.Map;
@ -41,6 +43,9 @@ public class ContentObjectManager {
set.add(ChartHyperRelateCellLink.class.getName());
set.add(ChartHyperRelateFloatLink.class.getName());
set.add(VanChartHtmlLabel.class.getName());
set.add(NameTableData.class.getName());
set.add(SimpleDSColumn.class.getName());
set.add(DSColumn.class.getName());
}
public void searchObject(Object ob) {

6
designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java

@ -6,8 +6,11 @@ import com.fr.design.mod.event.TableDataModifyEvent;
import com.fr.design.mod.event.WidgetNameModifyEvent;
import com.fr.design.mod.impl.change.ChartHyperRelateCellLinkContentChange;
import com.fr.design.mod.impl.change.ChartHyperRelateFloatLinkContentChange;
import com.fr.design.mod.impl.change.DSColumnContentChange;
import com.fr.design.mod.impl.change.FormulaContentChange;
import com.fr.design.mod.impl.change.JavaScriptContentChange;
import com.fr.design.mod.impl.change.NameTableDataContentChange;
import com.fr.design.mod.impl.change.SimpleDSColumnContentChange;
import com.fr.design.mod.impl.change.VanChartHtmlLabelContentChange;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
@ -73,6 +76,9 @@ public class ContentReplacerCenter {
contentChangeList.add(new FormulaContentChange());
contentChangeList.add(new JavaScriptContentChange());
contentChangeList.add(new VanChartHtmlLabelContentChange());
contentChangeList.add(new NameTableDataContentChange());
contentChangeList.add(new SimpleDSColumnContentChange());
contentChangeList.add(new DSColumnContentChange());
}
private void onRename(List<ContentChangeItem> contentChangeItemList, List<ContentChange> contentChangeList) {

34
designer-base/src/main/java/com/fr/design/mod/impl/change/DSColumnContentChange.java

@ -0,0 +1,34 @@
package com.fr.design.mod.impl.change;
import com.fr.design.mod.ContentChange;
import com.fr.design.mod.ContentReplacer;
import com.fr.design.mod.bean.ChangeItem;
import com.fr.design.mod.impl.repalce.DSColumnContentReplacer;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import java.util.HashMap;
import java.util.Map;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/6/2
*/
public class DSColumnContentChange implements ContentChange<DSColumn> {
private final Map<ChangeItem, ContentReplacer<DSColumn>> map;
public DSColumnContentChange() {
map = new HashMap<>();
map.put(ChangeItem.TABLE_DATA_NAME, new DSColumnContentReplacer());
}
@Override
public String type() {
return DSColumn.class.getName();
}
@Override
public Map<ChangeItem, ContentReplacer<DSColumn>> changeInfo() {
return map;
}
}

34
designer-base/src/main/java/com/fr/design/mod/impl/change/NameTableDataContentChange.java

@ -0,0 +1,34 @@
package com.fr.design.mod.impl.change;
import com.fr.data.impl.NameTableData;
import com.fr.design.mod.ContentChange;
import com.fr.design.mod.ContentReplacer;
import com.fr.design.mod.bean.ChangeItem;
import com.fr.design.mod.impl.repalce.NameTableDataContentReplacer;
import java.util.HashMap;
import java.util.Map;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/6/2
*/
public class NameTableDataContentChange implements ContentChange<NameTableData> {
private final Map<ChangeItem, ContentReplacer<NameTableData>> map;
public NameTableDataContentChange() {
map = new HashMap<>();
map.put(ChangeItem.TABLE_DATA_NAME, new NameTableDataContentReplacer());
}
@Override
public String type() {
return NameTableData.class.getName();
}
@Override
public Map<ChangeItem, ContentReplacer<NameTableData>> changeInfo() {
return map;
}
}

34
designer-base/src/main/java/com/fr/design/mod/impl/change/SimpleDSColumnContentChange.java

@ -0,0 +1,34 @@
package com.fr.design.mod.impl.change;
import com.fr.data.SimpleDSColumn;
import com.fr.design.mod.ContentChange;
import com.fr.design.mod.ContentReplacer;
import com.fr.design.mod.bean.ChangeItem;
import com.fr.design.mod.impl.repalce.SimpleDSColumnContentReplacer;
import java.util.HashMap;
import java.util.Map;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/6/2
*/
public class SimpleDSColumnContentChange implements ContentChange<SimpleDSColumn> {
private Map<ChangeItem, ContentReplacer<SimpleDSColumn>> map;
public SimpleDSColumnContentChange() {
map = new HashMap<>();
map.put(ChangeItem.TABLE_DATA_NAME, new SimpleDSColumnContentReplacer());
}
@Override
public String type() {
return SimpleDSColumn.class.getName();
}
@Override
public Map<ChangeItem, ContentReplacer<SimpleDSColumn>> changeInfo() {
return map;
}
}

20
designer-base/src/main/java/com/fr/design/mod/impl/repalce/DSColumnContentReplacer.java

@ -0,0 +1,20 @@
package com.fr.design.mod.impl.repalce;
import com.fr.design.mod.ContentReplacer;
import com.fr.general.ComparatorUtils;
import com.fr.report.cell.cellattr.core.group.DSColumn;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/6/2
*/
public class DSColumnContentReplacer implements ContentReplacer<DSColumn> {
@Override
public void replace(DSColumn dsColumn, String oldName, String newName) {
if (ComparatorUtils.equals(dsColumn.getDSName(), oldName)) {
dsColumn.setDSName(newName);
}
}
}

17
designer-base/src/main/java/com/fr/design/mod/impl/repalce/NameTableDataContentReplacer.java

@ -0,0 +1,17 @@
package com.fr.design.mod.impl.repalce;
import com.fr.data.impl.NameTableData;
import com.fr.design.mod.ContentReplacer;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/6/2
*/
public class NameTableDataContentReplacer implements ContentReplacer<NameTableData> {
@Override
public void replace(NameTableData nameTableData, String oldName, String newName) {
nameTableData.rename(oldName, newName);
}
}

20
designer-base/src/main/java/com/fr/design/mod/impl/repalce/SimpleDSColumnContentReplacer.java

@ -0,0 +1,20 @@
package com.fr.design.mod.impl.repalce;
import com.fr.data.SimpleDSColumn;
import com.fr.design.mod.ContentReplacer;
import com.fr.general.ComparatorUtils;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/6/2
*/
public class SimpleDSColumnContentReplacer implements ContentReplacer<SimpleDSColumn> {
@Override
public void replace(SimpleDSColumn simpleDSColumn, String oldName, String newName) {
if (ComparatorUtils.equals(simpleDSColumn.getDsName(), oldName)) {
simpleDSColumn.setDsName(newName);
}
}
}

7
designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -5,6 +5,7 @@ import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.DesignModelAdapter;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.HoverPainter;
@ -34,6 +35,7 @@ import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import java.util.Collections;
import java.util.HashMap;
import javax.swing.BorderFactory;
import javax.swing.JWindow;
import java.util.List;
@ -112,8 +114,13 @@ public class FormCreatorDropTarget extends DropTarget {
tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource(), true);
//合并数据集之后,可能会有数据集名称变化,做一下联动
//共享的组件拿的时候都是克隆的,这边改拖拽中克隆的对象而非新克隆对象,上面这个新克隆的对象只是为了拿数据集
Map<String, String> map = new HashMap<>();
for (Map.Entry<String, String> entry : tdNameMap.entrySet()) {
designer.getTarget().renameTableData(widget, entry.getKey(), entry.getValue());
map.put(entry.getKey(), entry.getValue());
}
if (!map.isEmpty()) {
DesignTableDataManager.fireDSChanged(map);
}
}
EventDispatcher.fire(TableDataModifyEvent.INSTANCE, new ContentChangeItem(tdNameMap, widget, ChangeItem.TABLE_DATA_NAME));

14
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -346,20 +346,6 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
if (jt == null) {
return;
}
int useCount = 0;
if (!jt.getProcessInfo().isTestTemplate()) {
JForm jForm = (JForm) jt;
XLayoutContainer root = jForm.getFormDesign().getRootComponent();
List<XCreator> xCreators = ShareComponentUtils.getHelpConfigXCreatorList(root);
JSONArray helpConfigUseInfo = ComponentCollector.getInstance().getHelpConfigUseInfoWithTemplate(jt.getTarget().getTemplateID());
for (XCreator xCreator : xCreators) {
if (helpConfigUseInfo.contains(ShareComponentUtils.getWidgetId(xCreator.toData()))) {
useCount++;
}
}
ComponentCollector.getInstance().collectHelpConfigInfo(jt.getTarget().getTemplateID(), xCreators.size(), useCount);
}
}
});

16
designer-realize/src/main/java/com/fr/design/share/SharableInitManager.java

@ -1,16 +0,0 @@
package com.fr.design.share;
import com.fr.design.base.clipboard.ClipboardFilter;
import com.fr.design.mainframe.share.collect.SharableCollectorManager;
import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptSelectionClipboardHandler;
import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptTransferableClipboardHandler;
import com.fr.design.mainframe.share.util.SharableXMLUtils;
public class SharableInitManager {
public static void start() {
SharableXMLUtils.registerSharableReadHelper();
SharableCollectorManager.getInstance().execute();
ClipboardFilter.registerClipboardHandler(EncryptSelectionClipboardHandler.getInstance());
ClipboardFilter.registerClipboardHandler(EncryptTransferableClipboardHandler.getInstance());
}
}

49
designer-realize/src/main/java/com/fr/design/share/SharableManager.java

@ -0,0 +1,49 @@
package com.fr.design.share;
import com.fr.design.base.clipboard.ClipboardFilter;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.collect.SharableCollectorManager;
import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptSelectionClipboardHandler;
import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptTransferableClipboardHandler;
import com.fr.design.mainframe.share.util.SharableXMLUtils;
import com.fr.design.mainframe.share.util.ShareComponentUtils;
import com.fr.design.share.utils.EffectItemUtils;
import com.fr.json.JSONArray;
import java.util.List;
public class SharableManager {
public static void start() {
SharableXMLUtils.registerSharableReadHelper();
SharableCollectorManager.getInstance().execute();
ClipboardFilter.registerClipboardHandler(EncryptSelectionClipboardHandler.getInstance());
ClipboardFilter.registerClipboardHandler(EncryptTransferableClipboardHandler.getInstance());
}
public static void saveTemplate(JTemplate jt) {
if (jt instanceof JForm) {
int showCount = 0;
int useCount = 0;
if (!jt.getProcessInfo().isTestTemplate()) {
JForm jForm = (JForm) jt;
XLayoutContainer root = jForm.getFormDesign().getRootComponent();
List<XCreator> xCreators = ShareComponentUtils.getHelpConfigXCreatorList(root);
JSONArray helpConfigUseInfo = ComponentCollector.getInstance().getHelpConfigUseInfoWithTemplate(jForm.getTarget().getTemplateID());
for (XCreator xCreator : xCreators) {
if (EffectItemUtils.hasEffectItem(xCreator.toData())) {
showCount ++;
if (helpConfigUseInfo.contains(ShareComponentUtils.getWidgetId(xCreator.toData()))) {
useCount++;
}
}
}
ComponentCollector.getInstance().collectHelpConfigInfo(jForm.getTarget().getTemplateID(), showCount, useCount);
}
}
}
}

5
designer-realize/src/main/java/com/fr/design/share/utils/EffectItemUtils.java

@ -19,4 +19,9 @@ public class EffectItemUtils {
}
return effectItemGroupList;
}
public static boolean hasEffectItem(Widget widget) {
EffectItemGroup effectItemGroup = new EffectItemGroup(widget);
return effectItemGroup.getEffectItems().size() > 0;
}
}

2
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -38,6 +38,7 @@ import com.fr.design.module.ChartEmptyDataStyleAction;
import com.fr.design.module.ChartPreStyleAction;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.monitor.DesignerLifecycleMonitorContext;
import com.fr.design.share.SharableManager;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.Event;
@ -235,6 +236,7 @@ public class MainDesigner extends BaseDesigner {
jt.stopEditing();
jt.saveDirectly();
jt.requestFocus();
SharableManager.saveTemplate(jt);
}
});
}

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

@ -61,7 +61,7 @@ import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.parameter.FormParameterReader;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.parameter.WorkBookParameterReader;
import com.fr.design.share.SharableInitManager;
import com.fr.design.share.SharableManager;
import com.fr.design.share.ui.config.ShareConfigPane;
import com.fr.design.share.ui.generate.ShareGeneratePane;
import com.fr.design.update.actions.RecoverForDesigner;
@ -207,7 +207,7 @@ public class DesignerActivator extends Activator {
designerRegister();
InformationCollector.getInstance().collectStartTime();
SharableInitManager.start();
SharableManager.start();
}
private void createPluginListener() {

Loading…
Cancel
Save