Browse Source

REPORT-52928 部分埋点没有记录

feature/10.0
kuangshuai 3 years ago
parent
commit
b5f3394fa7
  1. 2
      designer-base/src/main/java/com/fr/design/mainframe/share/collect/SharableCollectorManager.java
  2. 25
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  3. 18
      designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java

2
designer-base/src/main/java/com/fr/design/mainframe/share/collect/SharableCollectorManager.java

@ -43,7 +43,7 @@ public class SharableCollectorManager {
public void execute() {
service = Executors
.newSingleThreadScheduledExecutor(new NamedThreadFactory("plugin-CollectorManager", true));
.newSingleThreadScheduledExecutor(new NamedThreadFactory("SharableComponentCollectorManager", true));
service.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {

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

@ -45,6 +45,8 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.form.FormECCompositeProvider;
import com.fr.design.mainframe.form.FormECDesignerProvider;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.util.ShareComponentUtils;
import com.fr.design.mainframe.template.info.JFormProcessInfo;
import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
@ -74,6 +76,7 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.general.ComparatorUtils;
import com.fr.json.JSONArray;
import com.fr.log.FineLoggerFactory;
import com.fr.page.PaperSettingProvider;
import com.fr.plugin.observer.PluginEventListener;
@ -337,6 +340,28 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
ReuseTriggerPointManager.getInstance().registerJForm(JForm.this);
}
@Override
public void templateSaved(JTemplate<?, ?> jt) {
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);
}
}
});
return tabCenterPane;
}

18
designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java

@ -20,8 +20,11 @@ import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
/**
* Coder: zack
@ -89,5 +92,18 @@ public class ShareComponentUtils {
}
public static List<XCreator> getHelpConfigXCreatorList(XCreator root) {
List<XCreator> helpConfigXCreatorList = new ArrayList<>();
if (isShareWidget(root)) {
helpConfigXCreatorList.add(root);
return helpConfigXCreatorList;
}
Component[] components = root.getComponents();
for (Component component : components) {
if (component instanceof XCreator) {
helpConfigXCreatorList.addAll(getHelpConfigXCreatorList((XCreator) component));
}
}
return helpConfigXCreatorList;
}
}

Loading…
Cancel
Save